diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-09-14 02:31:06 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-09-14 02:31:06 +0200 |
commit | f0122e7386e0e4fe63dafa9c1835ae0b04557ee4 (patch) | |
tree | ffbc1bd65de5e920a8fbd47db0fdbc7d9ea1f1ac | |
parent | 8c8e0fceedfe66bb2d5c07257514cbc64596bb3c (diff) |
Do not show error when quiting video with 'q'
-rw-r--r-- | QuickMediaYoutube.png | bin | 294140 -> 0 bytes | |||
-rw-r--r-- | include/VideoPlayer.hpp | 2 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 3 | ||||
-rw-r--r-- | src/VideoPlayer.cpp | 6 |
4 files changed, 8 insertions, 3 deletions
diff --git a/QuickMediaYoutube.png b/QuickMediaYoutube.png Binary files differdeleted file mode 100644 index 2798440..0000000 --- a/QuickMediaYoutube.png +++ /dev/null diff --git a/include/VideoPlayer.hpp b/include/VideoPlayer.hpp index 9501e26..3f3a18c 100644 --- a/include/VideoPlayer.hpp +++ b/include/VideoPlayer.hpp @@ -59,6 +59,8 @@ namespace QuickMedia { Error is_seekable(bool *result); bool is_connected() const { return connected_to_ipc; } + + int exit_status; private: Error set_property(const std::string &property_name, const Json::Value &value); Error get_property(const std::string &property_name, Json::Value *result, Json::ValueType result_type); diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 4b528cf..6935995 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1299,6 +1299,9 @@ namespace QuickMedia { show_notification("Video player", "Failed to connect to mpv ipc after 10 seconds", Urgency::CRITICAL); current_page = previous_page; break; + } else if(update_err == VideoPlayer::Error::EXITED && video_player->exit_status == 0) { + fprintf(stderr, "mpv exited with status 0, the user most likely closed mpv with 'q'\n"); + current_page = previous_page; } else if(update_err != VideoPlayer::Error::OK) { show_notification("Video player", "The video player failed to play the video", Urgency::CRITICAL); current_page = previous_page; diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 8d57f62..e8f8795 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -26,6 +26,7 @@ namespace QuickMedia { connected_to_ipc(false), connect_tries(0), find_window_tries(0), + exit_status(0), event_callback(_event_callback), window_create_callback(_window_create_callback), window_handle(0), @@ -209,9 +210,8 @@ namespace QuickMedia { } if(video_process_id != -1) { - int status; - if(wait_program_non_blocking(video_process_id, &status)) { - fprintf(stderr, "The video player exited!, status: %d\n", status); + if(wait_program_non_blocking(video_process_id, &exit_status)) { + fprintf(stderr, "The video player exited!, status: %d\n", exit_status); close(ipc_socket); remove(ipc_server_path); video_process_id = -1; |