From 08d6c26b6fc06bd7fc80bc168131998f95c12551 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 18 Feb 2022 17:46:28 +0100 Subject: Fix video thumbnail creation --- README.md | 6 ++++-- src/FileAnalyzer.cpp | 6 +++--- src/VideoPlayer.cpp | 2 ++ src/plugins/LocalAnime.cpp | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4baf18b..5a38637 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,8 @@ Manga 2 1.png 2.png ``` -Note that the manga name and chapter names can be anything you want, but the image names need to be a number (with `.jpg`, `.jpeg`, or `.png` extension). +Note that the manga name and chapter names can be anything you want, but the image names need to be a number (with `.jpg`, `.jpeg`, or `.png` extension).\ +It's ok to use the same directory for local manga and local anime. ## Local anime `local_anime.directory` needs to be set in `~/.config/quickmedia/config.json` to a directory with all your anime.\ The directory layout is expected to be like this: @@ -207,7 +208,8 @@ Anime 3 Episode 2.mkv ``` Note that the episode names can be anything you want.\ -Local anime always uses your system mpv config. +Local anime always uses your system mpv config.\ +It's ok to use the same directory for local manga and local anime. ## Environment variables If `xdg-open` is not installed then the `BROWSER` environment variable is used to open links in a browser.\ Set `QM_PHONE_FACTOR=1` to disable the room list side panel in matrix. diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp index 4e4470e..2ce8250 100644 --- a/src/FileAnalyzer.cpp +++ b/src/FileAnalyzer.cpp @@ -129,7 +129,7 @@ namespace QuickMedia { bool video_get_first_frame(const FileAnalyzer &file, const char *destination_path, int width, int height) { Path destination_path_tmp = destination_path; - destination_path_tmp.append(".ftmp"); + destination_path_tmp.append(".tmp.jpg"); const int middle_seconds = file.get_duration_seconds().value_or(0.0) / 2.0; char middle_seconds_str[32]; @@ -139,13 +139,13 @@ namespace QuickMedia { char framesize[128]; snprintf(framesize, sizeof(framesize), "%dx%d", width, height); - const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "-f", "singlejpeg", "-s", framesize, "--", destination_path_tmp.data.c_str(), nullptr }; + const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "-s", framesize, "--", destination_path_tmp.data.c_str(), nullptr }; if(exec_program(program_args, nullptr, nullptr) != 0) { fprintf(stderr, "Failed to execute ffmpeg, maybe its not installed?\n"); return false; } } else { - const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "-f", "singlejpeg", "--", destination_path_tmp.data.c_str(), nullptr }; + const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "--", destination_path_tmp.data.c_str(), nullptr }; if(exec_program(program_args, nullptr, nullptr) != 0) { fprintf(stderr, "Failed to execute ffmpeg, maybe its not installed?\n"); return false; diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 8fdf9dc..3e336fb 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -234,9 +234,11 @@ namespace QuickMedia { if(startup_args.use_system_mpv_config) { args.push_back("--config=yes"); + args.push_back("--load-scripts=yes"); } else { args.insert(args.end(), { "--config=no", + "--load-scripts=no", "--profile=gpu-hq", "--vo=gpu,vdpau,x11", "--hwdec=auto" diff --git a/src/plugins/LocalAnime.cpp b/src/plugins/LocalAnime.cpp index b78772d..318058b 100644 --- a/src/plugins/LocalAnime.cpp +++ b/src/plugins/LocalAnime.cpp @@ -30,13 +30,13 @@ namespace QuickMedia { mgl::Rectangle watch_rect; watch_rect.set_position({ widgets.thumbnail->position.x, widgets.thumbnail->position.y + widgets.thumbnail->size.y - rect_height }); watch_rect.set_size({ floor(widgets.thumbnail->size.x * watch_ratio), rect_height }); - watch_rect.set_color(mgl::Color(255, 0, 0, 255)); + watch_rect.set_color(mgl::Color(150, 0, 0, 255)); render_target.draw(watch_rect); mgl::Rectangle unwatch_rect; unwatch_rect.set_position({ floor(widgets.thumbnail->position.x + widgets.thumbnail->size.x * watch_ratio), widgets.thumbnail->position.y + widgets.thumbnail->size.y - rect_height }); unwatch_rect.set_size({ floor(widgets.thumbnail->size.x * (1.0 - watch_ratio)), rect_height }); - unwatch_rect.set_color(mgl::Color(255, 255, 255, 255)); + unwatch_rect.set_color(mgl::Color(150, 150, 150, 255)); render_target.draw(unwatch_rect); } -- cgit v1.2.3