From 5996f45fbbca1fce882820984708a104d2b05d41 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 13 Nov 2021 17:53:54 +0100 Subject: Soundcloud: display music title in mpv --- TODO | 4 ++-- plugins/Soundcloud.hpp | 4 +++- src/plugins/Soundcloud.cpp | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 984d467..e2dc677 100644 --- a/TODO +++ b/TODO @@ -205,5 +205,5 @@ Limit text input length for 4chan posts to the server limit. Allow creating a new thread on 4chan. Add flag to quickmedia to use svp, by making svp use the same input ipc socket as quickmedia (and load the svp script manually). Support directly going to a youtube channel for a url. This is helpful for opening channel urls directly with quickmedia and also going to another channel from a youtube description. -Support downloading soundcloud/youtube playlists. -Support downloading .m3u8 files, such as soundcloud music without using youtube-dl. \ No newline at end of file +Support downloading soundcloud/youtube playlists. Such downloads should also have a different download gui as you would select a folder instead of an output file. +Support downloading .m3u8 files, such as soundcloud music without using youtube-dl. diff --git a/plugins/Soundcloud.hpp b/plugins/Soundcloud.hpp index 6f96481..5850fab 100644 --- a/plugins/Soundcloud.hpp +++ b/plugins/Soundcloud.hpp @@ -58,13 +58,15 @@ namespace QuickMedia { class SoundcloudAudioPage : public VideoPage { public: - SoundcloudAudioPage(Program *program, const std::string &url, std::string permalink_url) : VideoPage(program, url), permalink_url(std::move(permalink_url)) {} + SoundcloudAudioPage(Program *program, std::string title, const std::string &url, std::string permalink_url) : VideoPage(program, url), title(std::move(title)), permalink_url(std::move(permalink_url)) {} const char* get_title() const override { return ""; } + PluginResult load(std::string &title, std::string &channel_url, std::vector &chapters, std::string &err_str) override; bool autoplay_next_item() override { return true; } std::string url_get_playable_url(const std::string &url) override; std::string get_download_url(int max_height) override; bool video_should_be_skipped(const std::string &url) override { return url == "track" || url.find("/stream/users/") != std::string::npos; } private: + std::string title; // TODO: Remove when youtube-dl is no longer required to download music std::string permalink_url; }; diff --git a/src/plugins/Soundcloud.cpp b/src/plugins/Soundcloud.cpp index 676db3a..fa37e29 100644 --- a/src/plugins/Soundcloud.cpp +++ b/src/plugins/Soundcloud.cpp @@ -280,7 +280,7 @@ namespace QuickMedia { if(track) permalink_url = track->permalink_url; - result_tabs.push_back(Tab{nullptr, std::make_unique(program, url_json.asString(), std::move(permalink_url)), nullptr}); + result_tabs.push_back(Tab{nullptr, std::make_unique(program, title, url_json.asString(), std::move(permalink_url)), nullptr}); } return PluginResult::OK; @@ -469,6 +469,11 @@ namespace QuickMedia { return PluginResult::OK; } + PluginResult SoundcloudAudioPage::load(std::string &title, std::string&, std::vector&, std::string&) { + title = this->title; + return PluginResult::OK; + } + std::string SoundcloudAudioPage::url_get_playable_url(const std::string &url) { std::string query_url = url + "?client_id=" + client_id; -- cgit v1.2.3