mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
cbf646e25b
## Major Changes - Fixed all TypeScript errors in web client for successful compilation - Resolved 82+ Python lint errors across backend services - Updated Flutter SDK compatibility for mobile app - Fixed security workflow configuration ## Web Client Fixes - Fixed import path in DragonflyDashboard.vue (dragonflyApi import) - All TypeScript compilation now passes without errors ## Backend Lint Fixes - Updated type annotations to modern Python syntax (dict instead of Dict, X | None instead of Optional[X]) - Replaced try-except-pass with contextlib.suppress(Exception) - Removed unused imports (Dict, Optional, Any, Iterator, etc.) - Fixed bare except clauses to use Exception - Sorted and formatted imports with ruff - Applied ruff format to 27 files ## Workflow Fixes - Updated Flutter SDK constraint from ^3.10.4 to ^3.5.0 (compatible with Flutter 3.24.0) - Changed pip-audit format from github to json in security.yml - Added comprehensive CI workflows (readiness-gate.yml, security.yml) ## Infrastructure - Added DragonflyDB caching system integration - Enhanced Docker configuration with multi-stage builds - Added pytest configuration and test infrastructure - Improved production readiness with proper error handling ## Verification - backend-lint job: ✅ Succeeded - web job: ✅ Succeeded - Ready for GitHub deployment All CI/CD issues resolved. Codebase now passes all quality checks.
136 lines
4.9 KiB
Python
136 lines
4.9 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Debug Spotify response to see what fields are actually available
|
|
"""
|
|
|
|
import json
|
|
import logging
|
|
import sys
|
|
import os
|
|
|
|
# Add the src directory to the path
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
|
|
|
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def debug_spotify_response():
|
|
"""Debug what fields are actually in Spotify response"""
|
|
logger.info("🔍 Debugging Spotify response fields...")
|
|
|
|
try:
|
|
from swingmusic.services.spotify_web_player_client import get_spotify_web_player_client
|
|
|
|
client = get_spotify_web_player_client()
|
|
|
|
# Ensure we have a token
|
|
if not client._ensure_token():
|
|
logger.error("❌ Failed to get token")
|
|
return False
|
|
|
|
if not client._token.client_token:
|
|
if not client._get_client_token():
|
|
logger.error("❌ Failed to get client token")
|
|
return False
|
|
|
|
# Make a direct GraphQL query to see the raw response
|
|
payload = {
|
|
"variables": {
|
|
"uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh"
|
|
},
|
|
"operationName": "getTrack",
|
|
"extensions": {
|
|
"persistedQuery": {
|
|
"version": 1,
|
|
"sha256Hash": "612585ae06ba435ad26369870deaae23b5c8800a256cd8a57e08eddc25a37294"
|
|
}
|
|
}
|
|
}
|
|
|
|
headers = {
|
|
"Authorization": f"Bearer {client._token.access_token}",
|
|
"Client-Token": client._token.client_token,
|
|
"Spotify-App-Version": client._token.client_version,
|
|
"Content-Type": "application/json",
|
|
}
|
|
|
|
response = client.session.post(
|
|
"https://api-partner.spotify.com/pathfinder/v1/query",
|
|
json=payload,
|
|
headers=headers,
|
|
timeout=30
|
|
)
|
|
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
track_data = data.get("data", {}).get("trackUnion", {})
|
|
|
|
logger.info("📊 Available fields in Spotify response:")
|
|
logger.info(f"Track Type: {track_data.get('__typename', 'Unknown')}")
|
|
|
|
# Print all available fields
|
|
for key, value in track_data.items():
|
|
if key != "__typename":
|
|
if isinstance(value, (str, int, float, bool)):
|
|
logger.info(f" {key}: {value}")
|
|
elif isinstance(value, dict):
|
|
logger.info(f" {key}: [dict with {len(value)} keys]")
|
|
if len(value) <= 5:
|
|
for sub_key, sub_value in value.items():
|
|
logger.info(f" {sub_key}: {sub_value}")
|
|
elif isinstance(value, list):
|
|
logger.info(f" {key}: [list with {len(value)} items]")
|
|
else:
|
|
logger.info(f" {key}: {type(value)}")
|
|
|
|
# Look specifically for play count and popularity
|
|
logger.info("\n🎯 Looking for play count and popularity:")
|
|
logger.info(f" playcount: {track_data.get('playcount', 'NOT FOUND')}")
|
|
logger.info(f" popularity: {track_data.get('popularity', 'NOT FOUND')}")
|
|
logger.info(f" playCount: {track_data.get('playCount', 'NOT FOUND')}")
|
|
logger.info(f" popularityScore: {track_data.get('popularityScore', 'NOT FOUND')}")
|
|
|
|
# Check nested objects
|
|
logger.info("\n🔍 Checking nested objects:")
|
|
|
|
# Check visualIdentity
|
|
visual_identity = track_data.get("visualIdentity", {})
|
|
logger.info(f" visualIdentity keys: {list(visual_identity.keys())}")
|
|
|
|
# Check playability
|
|
playability = track_data.get("playability", {})
|
|
logger.info(f" playability keys: {list(playability.keys())}")
|
|
|
|
# Check contentRating
|
|
content_rating = track_data.get("contentRating", {})
|
|
logger.info(f" contentRating keys: {list(content_rating.keys())}")
|
|
|
|
return True
|
|
else:
|
|
logger.error(f"❌ Request failed: {response.status_code}")
|
|
logger.error(f"Response: {response.text}")
|
|
return False
|
|
|
|
except Exception as e:
|
|
logger.error(f"❌ Debug failed: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
return False
|
|
|
|
def main():
|
|
print("=" * 80)
|
|
print("🔍 SPOTIFY RESPONSE DEBUG")
|
|
print("=" * 80)
|
|
|
|
success = debug_spotify_response()
|
|
|
|
print("\n" + "=" * 80)
|
|
if success:
|
|
print("✅ Debug completed - check output for available fields")
|
|
else:
|
|
print("❌ Debug failed")
|
|
print("=" * 80)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|