Python script to download complete discography from tracks.json data file. Creates organized album directories with cover images and MP3 tracks. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
32 lines
1.2 KiB
Markdown
32 lines
1.2 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project Overview
|
|
|
|
A Python script to download Dopo Goto's complete discography. Parses `tracks.json` (JavaScript object notation with unquoted keys), creates album directories, and downloads cover images and MP3 tracks with rate limiting.
|
|
|
|
## Running the Script
|
|
|
|
```bash
|
|
python3 download_tracks.py
|
|
```
|
|
|
|
Dependencies: `requests` (standard library: `os`, `re`, `json`, `time`, `random`, `urllib.parse`)
|
|
|
|
## Architecture
|
|
|
|
**Single-file script** with these key functions:
|
|
|
|
- `parse_js_object()` - Converts JS object notation to valid JSON by quoting keys, removing trailing commas, and wrapping the albums list in an array
|
|
- `download_file()` - Streams downloads with timeout handling
|
|
- `main()` - Orchestrates album/track iteration with skip-existing logic and random delays (0.5-3s)
|
|
|
|
**Data flow:** `tracks.json` → parse → iterate albums → create `Dopo Goto - {name}/` directories → download `cover.{ext}` + track MP3s
|
|
|
|
## Key Behaviors
|
|
|
|
- Skips existing files (resume-friendly)
|
|
- Extracts filenames from URLs via `urllib.parse.unquote()`
|
|
- Cover images renamed to `cover.{ext}` based on URL extension
|