Metadata-Version: 2.4
Name: songchro
Version: 0.2.0
Summary: Synchronize playlists between iTunes and Plex
License: MIT
License-File: LICENSE
Author: Adam Brown
Author-email: acourtneybrown@gmail.com
Requires-Python: >=3.13
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Dist: click (>=8.2.1,<9.0.0)
Requires-Dist: multimethod (>=2.0,<3.0)
Requires-Dist: mutagen (>=1.47.0,<2.0.0)
Requires-Dist: plexapi (>=4.17.0,<5.0.0)
Requires-Dist: py-applescript (>=1.0.3,<2.0.0) ; sys_platform == "darwin"
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
Requires-Dist: requests (>=2.32.4,<3.0.0)
Requires-Dist: simpleeval (>=1.0,<2.0)
Requires-Dist: spotipy (>=2.25.1,<3.0.0)
Requires-Dist: structlog (==26.1.0)
Project-URL: Homepage, https://github.com/NotCharlie/songchro
Project-URL: Repository, https://github.com/NotCharlie/songchro
Description-Content-Type: text/markdown

# songchro

Synchronize playlists between iTunes and Plex

## Installation

```bash
# Clone the repository
git clone https://github.com/acourtneybrown/songchro.git
cd songchro

# Install the package in development mode
pip install -e .
```

## Configuration

Songchro uses a configuration file located at `~/.config/songchro/config.yml`. This file contains settings for the different music libraries and general options.

### Configuration File Structure

```yaml
# Default logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
logging: INFO

# File library configuration
file:
  # Root directory for playlist files
  root: ~/playlists
  # Root directory for music files
  music_root: ~/Music

# iTunes library configuration
itunes:
  # Path to iTunes Library XML file
  xml: ~/Music/iTunes/iTunes Library.xml
  # Root directory for music files
  music_root: ~/Music/iTunes/iTunes Media/Music

# Plex library configuration
plex:
  # Root directory for music files
  music_root: /music
  # Plex music section name (default is "Music")
  section: Music
  # Authentication options (use either username/password/server or baseurl/token)
  username: your_username
  password: your_password
  server: your_server_name
  # Alternative authentication
  baseurl: http://plex-server:32400
  token: your_plex_token
```

## Usage

The `songchro` CLI tool provides commands to work with Apple Music, iTunes, Plex, and local file playlists.

### General Options

Options that apply to all commands:

```bash
# Show help
songchro --help

# Show version
songchro --version

# Enable debug level logging
songchro --logging-level DEBUG [COMMAND]

# Enable info level logging
songchro --logging-level INFO [COMMAND]

# Use a specific config file
songchro --config /path/to/config.yml [COMMAND]
```

### File Commands

```bash
# List file playlists
songchro file list

# Include list of song tracks in each playlist
songchro file list --songs

# Simplified output for using in pipelines
songchro file list --simple

# Filter by playlist kind (plain, folder, smart, all)
songchro file list --kind plain

# Update metadata for playlists in a subdirectory
songchro file update-meta [subdir]

# Migrate a playlist
songchro file migrate "My Playlist"
```

### Apple Music Commands

```bash
# List Apple Music playlists
songchro apple list

# Include list of song tracks in each playlist
songchro apple list --songs

# Simplified output for using in pipelines
songchro apple list --simple

# Filter by playlist kind (plain, folder, smart, all)
songchro apple list --kind plain

# Export an Apple Music playlist to the local library
songchro apple export "My Playlist"

# Export with dry run (no changes)
songchro apple export "My Playlist" --dry-run
```

### iTunes Commands

```bash
# List iTunes playlists
songchro itunes list

# Include list of song tracks in each playlist
songchro itunes list --songs

# Simplified output for using in pipelines
songchro itunes list --simple

# Filter by playlist kind (plain, folder, smart, all)
songchro itunes list --kind plain

# Export an iTunes playlist to the local library
songchro itunes export "My Playlist"

# Export with dry run (no changes)
songchro itunes export "My Playlist" --dry-run

# Export all iTunes playlists
songchro itunes export_all

# Export all with dry run (no changes)
songchro itunes export_all --dry-run
```

### Plex Commands

Plex commands support an OTP code option at the group level:

```bash
# Use OTP code for Plex authentication (applies to all plex subcommands)
songchro plex --code "123456" [COMMAND]

# List Plex playlists
songchro plex list

# Include list of song tracks in each playlist
songchro plex list --songs

# Simplified output for using in pipelines
songchro plex list --simple

# Filter by playlist kind (plain, folder, smart, all)
songchro plex list --kind plain

# Export a Plex playlist to the local library
songchro plex export "My Playlist"

# Export with dry run (no changes)
songchro plex export "My Playlist" --dry-run

# Export all Plex playlists
songchro plex export_all

# Export all with dry run (no changes)
songchro plex export_all --dry-run

# Find tracks in Plex
songchro plex find --song-file "/path/to/song.json"
songchro plex find --title "Song Title" --artist "Artist Name"
songchro plex find --album "Album Name" --album-artist "Album Artist"
songchro plex find --filepath "/path/to/music/file.mp3"

# Import a playlist to Plex
songchro plex import "My Playlist"

# Import with dry run (no changes)
songchro plex import "My Playlist" --dry-run
```

### Sync Playlists

```bash
# Synchronize playlists (defaults: file -> plex)
songchro sync "My Playlist"

# Specify source and destination types
songchro sync "My Playlist" --source-type plex --destination-type file
songchro sync "My Playlist" --from plex --to file

# Supported types: itunes, plex, file, apple_music

# Dry run (no changes)
songchro sync "My Playlist" --dry-run

# Use OTP code for Plex authentication
songchro sync "My Playlist" --code "123456"
```

### Sync Plays

```bash
# Synchronize play counts
songchro sync-plays

# Dry run (no changes)
songchro sync-plays --dry-run

# Use OTP code for Plex authentication
songchro sync-plays --code "123456"

# Skip calling increase_plays
songchro sync-plays --skip-increase
```

### Map Tracks

```bash
# Map tracks between platforms
songchro map-tracks

# Specify source and destination types
songchro map-tracks --from itunes --to plex

# Supported types: itunes, plex, file, apple_music

# Use OTP code for Plex authentication
songchro map-tracks --code "123456"
```

### Shell Completion

```bash
# Generate shell completion script
songchro completion --shell bash
songchro completion --shell zsh
songchro completion --shell fish
```
