Skip to main content

A tool for creating Plex playlists or collections from RED collages

Project description

red-plex

red-plex is a command-line tool for creating and updating Plex collections based on collages and bookmarks from Gazelle-based music trackers (Redacted “RED” and Orpheus “OPS”). It stores all data in a local SQLite database and provides commands to synchronize your music library with Plex and the torrent data from these trackers.

Table of Contents


Overview

  • Stores Data in SQLite: Instead of CSV-based “caches,” red-plex now stores albums, collages, and bookmarks in a lightweight SQLite database.
  • Collages & Bookmarks: Fetch and manage torrent-based “collages” or personal “bookmarks” from Gazelle-based sites.
  • Plex Integration: Compare the torrent group info with your Plex music library to create or update Plex collections.
  • Flexible Album Matching: Match albums in Plex using either the original torrent_name (directory name) or a query-based approach (Artist/Album), ideal for organized libraries (e.g., Beets/Lidarr).
  • Incremental Updating: Update previously created collections as new albums become available or site data changes.

Features

  • Multi-Site: Works with Redacted (“red”) and Orpheus Network (“ops”).
  • Collections from Collages/Bookmarks: Create or update entire Plex collections for each collage or bookmarked set.
  • Local SQLite Database: All data (albums, collages, bookmarks) is kept in one DB, no more CSV.
  • Two Fetch Modes: Choose between torrent_name (default) for direct path matching or query for metadata-based searches in Plex.
  • Configurable Logging: Choose between INFO, DEBUG, etc., in config.yml.
  • Rate Limiting: Respects site rate limits and retries on errors.
  • Simple CLI: All major tasks are accessed via subcommands like collages, bookmarks, db, etc.
  • Python 3.8+ Compatible: Runs on modern Python versions with no external database dependencies.

Installation

Install via pip:

pip install red-plex

Or use pipx for an isolated environment:

pipx install red-plex

Usage & Commands

Type red-plex --help for detailed usage. Below is a summary of the main commands.

Configuration Commands

# Show current configuration (YAML)
red-plex config show

# Edit configuration in your default editor
red-plex config edit

# Reset configuration to default values
red-plex config reset

Collages

# Create Plex collections for specific collage IDs
red-plex collages convert [COLLAGE_IDS] --site [red|ops] --fetch-mode [torrent_name|query]

# Update all collages in the database, re-checking the site data
red-plex collages update --fetch-mode [torrent_name|query]

Bookmarks

# Create Plex collections from your bookmarked releases
red-plex bookmarks convert --site [red|ops] --fetch-mode [torrent_name|query]

# Update all bookmarks in the database
red-plex bookmarks update --fetch-mode [torrent_name|query]

Fetch Mode (-fm)

The --fetch-mode (or -fm) option controls how red-plex locates albums in Plex:

  • torrent_name (default): Searches for directories matching the torrent folder name.
  • query: Searches using Artist and Album metadata, ideal for organized libraries managed by tools like Beets or Lidarr.

This option applies to collages convert, collages update, bookmarks convert, and bookmarks update. Defaults to torrent_name if omitted.

Database Commands

# Show database location
red-plex db location

# Manage albums table
red-plex db albums reset        # Clear all album records
red-plex db albums update       # Pull fresh album info from Plex

# Manage collections table
red-plex db collections reset   # Clear the collage collections table

# Manage bookmarks table
red-plex db bookmarks reset     # Clear the bookmark collections table

Examples

Creating Collections

# Single collage (Redacted), default mode
red-plex collages convert 12345 --site red

# Multiple collages (Orpheus), default mode
red-plex collages convert 1111 2222 3333 --site ops

# From bookmarks (RED or OPS), default mode
red-plex bookmarks convert --site red

Updating Collections

# Update all stored collages
red-plex collages update

# Update all stored bookmarks
red-plex bookmarks update

# Update albums from Plex
red-plex db albums update

Using Query Fetch Mode

# Create a collection using query mode
red-plex collages convert 12345 --site red --fetch-mode query

# Update all bookmarks using query mode
red-plex bookmarks update --site ops -fm query

Configuration Details

By default, configuration is stored in ~/.config/red-plex/config.yml:

LOG_LEVEL: INFO
OPS:
  API_KEY: your_ops_api_key_here
  BASE_URL: https://orpheus.network
  RATE_LIMIT:
    calls: 4
    seconds: 15
PLEX_TOKEN: your_plex_token_here
PLEX_URL: http://localhost:32400
RED:
  API_KEY: your_red_api_key_here
  BASE_URL: https://redacted.sh
  RATE_LIMIT:
    calls: 10
    seconds: 10
SECTION_NAME: Music

Configuration Tips

  • If HTTP fails, fetch an HTTPS URL:
    https://plex.tv/api/resources?includeHttps=1&X-Plex-Token={YOUR_TOKEN}
    
  • Look for the <Device> node in the XML for a uri, use this plex.direct address.

Considerations

  • Album Matching:
    • torrent_name (default): Matches folder paths.
    • query: Uses metadata for reliable matching in renamed libraries.
  • Database: All data in red_plex.db. Reset tables with db albums reset, etc.
  • Site Credentials: Ensure valid API keys in config.yml.
  • Rate Limits: Adheres to site-specific settings.
  • Logging: Use DEBUG for verbose logs or WARNING for less output.
  • Updates: collages update and bookmarks update add new albums but do not remove existing items in Plex.

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

red_plex-1.10.3.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

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

red_plex-1.10.3-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file red_plex-1.10.3.tar.gz.

File metadata

  • Download URL: red_plex-1.10.3.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for red_plex-1.10.3.tar.gz
Algorithm Hash digest
SHA256 ab60ee546dcedb1d4a7aa253ec4ccbc5c0d2280178d5c727cc28b2d17d5998b9
MD5 1f211e4b69e78e44875d1704dabc70e7
BLAKE2b-256 bdd44b86210a6ce7b7f545d1ad0bdfd2374f259a31cb4988db1480fe7ccce57f

See more details on using hashes here.

File details

Details for the file red_plex-1.10.3-py3-none-any.whl.

File metadata

  • Download URL: red_plex-1.10.3-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for red_plex-1.10.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3e58fbd10649399155de2499859d27d8ddfe5d4658e9bf10340b0a2f7127d815
MD5 c6f008a3b3bf7c63e4e2a998f9318d27
BLAKE2b-256 ac460d1a6af990aa85e7286fde5243cf86081e05ea0e0a4743fdd96ffca2c639

See more details on using hashes here.

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