Skip to main content

๐ŸŽต Plex2Mix - A powerful Plex music downloader designed for DJs and music enthusiasts. Download playlists locally with track deduplication, export to multiple formats (M3U8, JSON, iTunes XML), and manage your music library with an intuitive interactive CLI. Perfect for importing into Rekordbox, Traktor, Mixxx, or iTunes.

Project description

Plex2Mix

Plex2Mix is a Plex music downloader geared towards DJs that self-host their music on a Plex server. It allows downloading selected playlists locally on your computer and exports them in multiple formats including m3u8, json, and iTunes-compatible xml. This is meant to ease the import to DJ software such as Rekordbox, Traktor, Mixxx, or iTunes.

Why not using Plexamp download feature?

By the time of writing, several reasons make Plexamp unsuitable for DJs:

  • Plexamp downloads are not meant to be used by third-party apps.
  • Plexamp downloaded playlists are limited to a certain duration for efficiency.
  • Plexamp may duplicate tracks that are member of multiple playlists.
  • Plexamp dumps playlist information in a json file that does not contain the playlist title.
  • The exported format (json) is not universally recognized by DJ softwares.

Plexamp team is however very reactive in implementing features, the above mentioned limitations might not hold in the future.

Features

  • Multiple Export Formats: Support for M3U8, JSON, and iTunes XML formats
  • Smart Track Deduplication: Tracks shared between playlists are only downloaded once
  • iTunes Library Management: Creates a single iTunes library file that can be imported into iTunes or other compatible players
  • Concurrent Downloads: Multi-threaded downloading for faster sync
  • Playlist Management: Track which playlists are downloaded, ignored, or need refreshing
  • Incremental Updates: Only download new or changed tracks when refreshing playlists
  • Interactive Mode: Full-featured interactive shell for easy playlist management
  • Beautiful CLI: ASCII art banner and colorful, intuitive interface
  • Conditional Logging: Silent by default, verbose logging available for debugging
  • Smart File Handling: Automatic directory creation and file organization

Installation

From PyPI

The easiest way to install Plex2Mix is using the PyPI package directly:

pip install plex2mix

Manual installation

You must clone the repository locally and execute:

python setup.py install --user

Alternatively, you can install the requirements and run directly:

pip install -r requirements.txt

Usage

Interactive Mode

Simply run plex2mix without any arguments to enter the interactive mode:

$ plex2mix

    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—
    โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•
    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—   โ•šโ–ˆโ–ˆโ–ˆโ•”โ•  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ•”โ•
    โ–ˆโ–ˆโ•”โ•โ•โ•โ• โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ•   โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ•โ•โ• โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•—
    โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ โ•šโ•โ• โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ•—
    โ•šโ•โ•     โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•     โ•šโ•โ•โ•šโ•โ•โ•šโ•โ•  โ•šโ•โ•

    ๐ŸŽต Plex Music Downloader for DJs ๐ŸŽง
    Convert your Plex playlists to DJ-ready formats

๐ŸŽ›๏ธ  Welcome to plex2mix Interactive Mode!
Type 'help' for available commands or 'quit' to exit.

plex2mix > help
plex2mix > list
plex2mix > download 0 1 2
plex2mix > status
plex2mix > quit

Command Line Mode

During the first execution of Plex2Mix, you will be prompted to login using the provided PIN. You will be asked where to store your music library, to enter the number of concurrent downloads (number of threads), and to select your preferred export formats.

$ plex2mix list
Visit https://plex.tv/link and enter the code: 4VPT
Waiting for authorization...
Logged in as Anatosun
0: Server (b95d611c640365fcbd07vf960b19fdadb966c021)
Select your server [0]:
Connected to Server
Enter path to download to [~/Music]: ~/Music/plex2mix
Enter number of download threads [4]: 4
Select export formats (comma-separated, e.g., m3u8,itunes) [m3u8]: m3u8,itunes

List your playlists with color-coded status:

$ plex2mix list
0: โค๏ธ Tracks
1: Favs (saved)
2: Good old tracks (saved)
3: Bad (ignored)

Download specific playlists:

plex2mix download 0 1

Download all playlists:

plex2mix download --all

Overwrite existing files during download:

plex2mix download --overwrite 0 1

Ignore playlists from bulk operations:

plex2mix ignore 3

Refresh saved playlists:

plex2mix refresh

Force refresh (overwrite existing files):

plex2mix refresh --force

View current configuration and status:

plex2mix config
plex2mix status  # Available in interactive mode

Reset configuration:

plex2mix reset

Verbose Logging

Enable detailed logging for debugging or monitoring:

plex2mix --verbose list
plex2mix --verbose download 0 1
plex2mix --verbose refresh --force

This will show detailed information about:

  • Authentication and server connection
  • Playlist discovery and track processing
  • Download decisions (skip/download/overwrite)
  • Export operations and file creation
  • iTunes library management and deduplication

Interactive Mode Commands

The interactive mode supports all CLI commands plus additional features:

๐Ÿ“‹ Playlist Management:
  list, ls                    - List all playlists
  download [indices] [-a] [-o] - Download playlists
  refresh [-f]                - Refresh saved playlists
  ignore [indices]            - Ignore playlists
  status                      - Show current status

โš™๏ธ  Configuration:
  config                      - Show current configuration
  reset                       - Reset configuration

๐ŸŽ›๏ธ  Interactive:
  help, h, ?                  - Show this help
  clear, cls                  - Clear screen
  quit, exit, q               - Exit interactive mode

Examples:

plex2mix > download 0 1 2      # Download specific playlists
plex2mix > download -a -o      # Download all with overwrite
plex2mix > refresh -f          # Force refresh saved playlists
plex2mix > ignore 3            # Ignore playlist 3

Help and Documentation

For complete command reference:

$ plex2mix --help
Usage: plex2mix [OPTIONS] COMMAND [ARGS]...

  plex2mix CLI

Options:
  -v, --verbose  Enable verbose logging
  --help         Show this message and exit.

Commands:
  config    Show config
  download  Download playlists
  ignore    Ignore playlists
  list      List playlists
  refresh   Refresh saved playlists
  reset     Reset configuration

Export Formats

M3U8 Format

Creates individual .m3u8 files for each playlist in the playlists directory. Compatible with most DJ software and media players.

Features:

  • Standard M3U8 extended format with track durations
  • Artist and title information in track entries
  • Direct file path references for local playback

JSON Format

Creates individual .json files for each playlist containing detailed track metadata.

Features:

  • Complete track metadata (title, artist, album, duration, path)
  • Human-readable format for custom integrations
  • Easy parsing for third-party applications

iTunes Format

Creates a single iTunes Library.xml file that contains all tracks and playlists. This format:

  • Creates a central track database with unique Track IDs
  • Playlists reference tracks by ID
  • Updates preserve existing tracks and only add new ones
  • Maintains iTunes-standard XML structure for maximum compatibility

Configuration

Most of the information provided on the first execution can be changed by editing the config.yaml located under ~/.config/plex2mix/ on Linux and under the default location on other operating systems.

Example configuration:

export_formats:
  - m3u8
  - itunes
path: /home/user/Music/plex2mix
playlists:
  ignored: []
  saved: []
playlists_path: /home/user/Music/plex2mix/playlists
server:
  name: My Plex Server
  url: http://192.168.1.100:32400
threads: 4
token: your_plex_token_here

Configuration Options

  • export_formats: List of formats to export (m3u8, json, itunes)
  • path: Base directory for downloaded music
  • playlists_path: Directory for playlist files
  • threads: Number of concurrent download threads
  • playlists.saved: Track IDs of downloaded playlists
  • playlists.ignored: Track IDs of ignored playlists
  • server: Plex server connection details
  • token: Plex authentication token

Directory Structure

Your downloaded music will be organized as follows:

~/Music/plex2mix/
โ”œโ”€โ”€ playlists/
โ”‚   โ”œโ”€โ”€ My Playlist.m3u8      # M3U8 playlist files
โ”‚   โ”œโ”€โ”€ Another Playlist.json # JSON playlist files
โ”‚   โ””โ”€โ”€ iTunes Library.xml    # Single iTunes library
โ”œโ”€โ”€ Artist Name/              # Music organized by artist
โ”‚   โ””โ”€โ”€ Album Name/           # Then by album
โ”‚       โ”œโ”€โ”€ 01 Track Name.flac
โ”‚       โ””โ”€โ”€ 02 Another Track.flac
โ””โ”€โ”€ Another Artist/
    โ””โ”€โ”€ Album/
        โ””โ”€โ”€ Track.mp3

File Organization

  • Music Files: Organized in Artist/Album/Track hierarchy
  • Playlist Files: Stored in dedicated playlists/ directory
  • iTunes Library: Single XML file containing all tracks and playlists
  • Original Filenames: Preserved from Plex server
  • Automatic Cleanup: Missing directories created automatically

Advanced Features

Smart Download Logic

  • Skip Existing: Files already downloaded are automatically skipped
  • Resume Incomplete: Partially downloaded files are completed
  • Size Verification: Compares local and server file sizes
  • Overwrite Control: Manual control over file replacement
  • Thread Safety: Concurrent downloads with proper error handling

Playlist State Management

  • Saved Playlists: Automatically tracked for easy refresh
  • Ignored Playlists: Excluded from bulk operations
  • Status Tracking: Visual indicators in playlist listings
  • Persistent State: Configuration saved automatically

Error Handling

  • Graceful Failures: Individual track failures don't stop entire downloads
  • Retry Logic: Built-in handling for temporary network issues
  • Progress Tracking: Real-time progress bars for download operations
  • Detailed Logging: Comprehensive error reporting in verbose mode

Requirements

  • Python 3.8+: Modern Python with type hints support
  • PlexAPI: Unofficial Plex API client library
  • Click: Command-line interface framework
  • PyYAML: Configuration file handling
  • Concurrent.futures: Built-in threading support

Troubleshooting

Common Issues

Authentication Problems:

plex2mix reset  # Clear saved credentials
plex2mix --verbose list  # Check connection details

Download Issues:

plex2mix --verbose download 0  # See detailed download process
plex2mix download --overwrite 0  # Force redownload

Permission Errors:

  • Ensure write access to download directory
  • Check available disk space
  • Verify Plex server accessibility

Debug Mode

Use --verbose flag for detailed operation logging:

  • Authentication and server connection details
  • Individual track download decisions
  • Export format processing
  • iTunes library management operations
  • Error details and stack traces

Getting Help

  1. Check this README for usage examples
  2. Use plex2mix --help for command reference
  3. Try plex2mix --verbose for detailed operation info
  4. Use interactive mode help command for quick reference

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plex2mix-1.0.2.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plex2mix-1.0.2-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file plex2mix-1.0.2.tar.gz.

File metadata

  • Download URL: plex2mix-1.0.2.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for plex2mix-1.0.2.tar.gz
Algorithm Hash digest
SHA256 6c491c5e365b445c2918c3bc045f2c1108f7d42c53db3fe7388706abb505982b
MD5 c87ad665df03d69a87d8d81a61583e0f
BLAKE2b-256 2600582ca86744d704c8022bf90a2ccb4bdae51d32ecfb56622e10c2487a81b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for plex2mix-1.0.2.tar.gz:

Publisher: publish.yml on anatosun/plex2mix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file plex2mix-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: plex2mix-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for plex2mix-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bce59cdc3cd4949537c824233498c712cc9fad1d50e974873819754c522abead
MD5 43c4235a3230b362cefd46a749286d11
BLAKE2b-256 9101ad6054564b312779f98bf8b9f1e31c6cd587a4f216c13b5da23167247fd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for plex2mix-1.0.2-py3-none-any.whl:

Publisher: publish.yml on anatosun/plex2mix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page