diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-03-06 05:14:51 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-03-06 05:14:51 +0100 |
commit | 123124a4a89d83f605d67d94145b4008b9a5b1d7 (patch) | |
tree | d09c4a9714f3eb89dd9720e51f8ef799ad2d189b | |
parent | 0a64acc3d68fecf5e7f23c6b0a013272f9288af8 (diff) |
Do not cache local-anime, reseek to anime on progress update
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | include/VideoPlayer.hpp | 1 | ||||
-rw-r--r-- | mpv/scripts/mordenx.lua | 2 | ||||
-rw-r--r-- | plugins/LocalAnime.hpp | 1 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 3 | ||||
-rw-r--r-- | src/VideoPlayer.cpp | 13 |
6 files changed, 17 insertions, 7 deletions
@@ -68,7 +68,7 @@ Type text and then wait and QuickMedia will automatically search.\ ### Video controls `mpv` controls apply in general, see https://mpv.io/manual/master/#interactive-control.\ `Esc`/`Backspace`/`Q`: Close the video.\ -`Ctrl+F`: Toggle between fullscreen mode and window mode.\ +`Ctrl+F`/`Double left mouse click`: Toggle between fullscreen mode and window mode.\ `Ctrl+R`: Show pages related to the video, such as comments, related videos or channel videos (if supported).\ `Ctrl+S`: Save the video/music.\ `Ctrl+C`: Copy the url of the currently playing video to the clipboard (with timestamp, if supported).\ @@ -171,7 +171,7 @@ If `use_system_mpv_config` is set to `true` then your systems mpv config in `~/. Theme is loaded from `~/.config/quickmedia/themes/<theme-name>.json` if it exists or from `/usr/share/quickmedia/themes`. Theme name is set in `~/.config/quickmedia/config.json` under the variable `theme`.\ Default themes available: `default, nord`.\ See [default.json](https://git.dec05eba.com/QuickMedia/plain/themes/default.json) for an example theme.\ -The `default` is used by default. +The `default` theme is used by default. ## <a id="local-manga"></a>Local manga `local_manga.directory` needs to be set in `~/.config/quickmedia/config.json` to a directory with all your manga.\ The directory layout is expected to be like this: diff --git a/include/VideoPlayer.hpp b/include/VideoPlayer.hpp index 981c114..8764aa8 100644 --- a/include/VideoPlayer.hpp +++ b/include/VideoPlayer.hpp @@ -49,6 +49,7 @@ namespace QuickMedia { std::string start_time; std::vector<MediaChapter> chapters; std::string plugin_name; + bool cache_on_disk = true; }; // Important: do not call |get_time_in_file| or |add_subtitle| from the |event_callback| callback diff --git a/mpv/scripts/mordenx.lua b/mpv/scripts/mordenx.lua index 2df72c3..8925642 100644 --- a/mpv/scripts/mordenx.lua +++ b/mpv/scripts/mordenx.lua @@ -118,7 +118,7 @@ local osc_styles = { Ctrl2Flip = '{\\blur0\\bord0\\1c&HFFFFFF&\\3c&HFFFFFF&\\fs30\\fnmaterial-design-iconic-font\\fry180',
Ctrl3 = '{\\blur0\\bord0\\1c&HFFFFFF&\\3c&HFFFFFF&\\fs30\\fnmaterial-design-iconic-font}',
Time = '{\\blur0\\bord0\\1c&HFFFFFF&\\3c&H000000&\\fs20\\fn' .. user_opts.font .. '}',
- Tooltip = '{\\blur1\\bord0.5\\1c&HFFFFFF&\\3c&H000000&\\fs18\\fn' .. user_opts.font .. '}',
+ Tooltip = '{\\blur1\\bord0.5\\1c&HFFFFFF&\\3c&H000000&\\fs20\\fn' .. user_opts.font .. '}',
Title = '{\\blur1\\bord0.5\\1c&HFFFFFF&\\3c&H0\\fs32\\q2\\fn' .. user_opts.font .. '}',
WinCtrl = '{\\blur1\\bord0.5\\1c&HFFFFFF&\\3c&H0\\fs20\\fnmpv-osd-symbols}',
elementDown = '{\\1c&H999999&}',
diff --git a/plugins/LocalAnime.hpp b/plugins/LocalAnime.hpp index 111d363..0313231 100644 --- a/plugins/LocalAnime.hpp +++ b/plugins/LocalAnime.hpp @@ -39,6 +39,7 @@ namespace QuickMedia { PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override; PluginResult lazy_fetch(BodyItems &result_items) override; void toggle_read(BodyItem *selected_item) override; + bool reseek_to_body_item_by_url() override { return true; } LocalAnimeSearchPage *parent_search_page; private: diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 96da31f..b9dd0f0 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -2529,6 +2529,8 @@ namespace QuickMedia { } else if(!tabs[selected_tab].page->search_is_filter()) { tab_associated_data[selected_tab].search_text_updated = true; } + const BodyItem *selected_item = tabs[selected_tab].body->get_selected(); + tab_associated_data[selected_tab].body_item_url_before_refresh = selected_item ? selected_item->url : ""; tabs[selected_tab].body->clear_items(); } @@ -3265,6 +3267,7 @@ namespace QuickMedia { startup_args.start_time = start_time; startup_args.chapters = std::move(media_chapters); startup_args.plugin_name = plugin_name; + startup_args.cache_on_disk = !video_page->is_local(); video_player = std::make_unique<VideoPlayer>(std::move(startup_args), video_event_callback, on_window_create); VideoPlayer::Error err = video_player->load_video(); diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 26e2013..3d3fcc7 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -182,21 +182,26 @@ namespace QuickMedia { "--force-seekable=yes", "--image-display-duration=5", "--cache-pause=yes", - "--cache=yes", - "--cache-on-disk=yes", - "--cache-secs=86400", // 24 hours "--sub-font-size=50", "--sub-margin-y=60", "--sub-border-size=2.0", "--sub-bold=yes", "--input-default-bindings=yes", "--input-vo-keyboard=yes", - cache_dir.c_str(), wid_arg.c_str(), "--ipc-fd", ipc_fd.c_str() }); + if(startup_args.cache_on_disk) { + args.insert(args.end(), { + "--cache=yes", + "--cache-on-disk=yes", + "--cache-secs=86400", // 24 hours + cache_dir.c_str() + }); + } + if(startup_args.resume) { args.push_back("--save-position-on-quit=yes"); args.push_back("--resume-playback=yes"); |