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.
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.
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().
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.
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.
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.
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.
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.
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.
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.
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.
Calling run() with CANCELLED state only returns without performing any
work. The CANCELLING state actually deletes the partial file and
recycles the task.
* #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)
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
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
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().
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.
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