aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-18 18:19:35 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-18 18:19:35 +0100
commit9301f1da5cf779516131f6bd5ddfc22991601128 (patch)
treeee1ddc7b9ca0c0c7552190bb0f1a141f603fa4d7
parentcfb6238ad7fe7dd7d2eca64676437bb871802375 (diff)
local-anime: fix broken duration (fixes watch progress)
-rw-r--r--src/plugins/LocalAnime.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/LocalAnime.cpp b/src/plugins/LocalAnime.cpp
index 318058b..9757be1 100644
--- a/src/plugins/LocalAnime.cpp
+++ b/src/plugins/LocalAnime.cpp
@@ -367,6 +367,19 @@ namespace QuickMedia {
void LocalAnimeVideoPage::set_watch_progress(double time_pos_sec) {
std::string filename_relative_to_anime_dir = url.substr(get_config().local_anime.directory.size() + 1);
+ FileAnalyzer file_analyzer;
+ if(!file_analyzer.load_file(url.c_str(), true)) {
+ show_notification("QuickMedia", "Failed to load " + filename_relative_to_anime_dir + " to set watch progress", Urgency::CRITICAL);
+ return;
+ }
+
+ if(!file_analyzer.get_duration_seconds()) {
+ show_notification("QuickMedia", "Failed to get duration of " + filename_relative_to_anime_dir + " to set watch progress", Urgency::CRITICAL);
+ return;
+ }
+
+ watch_progress.duration = *file_analyzer.get_duration_seconds();
+
Path watch_progress_dir = get_storage_dir().join("watch-progress");
if(create_directory_recursive(watch_progress_dir) != 0) {
show_notification("QuickMedia", "Failed to create " + watch_progress_dir.data + " to set watch progress for " + filename_relative_to_anime_dir, Urgency::CRITICAL);