aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp81
1 files changed, 6 insertions, 75 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 49bfd36..4242fa1 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -40,7 +40,6 @@
#include "../include/Storage.hpp"
#include "../include/AsyncImageLoader.hpp"
#include <mglpp/system/FloatRect.hpp>
-#include "../plugins/youtube/YoutubeMediaProxy.hpp"
#include "../include/gui/Button.hpp"
#include "../external/hash-library/sha256.h"
@@ -3090,9 +3089,6 @@ namespace QuickMedia {
update_window_focus = true;
};
- std::unique_ptr<YoutubeMediaProxy> youtube_video_media_proxy;
- std::unique_ptr<YoutubeMediaProxy> youtube_audio_media_proxy;
- AsyncTask<void> youtube_downloader_task;
int64_t youtube_video_content_length = 0;
int64_t youtube_audio_content_length = 0;
@@ -3211,65 +3207,10 @@ namespace QuickMedia {
std::string v = video_url;
std::string a = audio_url;
if(is_youtube) {
- if(youtube_video_media_proxy)
- youtube_video_media_proxy->stop();
-
- if(youtube_audio_media_proxy)
- youtube_audio_media_proxy->stop();
-
- youtube_downloader_task.cancel();
- youtube_video_media_proxy.reset();
- youtube_audio_media_proxy.reset();
-
- struct MediaProxyMetadata {
- std::unique_ptr<YoutubeMediaProxy> *media_proxy;
- std::string *url;
- int64_t content_length;
- };
-
- MediaProxyMetadata media_proxies[2] = {
- { &youtube_video_media_proxy, &v, youtube_video_content_length },
- { &youtube_audio_media_proxy, &a, youtube_audio_content_length }
- };
- int num_proxied_media = 0;
- for(int i = 0; i < 2; ++i) {
- if(media_proxies[i].url->empty() || youtube_url_is_live_stream(*media_proxies[i].url))
- continue;
-
- *media_proxies[i].media_proxy = std::make_unique<YoutubeStaticMediaProxy>();
- if(!(*media_proxies[i].media_proxy)->start(*media_proxies[i].url, media_proxies[i].content_length)) {
- show_notification("QuickMedia", "Failed to load start youtube media proxy", Urgency::CRITICAL);
- current_page = previous_page;
- go_to_previous_page = true;
- return;
- }
-
- std::string media_proxy_addr;
- if(!(*media_proxies[i].media_proxy)->get_address(media_proxy_addr)) {
- show_notification("QuickMedia", "Failed to load start youtube media proxy", Urgency::CRITICAL);
- current_page = previous_page;
- go_to_previous_page = true;
- return;
- }
-
- *media_proxies[i].url = std::move(media_proxy_addr);
- ++num_proxied_media;
- }
-
- if(num_proxied_media > 0) {
- youtube_downloader_task = AsyncTask<void>([&youtube_video_media_proxy, &youtube_audio_media_proxy]() {
- // TODO: Poll instead of sleep
- while(!program_is_dead_in_current_thread()) {
- if(youtube_video_media_proxy)
- youtube_video_media_proxy->update();
-
- if(youtube_audio_media_proxy)
- youtube_audio_media_proxy->update();
-
- usleep(1000);
- }
- });
- }
+ if(!v.empty() && !youtube_url_is_live_stream(v))
+ v = "qm-yt://" + v;
+ if(!a.empty() && !youtube_url_is_live_stream(a))
+ a = "qm-yt://" + a;
}
VideoPlayer::StartupArgs startup_args;
@@ -3499,16 +3440,6 @@ namespace QuickMedia {
video_player->get_time_in_file(&resume_start_time);
video_player.reset();
page_changed = true;
-
- if(youtube_video_media_proxy)
- youtube_video_media_proxy->stop();
-
- if(youtube_audio_media_proxy)
- youtube_audio_media_proxy->stop();
-
- youtube_downloader_task.cancel();
- youtube_video_media_proxy.reset();
- youtube_audio_media_proxy.reset();
}
});
@@ -3866,7 +3797,7 @@ namespace QuickMedia {
return true;
}
} else {
- size_t file_size = 0;
+ int64_t file_size = 0;
if(download_to_file(url, image_filepath_tmp.data, extra_args, true, cloudflare_bypass) != DownloadResult::OK || (is_manganelo && file_get_size(image_filepath_tmp, &file_size) == 0 && file_size < 255)) {
if(!image_download_cancel) show_notification("QuickMedia", "Failed to download image: " + url, Urgency::CRITICAL);
return true;
@@ -7763,7 +7694,7 @@ namespace QuickMedia {
}
const float progress_diff = progress - ui_progress;
- const float progress_move = frame_timer.get_elapsed_time_seconds() * 500.0f * std::abs(progress_diff);
+ const float progress_move = frame_timer.get_elapsed_time_seconds() * 2500.0f * std::abs(progress_diff);
if(std::abs(progress_diff) < progress_move) {
ui_progress = progress;
} else {