adjust for cookie_file might not be set
This commit is contained in:
@@ -113,8 +113,8 @@ def download_missing_tracks(self):
|
||||
app.logger.info("Starting track download job...")
|
||||
|
||||
with app.app_context():
|
||||
spotdl_config = app.config['SPOTDL_CONFIG']
|
||||
cookie_file = spotdl_config['cookie_file']
|
||||
spotdl_config: dict = app.config['SPOTDL_CONFIG']
|
||||
cookie_file = spotdl_config.get('cookie_file', None)
|
||||
output_dir = spotdl_config['output']
|
||||
client_id = app.config['SPOTIFY_CLIENT_ID']
|
||||
client_secret = app.config['SPOTIFY_CLIENT_SECRET']
|
||||
@@ -239,7 +239,7 @@ def download_missing_tracks(self):
|
||||
"--client-id", client_id,
|
||||
"--client-secret", client_secret
|
||||
]
|
||||
if os.path.exists(cookie_file):
|
||||
if cookie_file and os.path.exists(cookie_file):
|
||||
app.logger.debug(f"Found {cookie_file}, using it for spotDL")
|
||||
command.append("--cookie-file")
|
||||
command.append(cookie_file)
|
||||
@@ -248,7 +248,7 @@ def download_missing_tracks(self):
|
||||
command.append("--proxy")
|
||||
command.append(app.config['SPOTDL_PROXY'])
|
||||
|
||||
app.logger.debug(f"Executing the spotDL command: {' '.join(command)}")
|
||||
app.logger.info(f"Executing the spotDL command: {' '.join(command)}")
|
||||
result = subprocess.run(command, capture_output=True, text=True, timeout=90)
|
||||
if result.returncode == 0:
|
||||
track.downloaded = True
|
||||
|
||||
Reference in New Issue
Block a user