From bab7082634fedf30bcabe9ac5cf83b0686184aa4 Mon Sep 17 00:00:00 2001 From: Roland Date: Fri, 9 Jun 2023 16:04:44 -0600 Subject: [PATCH] Downloading video even if the channel cannot be found. --- modules/videos/downloader.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/videos/downloader.py b/modules/videos/downloader.py index 31cfd0f4..db163917 100755 --- a/modules/videos/downloader.py +++ b/modules/videos/downloader.py @@ -197,9 +197,13 @@ class VideoDownloader(Downloader, ABC): channel = None if channel_name or source_channel_id: # Try to find the channel via info_json from yt-dlp. - channel = get_or_create_channel(source_id=source_channel_id, url=channel_url, name=channel_name) - if channel: - found_channel = 'yt_dlp' + try: + channel = get_or_create_channel(source_id=source_channel_id, url=channel_url, name=channel_name) + if channel: + found_channel = 'yt_dlp' + except UnknownChannel: + # Can't find a channel, use the no channel directory. + pass settings = download.settings or dict() local_channel_id = settings.get('channel_id') @@ -392,7 +396,7 @@ def get_or_create_channel(source_id: str = None, url: str = None, name: str = No pass if not name: - raise ValueError(f'Cannot create channel without a name') + raise UnknownChannel(f'Cannot create channel without a name') # Channel does not exist. Create one in the video directory. channel_directory = get_videos_directory() / escape_file_name(name)