aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-30 20:22:56 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-30 20:23:00 +0200
commitfa1611f96ba4e56f4d8cc362a192bdd29351f51f (patch)
tree0eafea55a6d9ef55c9ca018e8821af8c8da60de2
parent664835fcee5f0dc1fa5aba63c845c4561628a20f (diff)
fix readlink in download_async_gui
-rw-r--r--TODO5
-rw-r--r--src/DownloadUtils.cpp11
-rw-r--r--src/QuickMedia.cpp4
3 files changed, 11 insertions, 9 deletions
diff --git a/TODO b/TODO
index cd2c1b6..075bf1e 100644
--- a/TODO
+++ b/TODO
@@ -144,4 +144,7 @@ Ctrl+R for youtube should have a page for the video title, description, views, u
Add a keybinding for going to the front page of the plugin. This would be especially useful for youtube and manga, where you have history, subscriptions and recommendations.
Reaching end of download menu filename entry should scroll the entry vertically instead of putting the text on multiple lines.
Ctrl+S saving a video should copy the video from cache if the video was downloaded to cache, instead of downloading it again.
-When synapse adds support for media download http request range then quickmedia should download the last 4096 bytes of mp4 files and move the moov atom and co64 atoms (and others) to the front of the file before mdat, similar to how qt-faststart does it. This is needed for video streaming certain mp4 files. \ No newline at end of file
+When synapse adds support for media download http request range then quickmedia should download the last 4096 bytes of mp4 files and move the moov atom and co64 atoms (and others) to the front of the file before mdat, similar to how qt-faststart does it. This is needed for video streaming certain mp4 files.
+Ctrl+S when a body item is selected on youtube/xxxplugins should show an option to download the video, instead of having to press ctrl+s after the video is playing.
+Show a subscribe button for channels, which should be red and say "subscribe" if we are not subscribed and it should be gray and say "unsubscribe" if we already are subscribed.
+Display youtube playlists differently and support downloading the whole playlist at once. \ No newline at end of file
diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp
index 9834390..774fba9 100644
--- a/src/DownloadUtils.cpp
+++ b/src/DownloadUtils.cpp
@@ -214,11 +214,12 @@ namespace QuickMedia {
}
bool download_async_gui(const std::string &url, const std::string &file_manager_start_dir, bool use_youtube_dl, bool no_video) {
- // TODO: Fix this not working when installed to /usr/bin/quickmedia for some reason
- //char quickmedia_path[PATH_MAX];
- //if(readlink("/proc/self/exe", quickmedia_path, sizeof(quickmedia_path)) == -1)
- // strcpy(quickmedia_path, "quickmedia");
- const char *quickmedia_path = "quickmedia";
+ char quickmedia_path[PATH_MAX];
+ ssize_t bytes_written = readlink("/proc/self/exe", quickmedia_path, sizeof(quickmedia_path));
+ if(bytes_written == -1 || bytes_written == sizeof(quickmedia_path))
+ strcpy(quickmedia_path, "quickmedia");
+ else
+ quickmedia_path[bytes_written] = '\0';
std::vector<const char*> args = { quickmedia_path, "download", "-u", url.c_str(), "--dir", file_manager_start_dir.c_str() };
if(use_youtube_dl) args.push_back("--youtube-dl");
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 595ae7b..5bbad84 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1889,9 +1889,7 @@ namespace QuickMedia {
BodyItem *selected_item = tabs[selected_tab].body->get_selected();
if(selected_item && tabs[selected_tab].page->is_trackable()) {
TrackablePage *trackable_page = dynamic_cast<TrackablePage*>(tabs[selected_tab].page.get());
- run_task_with_loading_screen([trackable_page, selected_item](){
- return trackable_page->track(selected_item->get_title()) == TrackResult::OK;
- });
+ trackable_page->track(selected_item->get_title());
}
} else if(event.key.code == sf::Keyboard::C && event.key.control) {
BodyItem *selected_item = tabs[selected_tab].body->get_selected();