update
This commit is contained in:
parent
cff48b2498
commit
d13bd255d0
2 changed files with 74 additions and 8 deletions
45
config/config.example.json
Normal file
45
config/config.example.json
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"active_media_server": "plex",
|
||||||
|
"spotify": {
|
||||||
|
"client_id": "SpotifyClientID",
|
||||||
|
"client_secret": "SpotifyClientSecret"
|
||||||
|
},
|
||||||
|
"tidal": {
|
||||||
|
"client_id": "TidalClientID",
|
||||||
|
"client_secret": "TidalClientSecret"
|
||||||
|
},
|
||||||
|
"plex": {
|
||||||
|
"base_url": "http://192.168.86.36:32400",
|
||||||
|
"token": "PLEX_API_TOKEN",
|
||||||
|
"auto_detect": true
|
||||||
|
},
|
||||||
|
"jellyfin": {
|
||||||
|
"base_url": "http://localhost:8096",
|
||||||
|
"api_key": "JELLYFIN_API_KEY",
|
||||||
|
"auto_detect": true
|
||||||
|
},
|
||||||
|
"soulseek": {
|
||||||
|
"slskd_url": "http://localhost:5030",
|
||||||
|
"api_key": "SoulseekAPIKey",
|
||||||
|
"download_path": "./Downloads",
|
||||||
|
"transfer_path": "./Transfer"
|
||||||
|
},
|
||||||
|
"logging": {
|
||||||
|
"path": "logs/app.log",
|
||||||
|
"level": "INFO"
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"audio_quality": "flac"
|
||||||
|
},
|
||||||
|
"database": {
|
||||||
|
"path": "database/music_library.db",
|
||||||
|
"max_workers": 5
|
||||||
|
},
|
||||||
|
"metadata_enhancement": {
|
||||||
|
"enabled": true,
|
||||||
|
"embed_album_art": true
|
||||||
|
},
|
||||||
|
"playlist_sync": {
|
||||||
|
"create_backup": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -308,7 +308,13 @@ class SoulseekClient:
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
else:
|
else:
|
||||||
logger.error(f"API request failed: {response.status} - {response_text}")
|
# Enhanced error logging for better debugging
|
||||||
|
error_detail = response_text if response_text.strip() else "No error details provided"
|
||||||
|
logger.error(f"API request failed: HTTP {response.status} ({response.reason}) - {error_detail}")
|
||||||
|
|
||||||
|
# Log the specific endpoint and method for debugging
|
||||||
|
logger.debug(f"Failed request: {method} {url}")
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -907,14 +913,29 @@ class SoulseekClient:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Use correct slskd API format: DELETE /transfers/downloads/{username}/{download_id}?remove={true/false}
|
# Try multiple API formats as slskd API may vary between versions
|
||||||
# remove=false: Cancel download but keep in transfer list
|
endpoints_to_try = [
|
||||||
# remove=true: Remove download completely from transfer list
|
# Format 1: With username and remove parameter (original format)
|
||||||
endpoint = f'transfers/downloads/{username}/{download_id}?remove={str(remove).lower()}'
|
f'transfers/downloads/{username}/{download_id}?remove={str(remove).lower()}',
|
||||||
|
# Format 2: Simple format with just download_id (used in sync.py)
|
||||||
|
f'transfers/downloads/{download_id}',
|
||||||
|
# Format 3: Alternative format without remove parameter
|
||||||
|
f'transfers/downloads/{username}/{download_id}'
|
||||||
|
]
|
||||||
|
|
||||||
action = "Removing" if remove else "Cancelling"
|
action = "Removing" if remove else "Cancelling"
|
||||||
logger.debug(f"{action} download with endpoint: {endpoint}")
|
|
||||||
response = await self._make_request('DELETE', endpoint)
|
for i, endpoint in enumerate(endpoints_to_try):
|
||||||
return response is not None
|
logger.debug(f"{action} download (attempt {i+1}/3) with endpoint: {endpoint}")
|
||||||
|
response = await self._make_request('DELETE', endpoint)
|
||||||
|
if response is not None:
|
||||||
|
logger.info(f"✅ Successfully cancelled download using endpoint format {i+1}")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
logger.debug(f"❌ Endpoint format {i+1} failed: {endpoint}")
|
||||||
|
|
||||||
|
logger.error(f"❌ All cancel endpoint formats failed for download_id: {download_id}")
|
||||||
|
return False
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error cancelling download: {e}")
|
logger.error(f"Error cancelling download: {e}")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue