diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | example-config.json | 1 | ||||
-rw-r--r-- | include/Config.hpp | 1 | ||||
-rw-r--r-- | include/QuickMedia.hpp | 1 | ||||
-rw-r--r-- | src/Config.cpp | 6 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 7 |
6 files changed, 10 insertions, 9 deletions
@@ -5,11 +5,10 @@ Config data, including manga progress is stored under `$XDG_CONFIG_HOME/quickmed Cache is stored under `$XDG_CACHE_HOME/quickmedia` or `$HOME/.cache/quickmedia`. ## Usage ``` -usage: quickmedia [plugin] [--use-system-mpv-config] [--dir <directory>] [-e <window>] [youtube-url] +usage: quickmedia [plugin] [--dir <directory>] [-e <window>] [youtube-url] OPTIONS: 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 or stdin --no-video Only play audio when playing a video. Disabled by default - --use-system-mpv-config Use system mpv config instead of no config. Disabled by default --upscale-images Upscale low-resolution manga pages using waifu2x-ncnn-vulkan. Disabled by default --upscale-images-always Upscale manga pages using waifu2x-ncnn-vulkan, no matter what the original image resolution is. Disabled by default --dir <directory> Set the start directory when using file-manager diff --git a/example-config.json b/example-config.json index 6eb294f..4f14a2c 100644 --- a/example-config.json +++ b/example-config.json @@ -19,6 +19,7 @@ "font_size": 16 }, "use_system_fonts": false, + "use_system_mpv_config": false, "theme": "default", "scale": 1.0, "font_scale": 1.0 diff --git a/include/Config.hpp b/include/Config.hpp index 0cdabe9..5e0218b 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -36,6 +36,7 @@ namespace QuickMedia { BodyConfig body; InputConfig input; bool use_system_fonts = false; + bool use_system_mpv_config = false; std::string theme = "default"; float scale = 1.0f; float font_scale = 1.0f; diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index dd54572..86a2993 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -186,7 +186,6 @@ namespace QuickMedia { sf::Shader rounded_rectangle_mask_shader; bool no_video = false; bool force_no_video = false; - bool use_system_mpv_config = false; UpscaleImageAction upscale_image_action = UpscaleImageAction::NO; // TODO: Save this to config file when switching modes ImageViewMode image_view_mode = ImageViewMode::SINGLE; 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 <directory>] [-e <window>] [youtube-url]\n"); + fprintf(stderr, "usage: quickmedia [plugin] [--no-video] [--dir <directory>] [-e <window>] [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 <directory> 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<VideoPlayer>(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<VideoPlayer>(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: "; |