aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-06-17 08:54:00 +0200
committerdec05eba <dec05eba@protonmail.com>2021-06-17 08:54:00 +0200
commitc1d0fe75d267f33724c38af95efc7b1c050dc160 (patch)
treeda21d8a45da85b6283ee53532e7edfb3559ffd88 /src/QuickMedia.cpp
parent275cb68f08f4fa5bb5a970ea016c7c45269964c9 (diff)
Temporary abort on fail to read file.. if its being modified while reading
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);