aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);