mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Finding channel by destination directory if any.
This commit is contained in:
parent
f1bc29d76f
commit
ddb35448aa
5 changed files with 17 additions and 18 deletions
|
|
@ -241,10 +241,12 @@ class VideoDownloader(Downloader, ABC):
|
|||
settings = download.settings or dict()
|
||||
local_channel_id = settings.get('channel_id')
|
||||
channel_url = settings.get('channel_url')
|
||||
destination = settings.get('destination')
|
||||
if not channel and (local_channel_id or channel_url):
|
||||
# Could not find channel via yt-dlp info_json, use info from ChannelDownloader if it created this Download.
|
||||
logger.info(f'Using download.settings to find channel')
|
||||
channel = get_channel(channel_id=local_channel_id, url=channel_url, return_dict=False)
|
||||
channel = get_channel(channel_id=local_channel_id, url=channel_url, directory=destination,
|
||||
return_dict=False)
|
||||
if channel:
|
||||
found_channel = 'download_settings'
|
||||
|
||||
|
|
@ -256,7 +258,7 @@ class VideoDownloader(Downloader, ABC):
|
|||
logger.info('Could not find channel')
|
||||
|
||||
# Use the default directory if this video has no channel.
|
||||
if settings.get('destination'):
|
||||
if destination:
|
||||
out_dir = pathlib.Path(settings['destination'])
|
||||
else:
|
||||
out_dir = get_no_channel_directory()
|
||||
|
|
|
|||
|
|
@ -446,6 +446,7 @@ async def test_download_result(test_session, test_directory, video_download_mana
|
|||
@pytest.mark.asyncio
|
||||
async def test_download_destination(test_session, test_directory, video_download_manager,
|
||||
mock_video_process_runner, mock_video_extract_info, mock_video_prepare_filename):
|
||||
"""A Video can be downloaded to a directory other than it's Channel's directory."""
|
||||
mock_video_extract_info.return_value = example_video_json
|
||||
|
||||
settings = dict(destination=f'{test_directory}/custom')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue