From 23d121e58fd893f0536b76e0a42eeda24db92127 Mon Sep 17 00:00:00 2001 From: Kamil Date: Tue, 10 Dec 2024 12:23:16 +0000 Subject: [PATCH] add proxy support for SpotDL in download process Fixes #35 --- app/tasks.py | 4 ++++ config.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/tasks.py b/app/tasks.py index 131e92d..224f36a 100644 --- a/app/tasks.py +++ b/app/tasks.py @@ -211,6 +211,10 @@ def download_missing_tracks(self): app.logger.debug(f"Found {cookie_file}, using it for spotDL") command.append("--cookie-file") command.append(cookie_file) + if app.config['SPOTDL_PROXY']: + app.logger.debug(f"Using proxy: {app.config['SPOTDL_PROXY']}") + command.append("--proxy") + command.append(app.config['SPOTDL_PROXY']) result = subprocess.run(command, capture_output=True, text=True, timeout=90) if result.returncode == 0 and os.path.exists(file_path): diff --git a/config.py b/config.py index b996c99..bb82d53 100644 --- a/config.py +++ b/config.py @@ -1,7 +1,6 @@ import os import sys - class Config: LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO').upper() SECRET_KEY = os.getenv('SECRET_KEY') @@ -33,6 +32,8 @@ class Config: LIDARR_MONITOR_ARTISTS = os.getenv('LIDARR_MONITOR_ARTISTS','false').lower() == 'true' MUSIC_STORAGE_BASE_PATH = os.getenv('MUSIC_STORAGE_BASE_PATH') CHECK_FOR_UPDATES = os.getenv('CHECK_FOR_UPDATES','true').lower() == 'true' + SPOTDL_PROXY = os.getenv('SPOTDL_PROXY',None) + # SpotDL specific configuration SPOTDL_CONFIG = { 'cookie_file': '/jellyplist/cookies.txt',