update git workers

This commit is contained in:
coolgitternotin
2025-03-20 13:24:07 -06:00
parent addb2ad1eb
commit d1e75c572b
7 changed files with 91 additions and 48 deletions

View File

@@ -6,6 +6,8 @@ on:
tags: [ 'v*' ]
pull_request:
branches: [ main, master ]
release:
types: [ published, released ]
# Allow manual triggering
workflow_dispatch:
@@ -36,6 +38,7 @@ jobs:
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}
# Build and push Docker image

View File

@@ -9,7 +9,7 @@ services:
- ./logs:/app/logs # <-- Volume for persistent logs
ports:
- 7171:7171
image: cooldockerizer93/spotizerr
image: spotizerr:dev
container_name: spotizerr-app
restart: unless-stopped
environment:

View File

@@ -25,7 +25,15 @@ def download_album(
# Load Spotify client credentials if available
spotify_client_id = None
spotify_client_secret = None
search_creds_path = Path(f'./creds/spotify/{main}/search.json')
# Smartly determine where to look for Spotify search credentials
if service == 'spotify' and fallback:
# If fallback is enabled, use the fallback account for Spotify search credentials
search_creds_path = Path(f'./creds/spotify/{fallback}/search.json')
else:
# Otherwise use the main account for Spotify search credentials
search_creds_path = Path(f'./creds/spotify/{main}/search.json')
if search_creds_path.exists():
try:
with open(search_creds_path, 'r') as f:
@@ -78,23 +86,12 @@ def download_album(
spo_creds_dir = os.path.join('./creds/spotify', fallback)
spo_creds_path = os.path.abspath(os.path.join(spo_creds_dir, 'credentials.json'))
# Check for Spotify client credentials in fallback account
fallback_client_id = spotify_client_id
fallback_client_secret = spotify_client_secret
fallback_search_path = Path(f'./creds/spotify/{fallback}/search.json')
if fallback_search_path.exists():
try:
with open(fallback_search_path, 'r') as f:
fallback_search_creds = json.load(f)
fallback_client_id = fallback_search_creds.get('client_id')
fallback_client_secret = fallback_search_creds.get('client_secret')
except Exception as e:
print(f"Error loading fallback Spotify search credentials: {e}")
# We've already loaded the Spotify client credentials above based on fallback
spo = SpoLogin(
credentials_path=spo_creds_path,
spotify_client_id=fallback_client_id,
spotify_client_secret=fallback_client_secret,
spotify_client_id=spotify_client_id,
spotify_client_secret=spotify_client_secret,
progress_callback=progress_callback
)
spo.download_album(

View File

@@ -7,7 +7,7 @@ from pathlib import Path
logger = logging.getLogger(__name__)
# Redis configuration - read from environment variables
REDIS_HOST = os.getenv('REDIS_HOST', 'redis')
REDIS_HOST = os.getenv('REDIS_HOST', 'localhost')
REDIS_PORT = os.getenv('REDIS_PORT', '6379')
REDIS_DB = os.getenv('REDIS_DB', '0')
REDIS_URL = os.getenv('REDIS_URL', f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_DB}")

View File

@@ -467,6 +467,13 @@ def download_track(self, **task_data):
# Get the service from config
service = config_params.get("service")
# DEBUG: Log the config parameters
print(f"DEBUG: celery_tasks.py config_params:")
print(f"DEBUG: service = {service}")
print(f"DEBUG: spotify = {config_params.get('spotify', '')}")
print(f"DEBUG: deezer = {config_params.get('deezer', '')}")
print(f"DEBUG: fallback_enabled = {config_params.get('fallback', False)}")
# Determine main, fallback, and quality parameters based on service and fallback setting
fallback_enabled = config_params.get("fallback", False)
@@ -479,6 +486,11 @@ def download_track(self, **task_data):
fallback = config_params.get("spotify", "")
quality = config_params.get("deezerQuality", "MP3_128")
fall_quality = config_params.get("spotifyQuality", "NORMAL")
# DEBUG: Log the values after fallback logic
print(f"DEBUG: Spotify with fallback enabled:")
print(f"DEBUG: main (Deezer account) = {main}")
print(f"DEBUG: fallback (Spotify account) = {fallback}")
else:
# If fallback is disabled with Spotify service:
# - main is the Spotify account
@@ -487,6 +499,10 @@ def download_track(self, **task_data):
fallback = None
quality = config_params.get("spotifyQuality", "NORMAL")
fall_quality = None
# DEBUG: Log the values
print(f"DEBUG: Spotify without fallback:")
print(f"DEBUG: main (Spotify account) = {main}")
elif service == 'deezer':
# For Deezer service:
# - main is the Deezer account
@@ -495,12 +511,20 @@ def download_track(self, **task_data):
fallback = None
quality = config_params.get("deezerQuality", "MP3_128")
fall_quality = None
# DEBUG: Log the values
print(f"DEBUG: Deezer service:")
print(f"DEBUG: main (Deezer account) = {main}")
else:
# Default to Spotify if unknown service
main = config_params.get("spotify", "")
fallback = None
quality = config_params.get("spotifyQuality", "NORMAL")
fall_quality = None
# DEBUG: Log the values
print(f"DEBUG: Unknown service defaulting to Spotify:")
print(f"DEBUG: main (Spotify account) = {main}")
# Get remaining parameters from task_data or config
url = task_data.get("url", "")
@@ -510,7 +534,12 @@ def download_track(self, **task_data):
pad_tracks = task_data.get("pad_tracks", config_params.get("tracknum_padding", True))
# Log task parameters for debugging
logger.debug(f"Track download parameters: service={service}, quality={quality}, real_time={real_time}")
print(f"DEBUG: Final parameters for download_track_func:")
print(f"DEBUG: service = {service}")
print(f"DEBUG: main = {main}")
print(f"DEBUG: fallback = {fallback}")
print(f"DEBUG: quality = {quality}")
print(f"DEBUG: fall_quality = {fall_quality}")
# Execute the download function with progress callback
download_track_func(

View File

@@ -25,7 +25,15 @@ def download_playlist(
# Load Spotify client credentials if available
spotify_client_id = None
spotify_client_secret = None
search_creds_path = Path(f'./creds/spotify/{main}/search.json')
# Smartly determine where to look for Spotify search credentials
if service == 'spotify' and fallback:
# If fallback is enabled, use the fallback account for Spotify search credentials
search_creds_path = Path(f'./creds/spotify/{fallback}/search.json')
else:
# Otherwise use the main account for Spotify search credentials
search_creds_path = Path(f'./creds/spotify/{main}/search.json')
if search_creds_path.exists():
try:
with open(search_creds_path, 'r') as f:
@@ -78,23 +86,12 @@ def download_playlist(
spo_creds_dir = os.path.join('./creds/spotify', fallback)
spo_creds_path = os.path.abspath(os.path.join(spo_creds_dir, 'credentials.json'))
# Check for Spotify client credentials in fallback account
fallback_client_id = spotify_client_id
fallback_client_secret = spotify_client_secret
fallback_search_path = Path(f'./creds/spotify/{fallback}/search.json')
if fallback_search_path.exists():
try:
with open(fallback_search_path, 'r') as f:
fallback_search_creds = json.load(f)
fallback_client_id = fallback_search_creds.get('client_id')
fallback_client_secret = fallback_search_creds.get('client_secret')
except Exception as e:
print(f"Error loading fallback Spotify search credentials: {e}")
# We've already loaded the Spotify client credentials above based on fallback
spo = SpoLogin(
credentials_path=spo_creds_path,
spotify_client_id=fallback_client_id,
spotify_client_secret=fallback_client_secret,
spotify_client_id=spotify_client_id,
spotify_client_secret=spotify_client_secret,
progress_callback=progress_callback
)
spo.download_playlist(

View File

@@ -22,16 +22,30 @@ def download_track(
progress_callback=None
):
try:
# DEBUG: Print parameters
print(f"DEBUG: track.py received - service={service}, main={main}, fallback={fallback}")
# Load Spotify client credentials if available
spotify_client_id = None
spotify_client_secret = None
search_creds_path = Path(f'./creds/spotify/{main}/search.json')
# Smartly determine where to look for Spotify search credentials
if service == 'spotify' and fallback:
# If fallback is enabled, use the fallback account for Spotify search credentials
search_creds_path = Path(f'./creds/spotify/{fallback}/search.json')
print(f"DEBUG: Using Spotify search credentials from fallback: {search_creds_path}")
else:
# Otherwise use the main account for Spotify search credentials
search_creds_path = Path(f'./creds/spotify/{main}/search.json')
print(f"DEBUG: Using Spotify search credentials from main: {search_creds_path}")
if search_creds_path.exists():
try:
with open(search_creds_path, 'r') as f:
search_creds = json.load(f)
spotify_client_id = search_creds.get('client_id')
spotify_client_secret = search_creds.get('client_secret')
print(f"DEBUG: Loaded Spotify client credentials successfully")
except Exception as e:
print(f"Error loading Spotify search credentials: {e}")
@@ -45,6 +59,19 @@ def download_track(
try:
deezer_creds_dir = os.path.join('./creds/deezer', main)
deezer_creds_path = os.path.abspath(os.path.join(deezer_creds_dir, 'credentials.json'))
# DEBUG: Print Deezer credential paths being used
print(f"DEBUG: Looking for Deezer credentials at:")
print(f"DEBUG: deezer_creds_dir = {deezer_creds_dir}")
print(f"DEBUG: deezer_creds_path = {deezer_creds_path}")
print(f"DEBUG: Directory exists = {os.path.exists(deezer_creds_dir)}")
print(f"DEBUG: Credentials file exists = {os.path.exists(deezer_creds_path)}")
# List available directories to compare
print(f"DEBUG: Available Deezer credential directories:")
for dir_name in os.listdir('./creds/deezer'):
print(f"DEBUG: ./creds/deezer/{dir_name}")
with open(deezer_creds_path, 'r') as f:
deezer_creds = json.load(f)
dl = DeeLogin(
@@ -68,27 +95,17 @@ def download_track(
max_retries=max_retries
)
except Exception as e:
print(f"DEBUG: Deezer download attempt failed: {e}")
# If the first attempt fails, use the fallback Spotify credentials
spo_creds_dir = os.path.join('./creds/spotify', fallback)
spo_creds_path = os.path.abspath(os.path.join(spo_creds_dir, 'credentials.json'))
# Check for Spotify client credentials in fallback account
fallback_client_id = spotify_client_id
fallback_client_secret = spotify_client_secret
fallback_search_path = Path(f'./creds/spotify/{fallback}/search.json')
if fallback_search_path.exists():
try:
with open(fallback_search_path, 'r') as f:
fallback_search_creds = json.load(f)
fallback_client_id = fallback_search_creds.get('client_id')
fallback_client_secret = fallback_search_creds.get('client_secret')
except Exception as e:
print(f"Error loading fallback Spotify search credentials: {e}")
# We've already loaded the Spotify client credentials above based on fallback
spo = SpoLogin(
credentials_path=spo_creds_path,
spotify_client_id=fallback_client_id,
spotify_client_secret=fallback_client_secret,
spotify_client_id=spotify_client_id,
spotify_client_secret=spotify_client_secret,
progress_callback=progress_callback
)
spo.download_track(