diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-02-02 00:54:47 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-02-02 00:54:47 +0100 |
commit | 5195c84ee9758b29cf1db696e06140e9a9a5284d (patch) | |
tree | 3490984a87b1752907040879f61d738038ce2405 /src | |
parent | cf83bf2fea7efd0d7239dc021741fb88eb76ea8b (diff) |
Fix crash when launching for first time, fix for new mpv version
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 13 | ||||
-rw-r--r-- | src/VideoPlayer.cpp | 10 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 349cc28..0c17a52 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -374,8 +374,13 @@ namespace QuickMedia { // TOOD: Make generic, instead of checking for plugin if(current_plugin->name == "manganelo") { + Path content_storage_dir = get_storage_dir().join("manga"); + if(create_directory_recursive(content_storage_dir) != 0) { + show_notification("Storage", "Failed to create directory: " + content_storage_dir.data, Urgency::CRITICAL); + exit(1); + } // TODO: Make asynchronous - for_files_in_dir(get_storage_dir().join("manga"), [&history_body](const std::filesystem::path &filepath) { + for_files_in_dir(content_storage_dir, [&history_body](const std::filesystem::path &filepath) { Path fullpath(filepath.c_str()); Json::Value body; if(!read_file_as_json(fullpath, body)) { @@ -419,10 +424,6 @@ namespace QuickMedia { } Path content_storage_dir = get_storage_dir().join("manga"); - if(create_directory_recursive(content_storage_dir) != 0) { - show_notification("Storage", "Failed to create directory: " + content_storage_dir.data, Urgency::CRITICAL); - return false; - } std::string manga_id; if(!manga_extract_id_from_url(content_url, manga_id)) @@ -1877,4 +1878,4 @@ namespace QuickMedia { // so you dont have to retype a post that was in the middle of being posted when returning. search_bar->clear(); } -}
\ No newline at end of file +} diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index dfe6603..165e6e7 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -67,14 +67,20 @@ namespace QuickMedia { std::vector<const char*> args; if(use_tor) args.push_back("torsocks"); - args.insert(args.end(), { "mpv", "--keep-open=yes", /*"--keep-open-pause=no",*/ "--input-ipc-server", ipc_server_path, + + std::string input_ipc_server_arg = "--input-ipc-server="; + input_ipc_server_arg += ipc_server_path; + std::string wid_arg = "--wid="; + wid_arg += parent_window_str; + + args.insert(args.end(), { "mpv", "--keep-open=yes", /*"--keep-open-pause=no",*/ input_ipc_server_arg.c_str(), "--no-config", "--no-input-default-bindings", "--input-vo-keyboard=no", "--no-input-cursor", "--cache-secs=120", "--demuxer-max-bytes=40M", "--demuxer-max-back-bytes=20M", "--no-input-terminal", "--no-osc", "--profile=gpu-hq", /*"--vo=gpu", "--hwdec=auto",*/ - "--wid", parent_window_str.c_str(), "--", path, nullptr }); + wid_arg.c_str(), "--", path, nullptr }); if(exec_program_async(args.data(), &video_process_id) != 0) return Error::FAIL_TO_LAUNCH_PROCESS; |