Commit Graph

184 Commits

Author SHA1 Message Date
auouymous 375a94a139 Fix typos found by codespell. 2023-07-19 02:30:44 -06:00
luzpaz 8a995cb097 Fix various typos
Found via `codespell -q 3 -S *.po -L bloc,extracter,parms`
2023-07-14 12:13:50 +00:00
auouymous f64440867d Don't display stacktrace for common download errors. 2023-01-25 16:44:06 -07:00
auouymous d2f34d0d87 Disable background operations while progress dialogs are open.
Changing task state causes UI to hang while DownloadQueueManager spawns
threads and updates progress tab. And the update_downloads_list() timer
can hang UI for several seconds at a time when thousands of tasks are
queued.

Disabling both of these while a progress dialog is open allows tasks to
be queued faster and the dialog closed sooner.
2023-01-03 06:01:15 -07:00
auouymous 84c35c76fd max_downloads -> limit.downloads.concurrent 2022-12-08 14:49:33 -07:00
auouymous 04cb6583da max_downloads_enabled -> limit.downloads.enabled 2022-12-08 14:47:03 -07:00
auouymous 8eb60b8ccf limit_rate -> limit.bandwidth.enabled 2022-12-08 14:45:24 -07:00
auouymous 39f0376c81 limit_rate_value -> limit.bandwidth.kbps 2022-12-08 14:41:32 -07:00
Teemu Ikonen 6bd0bb0530 Remove unused imports and pass statements
Fixes flake8 error F401.
Most errors were fixed by running

autoflake -i -r --remove-all-unused-imports .

which also removes unnecessary 'pass' statements, some by hand-editing.
2022-11-14 18:32:09 +02:00
Teemu Ikonen 9690b13a3a Get preview file name from CustomDownload.partial_filename
Add 'custom_downloader' member var to DownloadTask. Use it in
episode.get_playback_url() to get a preview file name.

Also add episode.can_preview() method and use it in ep.can_play().
2022-11-07 15:28:54 +02:00
Teemu Ikonen 7b051d245b Add 'partial_filename' property to DefaultDownload
Derive abstract classes CustomDownload and CustomDownloader from ABC
from the abc module. Decorate abstract methods with @abstractmethod.

Add abstract 'partial_filename' property to CustomDownload and make it
concrete in the derived DefaultDownload class. This property holds the
full path of the temporary file where the episode is being downloaded
or None, if the downloader does not use a previewable temporary file.
2022-11-07 15:28:54 +02:00
auouymous e2f8c64f1a Change "YoutubeDL" and "Youtubedl" to "youtube-dl". 2022-07-04 14:51:45 -06:00
auouymous 3c62528ec9 Wait for worker threads to finish before quitting.
Closing gpodder while tasks are downloading or pausing causes a hang and
must be killed from task manager or interrupted if launched from command
line. This was introduced in ed5d18e1b0
but only applicable when using python 3.10. The idle_add() callback is
no longer invoked to wake up the dequeue wait_for() condition, likely
due to the main thread terminating early, which didn't happen in older
python versions. Simply waiting for all worker threads to terminate
fixes the issue.

Fixes #1306.
2022-06-22 13:51:23 -06:00
JKAbrams 0a51542ab5
Add download retry without authentication if auth is set (#1300)
* Add download retry without authentification if auth is set
2022-06-16 15:37:30 -07:00
auouymous 3e827c771b Recycle forced download tasks when finished.
Using "Start download now" creates a forced task that wasn't recycled
when it finished. This prevented it from being deleted because
can_delete() returns False for tasks in the DONE state.
2022-05-13 20:27:21 -06:00
auouymous 41c312dd68 Change deprecated logger.warn() to logger.warning(). 2022-04-29 02:54:32 -06:00
auouymous 182abc575b Refactor play_or_download() progress tab action code.
Fixes an issue with the toolbar cancel button turning off and on when
entering the progress tab, even though it can't cancel anything until a
selection is made.

Properly cancels failed tasks manually removed from progress tab. Not
cancelling would leave the error icon and prevent downloading or
cancelling.

The download, pause and cancel actions in toolbar and Episodes
menu can now be used to control downloads in the progress tab. The
delete menu item in Episodes menu removes the download from list. This
also allows keyboard accelerators to be used, such as the Delete key
for removing tasks. Accelerators for cancel, and maybe download/pause,
should added in a future PR.

The progress tab context menu now has the same ordering as the other
menus.
2022-03-23 18:53:38 -06:00
auouymous 6731b63706 Allow failed downloads to be cancelled from episodes list.
This not only removes the failed download from the progress list, but
also removes the error icon from the episode list.
2022-03-15 19:51:45 -06:00
auouymous 6f0f623ead Add pausing and resuming from Episodes and context menus, and toolbar.
Queued and downloading episodes can now be paused from the episode list,
and the download button can then be used to resume the paused episode.

Fixes #1162.
2022-03-08 06:21:10 -07:00
auouymous f7497c617a Create partial file when reusing cancelled tasks.
The partial file for a cancelled task is deleted, but the task is not
removed from progress list while other tasks are downloading.
Downloading the cancelled episode again would reuse the existing task
without creating a new partial file. This prevented resuming the
download after restarting gPodder, and caused the youtube-dl extension
to fail if used to re-download it.
2022-02-08 03:57:22 -07:00
auouymous 9d72872c50 Clean up parial files created by cancelled YoutubeDL downloads.
YoutubeDL can append an extension to the partial file, creating
additional partial files. Adaptive formats create up to three more
partial files. Cancelling a download will leave behind these extra
partial files, and requires manual removal outside of gPodder.
2022-02-01 22:09:00 -07:00
auouymous db2aa385d0 Cancel failed task before streaming.
livestream to be streamed, after realizing it was a livestream. This
however caused the youtube-dl extension to fail when downloading DRM
content after gpodder failed to download it, because the partial file
was missing.

This removes that fix and properly cancels the failed task before
streaming to remove the partial file.

Fixes #1147.
2021-10-11 20:11:18 -06:00
auouymous 263c4ad9fe Actually delete partial file when cancelling.
Calling run() with CANCELLED state only returns without performing any
work. The CANCELLING state actually deletes the partial file and
recycles the task.
2021-10-11 19:53:00 -06:00
auouymous 6feb312936 Don't recycle failed or paused tasks. 2021-09-16 18:01:10 -06:00
Mark Weaver ed5d18e1b0 fixes #1152 and an odd corner case (#1155)
* #1152: fix re-ordering downloads list

* fix downloading a task that's already been removed from the download list

* fix download/delete/download of the same episode

* fix pausing/cancelling sync tasks; clean up partially synchronised files

* fix cancelling a failed download

* make failed/paused/cancelled mutually exclusive so the code has less paths (and hopefully is easier to follow)
2021-09-14 00:53:15 -07:00
blushingpenguin 8760b6d315 #1117, #1137: fix re-introduced race queuing tasks 2021-08-31 14:37:36 +01:00
blushingpenguin 68195acc00 #1117, #1137: fixes for pause/resume/cancelling download tasks 2021-08-30 15:45:20 +01:00
blushingpenguin 56291c0f6f #1111: fix download limit not being respected, add new tasks in the queued state so they render correctly in the ui 2021-07-31 08:23:23 +01:00
blushingpenguin b40f283499 fix race where download ui updates could be turned off for subsequent tasks if after adding a task it completed very quickly on another thread; fix use of Gtk.ListView as a multi-threaded container (sometimes returns None for an item and causes an exception) 2021-06-05 22:24:04 +01:00
blushingpenguin e7fab75c17 fix sync errors if multiple threads try and create the same folder, fix spawning 1 thread per sync task 2021-06-04 07:56:34 +01:00
auouymous 5fc0871078 Delete empty partial files immediately after download failure. 2021-05-20 06:35:18 -06:00
auouymous 1e10a4f9bd Show error icon on episodes that fail to download. 2021-05-14 20:24:50 -06:00
auouymous 1c0bf62afd Do not attempt to download episodes without an URL. 2021-03-28 05:54:16 -06:00
Eric Le Lay e632bfdbde Merge remote-tracking branch 'origin/master' into requests 2020-11-24 09:23:28 +01:00
Eric Le Lay d87466f609
Merge pull request #839 from gpodder/fix-796-mkv-files
Fix #796 MKV Files Not Properly Renamed
2020-09-14 08:22:39 +02:00
Eric Le Lay bc5327dd2a actually use new mimetype to change downloaded file extension
needed for youtube-dl downloading to .mkv for some combinations of audio+video codecs.
Before this fix the new mimetype was ignored in download.py because episode.extension()
would use the existing download filename instead of using the updated mime type
2020-09-12 15:14:41 +02:00
auouymous bc62e3bb4c Youtube live streaming support 2020-09-12 02:34:39 -06:00
Eric Le Lay 12912bed3e fix naive access to response.text
bytes for xml, utf-8 fallback for html, known encoding if available
2020-07-18 15:04:04 +02:00
Eric Le Lay 6188efc24e use requests for download 2020-07-12 17:07:42 +02:00
Eric Le Lay d40bc49e0e move download's get_header_param() to util, to use in soundcloud plugin 2020-07-12 17:06:34 +02:00
Eric Le Lay 12bbd23fed a custom downloader can be passed to download_episode_list
to prepare for #718 Add episode menu option to download with youtube-dl extension.

Not all code paths will forward custom downloader to the DownloadTask.
It can be added later
2020-01-05 21:57:23 +01:00
Eric Le Lay 9cd2f51465 cleanup DownloadTask reference in episode when cancelled
otherwise partial downloads cancelled on restart can't be
downloaded again until gPodder restart. Because they were
not run from a DownloadQueueWorker, which would have called
recycle() after run().
2019-09-22 18:47:42 +02:00
Eric Le Lay a05bd85d76 registry.custom_downloader + registry.download_url
for extensions to be able to register custom downloaders,
not only resolving episode to a real download url.
refactor {escapist,youtube,vimeo}.get_real_download_url to use registry.
2019-08-17 16:25:00 +02:00
Eric Le Lay a7385c95b5 fix #649 Progress icon doesn't appear when downloading a failed or paused episode
thanks to @auouymous for the fix
2019-08-11 11:59:08 +02:00
Eric Le Lay 03819e4abf fix #635 Vimeo download fail 2019-06-18 09:00:26 +02:00
Eric Le Lay 4400f5bf16 fix #591 invalid local filename when content-disposition invalid extension
1. fix download to remove query string from attachment name
   can cause regressions when filename contains query before extension
   or other strange characters because we parse as url an intended filename
2. fix episode.local_filename() to always sanitize the extension
2019-01-27 12:30:46 +01:00
Eric Le Lay ad86c35b9a fix download episodes requiring authentication 2018-12-15 17:02:16 +01:00
Eric Le Lay 3547938638 tentative fix 550 - gPodder 3.10.5 stops responding when updating and downloading
fix a leftover python2 bytes vs str comparison causing the download loop to never end
See #550
2018-12-11 09:59:33 +01:00
Eric Le Lay 2b235ce5ed add info message with downloaded url 2018-11-10 17:17:28 +01:00
MarkusHackspacher 3ce9cd55e7 remove too many blank lines 2018-07-24 14:11:05 +02:00