mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-24 05:56:37 +00:00
Use a temporary directory for testing formats
This commit is contained in:
parent
84d42fb2ab
commit
4b3605f65e
@ -146,6 +146,14 @@ def get_media_info(url, days=None):
|
||||
f'yesterday-{days!s}days' if days else None
|
||||
)
|
||||
opts = get_yt_opts()
|
||||
paths = opts.get('paths', dict())
|
||||
if 'temp' in paths:
|
||||
temp_dir_obj = TemporaryDirectory(prefix='.yt_dlp-', dir=paths['temp'])
|
||||
temp_dir_path = Path(temp_dir_obj.name)
|
||||
(temp_dir_path / '.ignore').touch(exist_ok=True)
|
||||
paths.update({
|
||||
'temp': str(temp_dir_path),
|
||||
})
|
||||
opts.update({
|
||||
'ignoreerrors': False, # explicitly set this to catch exceptions
|
||||
'ignore_no_formats_error': False, # we must fail first to try again with this enabled
|
||||
@ -158,6 +166,7 @@ def get_media_info(url, days=None):
|
||||
'extractor_args': {
|
||||
'youtubetab': {'approximate_date': ['true']},
|
||||
},
|
||||
'paths': paths,
|
||||
'sleep_interval_requests': 2,
|
||||
'verbose': True if settings.DEBUG else False,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user