# CLAUDE.md

Music collection organization guide for `/home/mb/Sync/Music/`

## Directory Structure

**Required format**: `Artist/YEAR - Album Title/`
- Example: `Moby/1999 - Play/`
- Multi-CD: `Moby/1999 - Play/CD1/`

**Rules**:
- Artist name: Use official capitalization from MusicBrainz/Discogs
- Year: Original release year (4 digits), not reissue year
- Album title: Full official title
- No brackets/parentheses/format info in folder names
- Keep format info (FLAC, MP3) in file metadata only

## Files

- Tracks: `## - Track Title.ext` or `Artist - Album - ## Track Title.ext`
- Cover art: `cover.jpg` (REQUIRED for MPD - not folder.jpg or front.jpg)
- Metadata: `foo_dr.txt`, `.cue`, `.log`
- Playlists: `.m3u` or `.m3u8`

## Quick Import

When user runs `claude -p "import ~/Downloads/album.zip"` or `import /path/to/album`:

```bash
# Import album from directory or archive
# 1. Check metadata: ffprobe -v quiet -print_format json -show_format "track.flac" | jq '.format.tags'
# 2. Artist name: Remove "The" prefix from metadata (e.g., "The Bloodhound Gang" → "Bloodhound Gang")
# 3. Create directory: mkdir -p "Artist/YEAR - Album Title/"
# 4. Move files: mv source/* "Artist/YEAR - Album Title/"
# 5. Find album art online if missing - search Wikipedia or album art databases
#    wget -O cover.jpg "https://url-to-album-art"
# 6. DO NOT update MPD - user will do this manually
```

### Common artist name fixes
- "The Bloodhound Gang" → "Bloodhound Gang"
- Remove "(DE Promo)", "(US Edition)" etc from album titles
- Fix metadata using ffmpeg: `for file in *.{flac,mp3,m4a}; do [ -f "$file" ] && ffmpeg -i "$file" -metadata artist="Correct Artist" -c copy -y "${file%.*}_temp.${file##*.}" && mv "${file%.*}_temp.${file##*.}" "$file"; done`

## Maintenance

### Check metadata
```bash
ffprobe -v quiet -print_format json -show_format "file.flac" | jq '.format.tags'
```

### Fix artist duplicates
```bash
find . -maxdepth 1 -iname "*artist*" -type d  # Find variations
mv "old_name/*" "Artist/"  # Consolidate
```

### Album art
- Must be named `cover.jpg` for MPD
- Multi-CD albums need cover in each CD folder

## References
- Artist names: MusicBrainz, Discogs
- Release years: Original release date
- Metadata: ARTIST, ALBUMARTIST, DATE, ALBUM

## Important Notes
- This is NOT a code repository - it's a music collection
- MPD client: `rmcp`
- Preferred format: FLAC (lossless)
- Lives in Portugal (consider Portuguese artists for recommendations)
- Always verify artist names/album titles/years from authoritative sources
- STRICTLY follow the `Artist/YEAR - Album Title/` directory structure
- For albums in root (e.g., `2023 - Angel Face/`), identify artist and move to proper structure
- Compilation albums: Use "Various Artists" as artist folder

