From 8fc6edc4033c04de3cdc6a400976a019a35694b7 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 26 Mar 2021 17:33:33 +0100 Subject: Soundcloud: autoplay next song in list --- src/plugins/Soundcloud.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/Soundcloud.cpp b/src/plugins/Soundcloud.cpp index cfb6011..37538ed 100644 --- a/src/plugins/Soundcloud.cpp +++ b/src/plugins/Soundcloud.cpp @@ -284,4 +284,21 @@ namespace QuickMedia { if(result != DownloadResult::OK) return download_result_to_plugin_result(result); return parse_user_page(json_root, result_items, next_href); } + + std::string SoundcloudAudioPage::url_get_playable_url(const std::string &url) { + std::string query_url = url + "?client_id=" + client_id; + + Json::Value json_root; + DownloadResult result = download_json(json_root, query_url, {}, true); + if(result != DownloadResult::OK) return url; + + if(!json_root.isObject()) + return url; + + const Json::Value &url_json = json_root["url"]; + if(!url_json.isString()) + return url; + + return url_json.asString(); + } } \ No newline at end of file -- cgit v1.2.3