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.2.tar.gz (28.3 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.2-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: red_plex-1.10.2.tar.gz
  • Upload date:
  • Size: 28.3 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.2.tar.gz
Algorithm Hash digest
SHA256 7009b7fee939dc27c07fa164c34995aad84a9cfb9b1976b0bfa3c9a21fbca12f
MD5 b39f3c3f3e82bae2195dab0a7410ff02
BLAKE2b-256 75f0e3a863d557a307a8230b6a64543bf82ab65c3c7abe024fbca6937d17bc53

See more details on using hashes here.

File details

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

File metadata

  • Download URL: red_plex-1.10.2-py3-none-any.whl
  • Upload date:
  • Size: 32.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 17eca8b5870b6f3e4bd7670ffc661e3e819e303ff1b29b22f1f8b0aecb6d8d63
MD5 736c9f11b7ba313171955b97d0bd55d6
BLAKE2b-256 b5f73c260eed3125da046996262f9e8ac115a8e42f0133f86d0c40764bef1cbb

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