From 0925041caa31d64016f5bc86d236cbebf58b5895 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 4 Sep 2021 02:39:24 +0200 Subject: Add use_system_mpv_config to json config as well --- src/Config.cpp | 6 +++++- src/QuickMedia.cpp | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Config.cpp b/src/Config.cpp index 03be824..626dcf3 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -65,7 +65,7 @@ namespace QuickMedia { config_initialized = true; Path config_path = get_storage_dir().join("config.json"); Json::Value json_root; - if(!read_file_as_json(config_path, json_root)) + if(!read_file_as_json(config_path, json_root) || !json_root.isObject()) return; const Json::Value &search_json = json_root["search"]; @@ -120,6 +120,10 @@ namespace QuickMedia { if(use_system_fonts_json.isBool()) config.use_system_fonts = use_system_fonts_json.asBool(); + const Json::Value &use_system_mpv_config = json_root["use_system_mpv_config"]; + if(use_system_mpv_config.isBool()) + config.use_system_mpv_config = use_system_mpv_config.asBool(); + const Json::Value &theme_json = json_root["theme"]; if(theme_json.isString()) config.theme = theme_json.asString(); diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 361df25..fc9db2f 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -353,11 +353,10 @@ namespace QuickMedia { } static void usage() { - fprintf(stderr, "usage: quickmedia [plugin] [--no-video] [--use-system-mpv-config] [--dir ] [-e ] [youtube-url]\n"); + fprintf(stderr, "usage: quickmedia [plugin] [--no-video] [--dir ] [-e ] [youtube-url]\n"); fprintf(stderr, "OPTIONS:\n"); fprintf(stderr, " plugin The plugin to use. Should be either launcher, 4chan, manga, manganelo, manganelos, mangatown, mangakatana, mangadex, readm, onimanga, youtube, soundcloud, nyaa.si, matrix, saucenao, hotexamples, anilist, file-manager, stdin, pornhub, spankbang, xvideos or xhamster\n"); fprintf(stderr, " --no-video Only play audio when playing a video. Disabled by default\n"); - fprintf(stderr, " --use-system-mpv-config Use system mpv config instead of no config. Disabled by default\n"); fprintf(stderr, " --upscale-images Upscale low-resolution manga pages using waifu2x-ncnn-vulkan. Disabled by default\n"); fprintf(stderr, " --upscale-images-always Upscale manga pages using waifu2x-ncnn-vulkan, no matter what the original image resolution is. Disabled by default\n"); fprintf(stderr, " --dir Set the start directory when using file-manager. Default is the the users home directory\n"); @@ -419,8 +418,6 @@ namespace QuickMedia { if(strcmp(argv[i], "--no-video") == 0) { force_no_video = true; - } else if(strcmp(argv[i], "--use-system-mpv-config") == 0) { - use_system_mpv_config = true; } else if(strcmp(argv[i], "--upscale-images") == 0) { upscale_image_action = UpscaleImageAction::LOW_RESOLUTION; } else if(strcmp(argv[i], "--upscale-images-force") == 0 || strcmp(argv[i], "--upscale-images-always") == 0) { @@ -2963,7 +2960,7 @@ namespace QuickMedia { } } - video_player = std::make_unique(is_audio_only, use_system_mpv_config, is_matrix && !is_youtube, video_event_callback, on_window_create, resources_root, largest_monitor_height, plugin_name); + video_player = std::make_unique(is_audio_only, get_config().use_system_mpv_config, is_matrix && !is_youtube, video_event_callback, on_window_create, resources_root, largest_monitor_height, plugin_name); VideoPlayer::Error err = video_player->load_video(v.c_str(), a.c_str(), window.getSystemHandle(), use_youtube_dl, video_title, start_time, media_chapters); if(err != VideoPlayer::Error::OK) { std::string err_msg = "Failed to play url: "; -- cgit v1.2.3