aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 82741bb..77098a3 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1360,8 +1360,15 @@ namespace QuickMedia {
Json::Value Program::load_video_history_json() {
Path video_history_filepath = get_video_history_filepath(plugin_name);
Json::Value json_result;
- if(!read_file_as_json(video_history_filepath, json_result) || !json_result.isArray())
+ FileType file_type = get_file_type(video_history_filepath);
+ if(file_type == FileType::REGULAR) {
+ if(!read_file_as_json(video_history_filepath, json_result) || !json_result.isArray()) {
+ show_notification("QuickMedia", "Failed to read " + video_history_filepath.data, Urgency::CRITICAL);
+ abort();
+ }
+ } else {
json_result = Json::Value(Json::arrayValue);
+ }
return json_result;
}
@@ -1473,6 +1480,10 @@ namespace QuickMedia {
FileType file_type = get_file_type(content_storage_file);
if(file_type == FileType::REGULAR) {
result = read_file_as_json(content_storage_file, content_storage_json) && content_storage_json.isObject();
+ if(!result) {
+ show_notification("QuickMedia", "Failed to read " + content_storage_file.data, Urgency::CRITICAL);
+ abort();
+ }
} else {
result = true;
}
@@ -2916,9 +2927,9 @@ namespace QuickMedia {
load_video_error_check();
} else if(update_err != VideoPlayer::Error::OK) {
+ ++load_try;
if(load_try < num_load_tries_max) {
fprintf(stderr, "Failed to play the media, retrying (try %d out of %d)\n", 1 + load_try, num_load_tries_max);
- ++load_try;
load_video_error_check(prev_start_time);
} else {
show_notification("QuickMedia", "Failed to play the video (error code " + std::to_string((int)update_err) + ")", Urgency::CRITICAL);