mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-30 08:24:53 +00:00
[utils] Create DownloadCancelled
exception
as super-class of ExistingVideoReached, RejectedVideoReached, MaxDownloadsReached Third parties can also sub-class this to cancel the download queue from a hook
This commit is contained in:
@@ -2542,14 +2542,29 @@ class PostProcessingError(YoutubeDLError):
|
||||
self.msg = msg
|
||||
|
||||
|
||||
class ExistingVideoReached(YoutubeDLError):
|
||||
""" --max-downloads limit has been reached. """
|
||||
pass
|
||||
class DownloadCancelled(YoutubeDLError):
|
||||
""" Exception raised when the download queue should be interrupted """
|
||||
msg = 'The download was cancelled'
|
||||
|
||||
def __init__(self, msg=None):
|
||||
if msg is not None:
|
||||
self.msg = msg
|
||||
YoutubeDLError.__init__(self, self.msg)
|
||||
|
||||
|
||||
class RejectedVideoReached(YoutubeDLError):
|
||||
class ExistingVideoReached(DownloadCancelled):
|
||||
""" --break-on-existing triggered """
|
||||
msg = 'Encountered a video that is already in the archive, stopping due to --break-on-existing'
|
||||
|
||||
|
||||
class RejectedVideoReached(DownloadCancelled):
|
||||
""" --break-on-reject triggered """
|
||||
msg = 'Encountered a video that did not match filter, stopping due to --break-on-reject'
|
||||
|
||||
|
||||
class MaxDownloadsReached(DownloadCancelled):
|
||||
""" --max-downloads limit has been reached. """
|
||||
pass
|
||||
msg = 'Maximum number of downloads reached, stopping due to --max-downloads'
|
||||
|
||||
|
||||
class ThrottledDownload(YoutubeDLError):
|
||||
@@ -2557,11 +2572,6 @@ class ThrottledDownload(YoutubeDLError):
|
||||
pass
|
||||
|
||||
|
||||
class MaxDownloadsReached(YoutubeDLError):
|
||||
""" --max-downloads limit has been reached. """
|
||||
pass
|
||||
|
||||
|
||||
class UnavailableVideoError(YoutubeDLError):
|
||||
"""Unavailable Format exception.
|
||||
|
||||
|
Reference in New Issue
Block a user