#!/usr/bin/env python3 """Analyze what's happening with the playlist download.""" import json # Check the saved playlist playlist_file = 'playlists/server_playlist_v8.json' print("=" * 80) print("SAVED PLAYLIST ANALYSIS") print("=" * 80) with open(playlist_file, 'r') as f: data = json.load(f) print(f"\nVersion: {data.get('version', 'N/A')}") print(f"Items in playlist: {len(data.get('playlist', []))}") print("\nPlaylist items:") for idx, item in enumerate(data.get('playlist', []), 1): print(f"\n{idx}. File: {item.get('file_name', 'N/A')}") print(f" URL: {item.get('url', 'N/A')}") print(f" Duration: {item.get('duration', 'N/A')}s") print("\n" + "=" * 80) print("\n⚠️ ISSUE: Server has 5 files, but only 3 are saved!") print("\nPossible reasons:") print("1. Server sent only 3 files") print("2. 2 files failed to download and were skipped") print("3. Download function has a bug") print("\nThe download_media_files() function in get_playlists_v2.py:") print("- Downloads from the 'url' field in the playlist") print("- If download fails, it SKIPS the file (continues)") print("- Only successfully downloaded files are added to updated_playlist") print("\nThis means 2 files likely had invalid URLs or download errors!") print("=" * 80)