8 Commits

Author SHA1 Message Date
Kamil Kosek
61604950c3 Merge pull request #67 from Ofirfr/debug_spotdl
spotDL exec command debug log
2025-01-21 09:31:55 +01:00
Kamil Kosek
58674d4c26 Merge pull request #66 from Ofirfr/docker_ignore
make docker image slimmer
2025-01-21 09:30:36 +01:00
Ofirfr
d146e78132 upgrade spotdl for better performence 2025-01-16 20:26:11 +02:00
Ofirfr
3ceae962b1 adjust for cookie_file might not be set 2025-01-13 22:02:51 +02:00
Ofirfr
6f051cb167 notify about performence effects of params 2025-01-13 22:02:37 +02:00
Ofirfr
42325742f0 sanitize config 2025-01-13 22:02:14 +02:00
Ofirfr
8ad5ff0860 spotDL exec command debug log 2025-01-11 23:30:27 +02:00
Ofirfr
92407a2ee0 make docker image slimmer 2025-01-11 22:01:21 +02:00
5 changed files with 31 additions and 15 deletions

View File

@@ -11,7 +11,12 @@ __pycache__/
.DS_Store
# Ignore Git files
.git
.git*
*cookies*
set_env.sh
jellyplist.code-workspace
jellyplist.code-workspace
# Ignore GitHub page related files
changelogs
readme.md
screenshots

View File

@@ -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)
@@ -247,7 +247,8 @@ def download_missing_tracks(self):
app.logger.debug(f"Using proxy: {app.config['SPOTDL_PROXY']}")
command.append("--proxy")
command.append(app.config['SPOTDL_PROXY'])
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

View File

@@ -1,6 +1,8 @@
import os
import sys
import app
class Config:
LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO').upper()
SECRET_KEY = os.getenv('SECRET_KEY')
@@ -37,16 +39,24 @@ class Config:
QUALITY_SCORE_THRESHOLD = float(os.getenv('QUALITY_SCORE_THRESHOLD',1000.0))
# SpotDL specific configuration
SPOTDL_CONFIG = {
'cookie_file': '/jellyplist/cookies.txt',
# combine the path provided in MUSIC_STORAGE_BASE_PATH with the following path __jellyplist/{track-id} to get the value for output
'threads': 12
}
# combine the path provided in MUSIC_STORAGE_BASE_PATH with the SPOTDL_OUTPUT_FORMAT to get the value for output
if os.getenv('MUSIC_STORAGE_BASE_PATH'):
output_path = os.path.join(MUSIC_STORAGE_BASE_PATH,SPOTDL_OUTPUT_FORMAT)
# Ensure MUSIC_STORAGE_BASE_PATH ends with "__jellyplist"
if not MUSIC_STORAGE_BASE_PATH.endswith("__jellyplist"):
MUSIC_STORAGE_BASE_PATH += "__jellyplist"
# Ensure SPOTDL_OUTPUT_FORMAT does not start with "/"
normalized_spotdl_output_format = SPOTDL_OUTPUT_FORMAT.lstrip("/").replace(" ", "_")
# Join the paths
output_path = os.path.join(MUSIC_STORAGE_BASE_PATH, normalized_spotdl_output_format)
SPOTDL_CONFIG.update({'output': output_path})
if SPOTIFY_COOKIE_FILE:
SPOTDL_CONFIG.update({'cookie_file': SPOTIFY_COOKIE_FILE})
@classmethod
def validate_env_vars(cls):

View File

@@ -44,13 +44,13 @@ MUSIC_STORAGE_BASE_PATH = '/storage/media/music' # The base path where your musi
# SPOTDL_PROXY = http://proxy:8080
# SPOTDL_OUTPUT_FORMAT = "/{artist}/{artists} - {title}" # Supported variables: {title}, {artist},{artists}, {album}, Will be joined with to get a complete path
# SEARCH_JELLYFIN_BEFORE_DOWNLOAD = false # defaults to true, before attempting to do a download with spotDL , the song will be searched first in the local library
# SEARCH_JELLYFIN_BEFORE_DOWNLOAD = false # defaults to true, before attempting to do a download with spotDL , the song will be searched first in the local library ("true" MAY INCURE PERFORMENCE ISSUES)
# START_DOWNLOAD_AFTER_PLAYLIST_ADD = true # defaults to false, If a new Playlist is added, the Download Task will be scheduled immediately
# FIND_BEST_MATCH_USE_FFPROBE = true # Use ffprobe to gather quality details from a file to calculate quality score. Otherwise jellyplist will use details provided by jellyfin. defaults to false.
#REFRESH_LIBRARIES_AFTER_DOWNLOAD_TASK = true # jellyplist will trigger a music library update on your Jellyfin server, in case you dont have `Realtime Monitoring` enabled on your Jellyfin library. Defaults to false.
#REFRESH_LIBRARIES_AFTER_DOWNLOAD_TASK = true # jellyplist will trigger a music library update on your Jellyfin server, in case you dont have `Realtime Monitoring` enabled on your Jellyfin library. Defaults to false. ("true" MAY INCURE PERFORMENCE ISSUES)
# LOG_LEVEL = DEBUG # Defaults to INFO

View File

@@ -9,7 +9,7 @@ numpy==2.1.3
pyacoustid==1.3.0
redis==5.1.1
Requests==2.32.3
spotdl==4.2.10
spotdl==4.2.11
spotipy==2.24.0
SQLAlchemy==2.0.35
Unidecode==1.3.8