aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--TODO5
-rw-r--r--include/QuickMedia.hpp1
-rw-r--r--include/VideoPlayer.hpp3
-rw-r--r--launcher/QuickMedia-youtube-audio.desktop9
-rw-r--r--src/QuickMedia.cpp7
-rw-r--r--src/VideoPlayer.cpp6
-rw-r--r--src/plugins/Matrix.cpp4
8 files changed, 29 insertions, 7 deletions
diff --git a/README.md b/README.md
index fd0ece8..def2b6c 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ Cache is stored under `$HOME/.cache/quickmedia`.
usage: QuickMedia <plugin> [--tor] [--use-system-mpv-config] [--dir <directory>] [-p <placeholder-text>]
OPTIONS:
plugin The plugin to use. Should be either 4chan, manganelo, mangatown, mangadex, youtube, nyaa.si, matrix, file-manager or dmenu
+ --no-video Only play audio when playing a video. Disabled by default
--tor Use tor. 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
diff --git a/TODO b/TODO
index 8eb3412..969ce1b 100644
--- a/TODO
+++ b/TODO
@@ -79,4 +79,7 @@ Add /me to matrix, emoji, reactions...
Set the icon of the window to be the icon of the plugin. Nice for KDE, GNOME, etc with titlebars.
Set a minimum wrap size for text. We dont want one line of text to fully fill the window vertically when the window size width is small. Its better to cut off the text and add eclipses.
Get the related message and show that (async) instead of what the reply says the original text is in body, for matrix replies.
-Support matrix html (for replies and text styling, such as greentext). \ No newline at end of file
+Support matrix html (for replies and text styling, such as greentext).
+Show deleted messages in matrix as MESSAGE DELETED or whatever.
+Use linear-interpolation for thumbnail creation.
+If --no-audio is used then music should be played with a lightweight music player instead. MPV is heavy even for music (60mb RAM). \ No newline at end of file
diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp
index 03bfcb9..155adc7 100644
--- a/include/QuickMedia.hpp
+++ b/include/QuickMedia.hpp
@@ -117,6 +117,7 @@ namespace QuickMedia {
int exit_code = 0;
std::string resources_root;
bool use_tor = false;
+ bool no_video = false;
bool use_system_mpv_config = false;
bool upscale_images = false;
bool running = false;
diff --git a/include/VideoPlayer.hpp b/include/VideoPlayer.hpp
index e4a5610..86410da 100644
--- a/include/VideoPlayer.hpp
+++ b/include/VideoPlayer.hpp
@@ -36,7 +36,7 @@ namespace QuickMedia {
};
// @event_callback is called from another thread
- VideoPlayer(bool use_tor, bool use_system_mpv_config, EventCallbackFunc event_callback, VideoPlayerWindowCreateCallback window_create_callback, const std::string &resource_root);
+ VideoPlayer(bool use_tor, bool no_video, bool use_system_mpv_config, EventCallbackFunc event_callback, VideoPlayerWindowCreateCallback window_create_callback, const std::string &resource_root);
~VideoPlayer();
VideoPlayer(const VideoPlayer&) = delete;
VideoPlayer& operator=(const VideoPlayer&) = delete;
@@ -71,6 +71,7 @@ namespace QuickMedia {
VideoPlayer::Error read_ipc_func();
private:
bool use_tor;
+ bool no_video;
bool use_system_mpv_config;
pid_t video_process_id;
int ipc_socket;
diff --git a/launcher/QuickMedia-youtube-audio.desktop b/launcher/QuickMedia-youtube-audio.desktop
new file mode 100644
index 0000000..0e2ea7c
--- /dev/null
+++ b/launcher/QuickMedia-youtube-audio.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Name=QuickMedia YouTube Music
+GenericName=YouTube music player
+Comment=YouTube search and audio playing
+Icon=/usr/share/quickmedia/icons/yt_launcher.png
+Exec=QuickMedia youtube --no-video
+Terminal=false
+Keywords=youtube;player;quickmedia;mpv;audio;music;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 29b2db9..bd9b091 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -280,9 +280,10 @@ namespace QuickMedia {
}
static void usage() {
- fprintf(stderr, "usage: QuickMedia <plugin> [--tor] [--use-system-mpv-config] [--dir <directory>] [-p <placeholder-text>]\n");
+ fprintf(stderr, "usage: QuickMedia <plugin> [--tor] [--no-video] [--use-system-mpv-config] [--dir <directory>] [-p <placeholder-text>]\n");
fprintf(stderr, "OPTIONS:\n");
fprintf(stderr, " plugin The plugin to use. Should be either 4chan, manganelo, mangatown, mangadex, pornhub, youtube, nyaa.si, matrix, file-manager or dmenu\n");
+ fprintf(stderr, " --no-video Only play audio when playing a video. Disabled by default\n");
fprintf(stderr, " --tor Use tor. 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");
@@ -363,6 +364,8 @@ namespace QuickMedia {
if(strcmp(argv[i], "--tor") == 0) {
use_tor = true;
+ } else if(strcmp(argv[i], "--no-video") == 0) {
+ 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) {
@@ -1583,7 +1586,7 @@ namespace QuickMedia {
}
};
- video_player = std::make_unique<VideoPlayer>(current_plugin->use_tor, use_system_mpv_config, video_event_callback, on_window_create, resources_root);
+ video_player = std::make_unique<VideoPlayer>(use_tor, no_video, use_system_mpv_config, video_event_callback, on_window_create, resources_root);
load_video_error_check();
sf::Event event;
diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp
index 0b173dd..a79ffd7 100644
--- a/src/VideoPlayer.cpp
+++ b/src/VideoPlayer.cpp
@@ -18,9 +18,10 @@ const int MAX_RETRIES_CONNECT = 20;
const int READ_TIMEOUT_MS = 200;
namespace QuickMedia {
- VideoPlayer::VideoPlayer(bool use_tor, bool use_system_mpv_config, EventCallbackFunc _event_callback, VideoPlayerWindowCreateCallback _window_create_callback, const std::string &resource_root) :
+ VideoPlayer::VideoPlayer(bool use_tor, bool no_video, bool use_system_mpv_config, EventCallbackFunc _event_callback, VideoPlayerWindowCreateCallback _window_create_callback, const std::string &resource_root) :
exit_status(0),
use_tor(use_tor),
+ no_video(no_video),
use_system_mpv_config(use_system_mpv_config),
video_process_id(-1),
ipc_socket(-1),
@@ -113,6 +114,9 @@ namespace QuickMedia {
}
*/
+ if(no_video)
+ args.push_back("--no-video");
+
args.insert(args.end(), { "--", path, nullptr });
if(exec_program_async(args.data(), &video_process_id) != 0)
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index b8f3742..9ba1b6b 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -905,7 +905,7 @@ namespace QuickMedia {
}
static std::string block_quote(const std::string &str) {
- std::string result = "> ";
+ std::string result;
for(char c : str) {
if(c == '>') {
result += "\\>";
@@ -941,7 +941,7 @@ namespace QuickMedia {
related_to_body = "sent a file";
break;
}
- return block_quote("<" + room_data->user_info[message->user_id].user_id + "> " + std::move(related_to_body)) + "\n\n" + body;
+ return "> <" + room_data->user_info[message->user_id].user_id + "> " + block_quote(std::move(related_to_body)) + "\n\n" + body;
}
// TODO: Add formatted_body just like element does with <mx-reply><blockquote... and also support greentext with that