From e2bea2c15107320ff8f3560b97ac8cc5d15acbda Mon Sep 17 00:00:00 2001 From: Kamil Kosek Date: Mon, 9 Dec 2024 10:51:20 +0100 Subject: [PATCH 1/9] Update main.yml Remove automatic Build --- .github/workflows/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3e6ca45..7a29408 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,12 @@ name: Build and Release on Tag on: - push: - branches: - - main + workflow_dispatch: + inputs: + branch: + description: 'Branch to build the Docker image from' + required: true + default: 'main' jobs: build-and-publish: From 43adf127556d4fe8002354b2d5c7c679fc446b37 Mon Sep 17 00:00:00 2001 From: Kamil Date: Thu, 12 Dec 2024 12:21:39 +0000 Subject: [PATCH 2/9] Enable generation of release notes in GitHub Actions workflow --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7a29408..713e355 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,5 +76,7 @@ jobs: name: Release ${{ env.VERSION }} body: | ${{ env.CHANGELOG_CONTENT }} + generate_release_notes: true + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 92407a2ee023748a093c332e31422bd27dfc1810 Mon Sep 17 00:00:00 2001 From: Ofirfr Date: Sat, 11 Jan 2025 22:01:21 +0200 Subject: [PATCH 3/9] make docker image slimmer --- .dockerignore | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index 036bd21..d65d56d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,7 +11,12 @@ __pycache__/ .DS_Store # Ignore Git files -.git +.git* *cookies* set_env.sh -jellyplist.code-workspace \ No newline at end of file +jellyplist.code-workspace + +# Ignore GitHub page related files +changelogs +readme.md +screenshots \ No newline at end of file From 8ad5ff0860bbc3610d39b5b1b43d91aae71cb9ae Mon Sep 17 00:00:00 2001 From: Ofirfr Date: Sat, 11 Jan 2025 23:30:27 +0200 Subject: [PATCH 4/9] spotDL exec command debug log --- app/tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/tasks.py b/app/tasks.py index c4506dc..500b3cd 100644 --- a/app/tasks.py +++ b/app/tasks.py @@ -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.debug(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 From 42325742f049b5993136e97faf87d7692562f6d6 Mon Sep 17 00:00:00 2001 From: Ofirfr Date: Mon, 13 Jan 2025 22:02:14 +0200 Subject: [PATCH 5/9] sanitize config --- config.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/config.py b/config.py index 8dc1b97..b64c6e6 100644 --- a/config.py +++ b/config.py @@ -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): From 6f051cb167a6765102b8a990cc0fd5bfb39a9b99 Mon Sep 17 00:00:00 2001 From: Ofirfr Date: Mon, 13 Jan 2025 22:02:37 +0200 Subject: [PATCH 6/9] notify about performence effects of params --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 7422ab3..cb64ecf 100644 --- a/readme.md +++ b/readme.md @@ -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 From 3ceae962b15bc3521dda47135d1d62c882a0a63e Mon Sep 17 00:00:00 2001 From: Ofirfr Date: Mon, 13 Jan 2025 22:02:51 +0200 Subject: [PATCH 7/9] adjust for cookie_file might not be set --- app/tasks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/tasks.py b/app/tasks.py index 500b3cd..34c6ef2 100644 --- a/app/tasks.py +++ b/app/tasks.py @@ -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 From d146e78132d05fef26a895fd12d76f883e917a92 Mon Sep 17 00:00:00 2001 From: Ofirfr Date: Thu, 16 Jan 2025 20:26:11 +0200 Subject: [PATCH 8/9] upgrade spotdl for better performence --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 624a3d8..7b5020f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 From 1b91110768933e7b9979b9ca513c417d3e14150d Mon Sep 17 00:00:00 2001 From: Daniel Boluda <72820621+Daniel-Boluda@users.noreply.github.com> Date: Sun, 26 Jan 2025 14:37:15 +0100 Subject: [PATCH 9/9] add CACHE_REDIS_HOST as env variable to config.py This is usefull for hosts not being "redis" --- config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index b64c6e6..42bae17 100644 --- a/config.py +++ b/config.py @@ -22,7 +22,7 @@ class Config: DISPLAY_EXTENDED_AUDIO_DATA = os.getenv('DISPLAY_EXTENDED_AUDIO_DATA',"false").lower() == 'true' CACHE_TYPE = 'redis' CACHE_REDIS_PORT = 6379 - CACHE_REDIS_HOST = 'redis' + CACHE_REDIS_HOST = os.getenv('CACHE_REDIS_HOST','redis') CACHE_REDIS_DB = 0 CACHE_DEFAULT_TIMEOUT = 3600 REDIS_URL = os.getenv('REDIS_URL','redis://redis:6379/0') @@ -80,4 +80,4 @@ class Config: if missing_vars: missing = ', '.join(missing_vars) sys.stderr.write(f"Error: The following environment variables are not set: {missing}\n") - sys.exit(1) \ No newline at end of file + sys.exit(1)