From 9e00dd09e344419f2fe538918dc81709a8671dc0 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 9 Oct 2024 17:49:21 +0100 Subject: [PATCH] allow adding global yt-dlp flags --- pandora/archive/external.py | 10 +++++++--- pandora/settings.py | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pandora/archive/external.py b/pandora/archive/external.py index 5f4ac3fd4..54c552465 100644 --- a/pandora/archive/external.py +++ b/pandora/archive/external.py @@ -40,8 +40,12 @@ info_key_map = { 'display_id': 'id', } +YT_DLP = ['yt-dlp'] +if settings.YT_DLP_EXTRA: + YT_DLP += settings.YT_DLP_EXTRA + def get_info(url, referer=None): - cmd = ['yt-dlp', '-j', '--all-subs', url] + cmd = YT_DLP + ['-j', '--all-subs', url] if referer: cmd += ['--referer', referer] p = subprocess.Popen(cmd, @@ -93,7 +97,7 @@ def add_subtitles(item, media, tmp): sub.save() def load_formats(url): - cmd = ['yt-dlp', '-q', url, '-j', '-F'] + cmd = YT_DLP + ['-q', url, '-j', '-F'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) @@ -112,7 +116,7 @@ def download(item_id, url, referer=None): if isinstance(tmp, bytes): tmp = tmp.decode('utf-8') os.chdir(tmp) - cmd = ['yt-dlp', '-q', media['url']] + cmd = YT_DLP + ['-q', media['url']] if referer: cmd += ['--referer', referer] elif 'referer' in media: diff --git a/pandora/settings.py b/pandora/settings.py index 7268c31c9..084ce8b3e 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -291,6 +291,8 @@ DATA_UPLOAD_MAX_MEMORY_SIZE = 32 * 1024 * 1024 EMPTY_CLIPS = True +YT_DLP_EXTRA = [] + #you can ignore things below this line #========================================================================= LOCAL_APPS = []