aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-10-29 21:33:18 +0200
committerdec05eba <dec05eba@protonmail.com>2022-10-29 21:35:41 +0200
commit9c1d43e772efb8f5af4b7ef5562fb433c8985697 (patch)
treef675a51ab4f9ffad88d934216db6d44bafc187ad /src/QuickMedia.cpp
parent555f0e7e910b2231073734816727379e1276aa6c (diff)
Youtube: allow opening youtube channels directly from url. Same with ctrl+i info menu
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 13931d2..69ac66e 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -318,7 +318,7 @@ namespace QuickMedia {
}
static void usage() {
- fprintf(stderr, "usage: quickmedia [plugin] [--no-video] [--dir <directory>] [-e <window>] [youtube-url]\n");
+ fprintf(stderr, "usage: quickmedia [plugin] [--no-video] [--upscale-images] [--upscale-images-always] [--dir <directory>] [--instance <instance>] [-e <window>] [--video-max-height <height>] [youtube-url] [youtube-channel-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, local-manga, local-anime, youtube, peertube, lbry, soundcloud, nyaa.si, matrix, saucenao, hotexamples, anilist, dramacool, file-manager, stdin, pornhub, spankbang, xvideos or xhamster\n");
fprintf(stderr, " --no-video Only play audio when playing a video. Disabled by default\n");
@@ -387,11 +387,17 @@ namespace QuickMedia {
for(int i = 1; i < argc; ++i) {
if(!plugin_name) {
- std::string youtube_video_id_dummy;
std::string youtube_url_converted = invidious_url_to_youtube_url(argv[i]);
- if(youtube_url_extract_id(youtube_url_converted, youtube_video_id_dummy)) {
+ std::string youtube_channel_id;
+ std::string youtube_video_id_dummy;
+
+ if(youtube_url_extract_channel_id(youtube_url_converted, youtube_channel_id, youtube_channel_url)) {
+ plugin_name = "youtube";
+ continue;
+ } else if(youtube_url_extract_id(youtube_url_converted, youtube_video_id_dummy)) {
youtube_url = std::move(youtube_url_converted);
plugin_name = "youtube";
+ continue;
}
for(const auto &valid_plugin : valid_plugins) {
@@ -1308,7 +1314,14 @@ namespace QuickMedia {
pipe_body->set_items(std::move(body_items));
tabs.push_back(Tab{std::move(pipe_body), std::make_unique<PipePage>(this), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
} else if(strcmp(plugin_name, "youtube") == 0) {
- if(youtube_url.empty()) {
+ if(!youtube_channel_url.empty()) {
+ auto youtube_channel_page = std::make_unique<YoutubeChannelPage>(this, youtube_channel_url, "", "Channel videos");
+ tabs.push_back(Tab{create_body(false, true), std::move(youtube_channel_page), create_search_bar("Search...", 350)});
+ } else if(!youtube_url.empty()) {
+ current_page = PageType::VIDEO_CONTENT;
+ auto youtube_video_page = std::make_unique<YoutubeVideoPage>(this, youtube_url, false);
+ video_content_page(nullptr, youtube_video_page.get(), "", false, nullptr, 0);
+ } else {
start_tab_index = 1;
tabs.push_back(Tab{create_body(false, true), std::make_unique<YoutubeSubscriptionsPage>(this), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
tabs.push_back(Tab{create_body(false, true), std::make_unique<YoutubeSearchPage>(this), create_search_bar("Search...", 100)});
@@ -1316,10 +1329,6 @@ namespace QuickMedia {
auto history_body = create_body(false, true);
auto history_page = std::make_unique<HistoryPage>(this, tabs.front().page.get(), HistoryType::YOUTUBE);
tabs.push_back(Tab{std::move(history_body), std::move(history_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
- } else {
- current_page = PageType::VIDEO_CONTENT;
- auto youtube_video_page = std::make_unique<YoutubeVideoPage>(this, youtube_url, false);
- video_content_page(nullptr, youtube_video_page.get(), "", false, nullptr, 0);
}
} else if(strcmp(plugin_name, "peertube") == 0) {
if(instance.empty()) {