aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 648f231..f3e21da 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1790,7 +1790,7 @@ namespace QuickMedia {
// TODO: Remove this once manga history file has been in use for a few months and is filled with history
time_t now = time(NULL);
- for_files_in_dir_sort_last_modified(content_storage_dir, [&](const Path &filepath, FileType) {
+ for_files_in_dir_sort_last_modified(content_storage_dir, [&](const Path &filepath, FileType, time_t last_modified_seconds) {
// This can happen when QuickMedia crashes/is killed while writing to storage.
// In that case, the storage wont be corrupt but there will be .tmp files.
// TODO: Remove these .tmp files if they exist during startup
@@ -1812,12 +1812,12 @@ namespace QuickMedia {
if(!manga_name.isString())
return true;
- time_t last_modified_time = 0;
- file_get_last_modified_time_seconds(filepath.data.c_str(), &last_modified_time);
+ if(last_modified_seconds == 0)
+ file_get_last_modified_time_seconds(filepath.data.c_str(), &last_modified_seconds);
// TODO: Add thumbnail
auto body_item = BodyItem::create(manga_name.asString());
- body_item->set_description("Last read " + seconds_to_relative_time_str(now - last_modified_time));
+ body_item->set_description("Last read " + seconds_to_relative_time_str(now - last_modified_seconds));
body_item->set_description_color(get_theme().faded_text_color);
auto thumbnail_it = manga_id_to_thumbnail_url_map.find(manga_id);
@@ -3330,18 +3330,21 @@ namespace QuickMedia {
std::string audio_url;
bool has_embedded_audio = true;
+ bool update_duration_retry = false;
auto update_video_duration_handler = [&]() {
if(!video_player)
return;
- if(update_duration) {
+ if(update_duration || update_duration_retry) {
update_duration = false;
successfully_fetched_video_duration = false;
double file_duration = 0.0;
video_player->get_duration(&file_duration);
video_info.duration = std::max(video_info.duration, file_duration);
- if(video_info.duration > 0.001)
+ if(video_info.duration > 0.001) {
+ update_duration_retry = false;
successfully_fetched_video_duration = true;
+ }
}
};
@@ -3361,6 +3364,9 @@ namespace QuickMedia {
update_time_pos = true;
}
+ if(update_duration || (update_duration_retry && update_time_pos))
+ update_video_duration_handler();
+
if(update_time_pos) {
update_time_pos = false;
const double prev_video_time_pos = video_time_pos;
@@ -3382,8 +3388,6 @@ namespace QuickMedia {
}
}
}
-
- update_video_duration_handler();
};
auto load_video_error_check = [&](std::string start_time = "", bool reuse_media_source = false) mutable {
@@ -3589,6 +3593,7 @@ namespace QuickMedia {
//video_player->set_paused(false);
} else if(strcmp(event_name, "start-file") == 0) {
update_duration = true;
+ update_duration_retry = true;
added_recommendations = false;
time_watched_timer.restart();
video_loaded = true;
@@ -4230,6 +4235,15 @@ namespace QuickMedia {
}
}
+ {
+ FileAnalyzer file_analyzer;
+ if(file_analyzer.load_file(image_filepath_tmp.data.c_str(), false) && file_analyzer.get_content_type() == ContentType::IMAGE_WEBP) {
+ Path new_filepath = image_filepath_tmp.data + ".png";
+ if(ffmpeg_convert_image_format(image_filepath_tmp, new_filepath))
+ image_filepath_tmp = std::move(new_filepath);
+ }
+ }
+
bool rename_immediately = true;
if(upscale_image_action == UpscaleImageAction::LOW_RESOLUTION) {
int screen_width, screen_height;