Commit Graph

13 Commits

Author SHA1 Message Date
tomasklaen
910074af7b chore: remove typo from cSpell.words 2023-10-15 17:00:37 +02:00
tomasklaen
e9453fb579 refactor: cursor event handling
Split cursor into its own `lib/` file and added persistent event handling via `:on()`, `:off()`, and `:once()` methods.

Cursor now also listens on secondary pointer events.
2023-10-15 15:51:45 +02:00
tomasklaen
10768d212d feat: improved menu cursor navigation
- Left side of the empty menu screen is no longer a huge invisible back button. Instead, each parent menu can be clicked individually to navigate to it. Clicking empty space now correctly closes the menu.
- Submenus can now also be clicked to navigate to them.
- Moving cursor towards a submenu will not cause other items in current menu to be selected if cursor moves through them.

ref #217
2023-05-17 21:06:17 +02:00
tomasklaen
4399904bba refactor: change directory structure to support mpv 0.32 and lower 2022-10-27 12:09:59 +02:00
tomasklaen
c00e296953 refactor: modularize the codebase
Splits the monolith file into individual modules with as little code refactoring as possible.

Not too happy with it, mainly because of the weird language server behavior where it doesn't recognize types or variables unless the files defining them are open...

It'd also be better to refactor everything from the ground up to not depend on global variables but if I had that much time to invest I'd straight up just rewrite everything in typescript and use TS→Lua transpiler.
2022-10-25 12:14:50 +02:00
tomasklaen
89c8d3fde1 chore: add words to cSpell 2022-10-24 22:19:32 +02:00
tomasklaen
eca7836889 feat: split intros & outros into their own chapter range types
ref #163
2022-09-23 12:34:33 +02:00
tomasklaen
612e2a5cc4 refactor: renamed next_file_on_end to autoload 2022-09-23 11:59:00 +02:00
tomasklaen
d2dd7e4415 feat: implemented shuffle and next_file_on_end options
The `shuffle` option built into mpv doesn't shuffle playlist playback, but instead just randomizes the order of every new opened playlist. So when you enable this after opening a playlist, it does nothing. If you enable it before opening a playlist, it'll randomize its list order, so you can't browse alphabetically. None wants this, none expects this. And since its is expected from a ui such as uosc to provide a shuffle button that works like in any other media player on the planet, I had to simulate it.

It decides on the next file 300ms before the end, so it can potentially cut out punchlines from short videos such as those from r/perfectlycutscreams. But this is necessary because a lot of files actually end like ~100ms or more before their duration, but on corrupted files or files where stream ended prematurely, this can happen way before that. If file is force ended by mpv before our timer kicks in, our simulated `file-end` event won't fire, and uosc is unable to take over to decide to play the next one.

I couldn't figure out a better way to implement this. There's no 'fil-reached-end' even in mpv. There are only 'im-unloading-the-file' events (`file-end`, `on_unload`, ... etc), which is useless here because it triggers even when user opens a different file during playback.

Implementing `shuffle` allowed for trivial `next_file_on_end`, so that got added as well. It load next file in directory when current file ends.

Directory navigation now also adheres to `shuffle` uosc option, and `playlist-loop`, `playlist-repeat`, & `loop-file` mpv options.

Additionally, the `<has_playlist>` disposition was removed from the `shuffle` and `loop-playlist` control bar buttons as they now affect directory navigation as well.

closes #235
2022-09-22 14:57:54 +02:00
tomasklaen
a4257d7c31 feat!: accept colors in RGB(A) HEX format
Affects options `foreground`, `foreground_text`, `background`, `background_text`.

Other configurable colors will follow suit in next commits.
2022-09-21 14:02:43 +02:00
tomasklaen
5d396512ee refactor: thumbnail handling and styling
ref #213
2022-09-21 13:12:52 +02:00
tomasklaen
bff2060058 style: let language server handle code formatting
This is not complete, as I currently can't get the formatter to recognize `.editorconfig` file. Or at least it seems to ignore most of the options in it, so a lot of formatting doesn't adhere to the config.

Will need another pass when that gets fixed.
2022-08-24 12:23:59 +02:00
Tomas Sardyha
a1d3b7e000 Add .vscode config 2020-03-03 11:18:25 +01:00