red-plex


Namered-plex JSON
Version 1.7.1 PyPI version JSON
download
home_pagehttps://github.com/marceljungle/red-plex
SummaryA tool for creating Plex playlists or collections from RED collages
upload_time2024-12-19 21:08:00
maintainerNone
docs_urlNone
authormarceljungle
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements plexapi requests pyrate-limiter tenacity click pyyaml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # red-plex

**red-plex** is a command-line tool for creating and updating Plex playlists and collections based on collages and bookmarks from Gazelle-based music trackers like Redacted (RED) and Orpheus Network (OPS). It allows users to generate playlists and collections in their Plex Media Server by matching music albums from specified collages or personal bookmarks, and provides ways to synchronize previously created items with updated information.

## Table of Contents

- [Overview](#overview)
- [Features](#features)
- [Commands](#commands)
  - [Convert Commands](#convert-commands)
  - [Playlist Management](#playlist-management)
  - [Collection Management](#collection-management)
  - [Bookmark Management](#bookmark-management)
  - [Album Cache Management](#album-cache-management)
  - [Configuration](#configuration-commands)
- [Examples](#examples)
  - [Creating Playlists and Collections](#creating-playlists-and-collections)
  - [Updating Existing Items](#updating-existing-items)
- [Configuration](#configuration-root)
  - [Configuration Tips](#configuration-tips)
- [Considerations](#considerations)

## Overview

- **Library Scanning**: The application scans the folder structure of your Plex music library, extracting album paths to create a local cache for efficient matching.
- **Fetching Collages**: It connects to a Gazelle-based site using API credentials to fetch collages or bookmarks, retrieving torrent paths for the albums listed.
- **Matching Albums**: The app compares the torrent paths from the site with the album paths in the Plex library, identifying matching albums based on folder names.
- **Creating Playlists/Collections**: For each collage or bookmark, it creates corresponding Plex playlists or collections containing all matched albums.
- **Cache Management**: Album, playlist, and collection data are cached to avoid redundant scanning and enable incremental updates.

## Features

- **Multi-Site Support**: Create Plex playlists and collections from both Redacted and Orpheus Network
- **Playlist and Collection Creation**: Generate both playlists and collections from collages and bookmarks
- **Multiple Collage IDs**: Support for processing multiple collage IDs in a single command
- **Optimized Album Caching**: Album cache includes timestamps for incremental updates
- **Cache Management**: Track processed playlists and collections for automatic updating
- **Automatic Updates**: Synchronize all cached items with their source collages
- **Configurable Logging**: Adjust logging level via configuration file
- **Easy Configuration**: Simple setup using a `config.yml` file
- **Command-Line Interface**: User-friendly CLI with comprehensive commands
- **Rate Limiting and Retries**: Handles API rate limiting with retries for failed calls
- **Python 3 Compatible**: Works with Python 3.7 and above

## Commands

### Convert Commands
```bash
# Create playlist from collage
red-plex convert playlist [COLLAGE_IDS] --site SITE

# Create collection from collage
red-plex convert collection [COLLAGE_IDS] --site SITE
```

### Playlist Management
```bash
# Show playlist cache location
red-plex playlists cache show

# Reset playlist cache
red-plex playlists cache reset

# Update all cached playlists
red-plex playlists update
```

### Collection Management
```bash
# Show collection cache location
red-plex collections cache show

# Reset collection cache
red-plex collections cache reset

# Update all cached collections
red-plex collections update
```

### Bookmark Management
```bash
# Create playlist from bookmarks
red-plex bookmarks create playlist --site SITE

# Create collection from bookmarks
red-plex bookmarks create collection --site SITE

# Update bookmark playlists
red-plex bookmarks update playlist

# Update bookmark collections
red-plex bookmarks update collection

# Show bookmark cache (playlist)
red-plex bookmarks cache playlist show

# Reset bookmark cache (playlist)
red-plex bookmarks cache playlist reset

# Show bookmark cache (collection)
red-plex bookmarks cache collection show

# Reset bookmark cache (collection)
red-plex bookmarks cache collection reset
```

### Album Cache Management
```bash
# Show cache location
red-plex album-cache show

# Reset cache
red-plex album-cache reset

# Update cache
red-plex album-cache update
```

### Configuration (Commands)
```bash
# Show current configuration
red-plex config show

# Edit configuration
red-plex config edit

# Reset configuration
red-plex config reset
```

## Examples

### Creating Playlists and Collections
```bash
# Create playlists from collages
red-plex convert playlist 12345 67890 --site red

# Create collections from collages
red-plex convert collection 12345 67890 --site red

# Create playlist from bookmarks
red-plex bookmarks create playlist --site red

# Create collection from bookmarks
red-plex bookmarks create collection --site red
```

### Updating Existing Items
```bash
# Update all playlists
red-plex playlists update

# Update all collections
red-plex collections update

# Update bookmark playlists
red-plex bookmarks update playlist

# Update bookmark collections
red-plex bookmarks update collection
```

## Configuration (Root)

The configuration file (`~/.config/red-plex/config.yml`) should contain:

```yaml
PLEX_URL: 'http://localhost:32400'
PLEX_TOKEN: 'your_plex_token_here'
SECTION_NAME: 'Music'
LOG_LEVEL: 'INFO'

RED:
  API_KEY: 'your_red_api_key_here'
  BASE_URL: 'https://redacted.sh'
  RATE_LIMIT:
    calls: 10
    seconds: 10

OPS:
  API_KEY: 'your_ops_api_key_here'
  BASE_URL: 'https://orpheus.network'
  RATE_LIMIT:
    calls: 4
    seconds: 15
```

### Configuration Tips
If you encounter issues accessing your Plex server via `http`, like this exception:

```xml
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
```

You can use the following method to retrieve the secure `https` URL for local access without additional configuration:

Use the following API call, replacing `{TOKEN}` with your Plex token:
```text
https://plex.tv/api/resources?includeHttps=1&X-Plex-Token={TOKEN}
```

This will return an XML response, including the full https URL:
```xml
<MediaContainer size="5">
  <Device name="Your Server Name" product="Plex Media Server" ...>
    <Connection protocol="https" address="192.168.x.x" port="32400" 
      uri="https://192-168-x-x.0123456789abcdef0123456789abcdef.plex.direct:32400" local="1"/>
    ...
  </Device>
  ...
</MediaContainer>
```
Thanks anonysmussi for pointing this out!

## Considerations

- **Album Matching**: Ensure proper music library organization with matching folder names
- **Cache Management**: Regular cache updates improve performance and accuracy
- **API Rate Limits**: Be mindful of site-specific rate limits
- **Required Credentials**: Valid API keys needed in configuration
- **Site Specification**: The `--site` option is mandatory for relevant commands
- **Logging Levels**: Adjust verbosity in configuration as needed
- **Cache Tracking**: Separate caches for playlists, collections, and bookmarks enable independent updates
- **Update Process**: Updates add new items while maintaining existing ones

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/marceljungle/red-plex",
    "name": "red-plex",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "marceljungle",
    "author_email": "gigi.dan2011@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/47/74/bca933cb6c8adb54a1feaf5dec67a39bd876706428f3938ab013a65f6c2b/red_plex-1.7.1.tar.gz",
    "platform": null,
    "description": "# red-plex\n\n**red-plex** is a command-line tool for creating and updating Plex playlists and collections based on collages and bookmarks from Gazelle-based music trackers like Redacted (RED) and Orpheus Network (OPS). It allows users to generate playlists and collections in their Plex Media Server by matching music albums from specified collages or personal bookmarks, and provides ways to synchronize previously created items with updated information.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Commands](#commands)\n  - [Convert Commands](#convert-commands)\n  - [Playlist Management](#playlist-management)\n  - [Collection Management](#collection-management)\n  - [Bookmark Management](#bookmark-management)\n  - [Album Cache Management](#album-cache-management)\n  - [Configuration](#configuration-commands)\n- [Examples](#examples)\n  - [Creating Playlists and Collections](#creating-playlists-and-collections)\n  - [Updating Existing Items](#updating-existing-items)\n- [Configuration](#configuration-root)\n  - [Configuration Tips](#configuration-tips)\n- [Considerations](#considerations)\n\n## Overview\n\n- **Library Scanning**: The application scans the folder structure of your Plex music library, extracting album paths to create a local cache for efficient matching.\n- **Fetching Collages**: It connects to a Gazelle-based site using API credentials to fetch collages or bookmarks, retrieving torrent paths for the albums listed.\n- **Matching Albums**: The app compares the torrent paths from the site with the album paths in the Plex library, identifying matching albums based on folder names.\n- **Creating Playlists/Collections**: For each collage or bookmark, it creates corresponding Plex playlists or collections containing all matched albums.\n- **Cache Management**: Album, playlist, and collection data are cached to avoid redundant scanning and enable incremental updates.\n\n## Features\n\n- **Multi-Site Support**: Create Plex playlists and collections from both Redacted and Orpheus Network\n- **Playlist and Collection Creation**: Generate both playlists and collections from collages and bookmarks\n- **Multiple Collage IDs**: Support for processing multiple collage IDs in a single command\n- **Optimized Album Caching**: Album cache includes timestamps for incremental updates\n- **Cache Management**: Track processed playlists and collections for automatic updating\n- **Automatic Updates**: Synchronize all cached items with their source collages\n- **Configurable Logging**: Adjust logging level via configuration file\n- **Easy Configuration**: Simple setup using a `config.yml` file\n- **Command-Line Interface**: User-friendly CLI with comprehensive commands\n- **Rate Limiting and Retries**: Handles API rate limiting with retries for failed calls\n- **Python 3 Compatible**: Works with Python 3.7 and above\n\n## Commands\n\n### Convert Commands\n```bash\n# Create playlist from collage\nred-plex convert playlist [COLLAGE_IDS] --site SITE\n\n# Create collection from collage\nred-plex convert collection [COLLAGE_IDS] --site SITE\n```\n\n### Playlist Management\n```bash\n# Show playlist cache location\nred-plex playlists cache show\n\n# Reset playlist cache\nred-plex playlists cache reset\n\n# Update all cached playlists\nred-plex playlists update\n```\n\n### Collection Management\n```bash\n# Show collection cache location\nred-plex collections cache show\n\n# Reset collection cache\nred-plex collections cache reset\n\n# Update all cached collections\nred-plex collections update\n```\n\n### Bookmark Management\n```bash\n# Create playlist from bookmarks\nred-plex bookmarks create playlist --site SITE\n\n# Create collection from bookmarks\nred-plex bookmarks create collection --site SITE\n\n# Update bookmark playlists\nred-plex bookmarks update playlist\n\n# Update bookmark collections\nred-plex bookmarks update collection\n\n# Show bookmark cache (playlist)\nred-plex bookmarks cache playlist show\n\n# Reset bookmark cache (playlist)\nred-plex bookmarks cache playlist reset\n\n# Show bookmark cache (collection)\nred-plex bookmarks cache collection show\n\n# Reset bookmark cache (collection)\nred-plex bookmarks cache collection reset\n```\n\n### Album Cache Management\n```bash\n# Show cache location\nred-plex album-cache show\n\n# Reset cache\nred-plex album-cache reset\n\n# Update cache\nred-plex album-cache update\n```\n\n### Configuration (Commands)\n```bash\n# Show current configuration\nred-plex config show\n\n# Edit configuration\nred-plex config edit\n\n# Reset configuration\nred-plex config reset\n```\n\n## Examples\n\n### Creating Playlists and Collections\n```bash\n# Create playlists from collages\nred-plex convert playlist 12345 67890 --site red\n\n# Create collections from collages\nred-plex convert collection 12345 67890 --site red\n\n# Create playlist from bookmarks\nred-plex bookmarks create playlist --site red\n\n# Create collection from bookmarks\nred-plex bookmarks create collection --site red\n```\n\n### Updating Existing Items\n```bash\n# Update all playlists\nred-plex playlists update\n\n# Update all collections\nred-plex collections update\n\n# Update bookmark playlists\nred-plex bookmarks update playlist\n\n# Update bookmark collections\nred-plex bookmarks update collection\n```\n\n## Configuration (Root)\n\nThe configuration file (`~/.config/red-plex/config.yml`) should contain:\n\n```yaml\nPLEX_URL: 'http://localhost:32400'\nPLEX_TOKEN: 'your_plex_token_here'\nSECTION_NAME: 'Music'\nLOG_LEVEL: 'INFO'\n\nRED:\n  API_KEY: 'your_red_api_key_here'\n  BASE_URL: 'https://redacted.sh'\n  RATE_LIMIT:\n    calls: 10\n    seconds: 10\n\nOPS:\n  API_KEY: 'your_ops_api_key_here'\n  BASE_URL: 'https://orpheus.network'\n  RATE_LIMIT:\n    calls: 4\n    seconds: 15\n```\n\n### Configuration Tips\nIf you encounter issues accessing your Plex server via `http`, like this exception:\n\n```xml\nrequests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))\n```\n\nYou can use the following method to retrieve the secure `https` URL for local access without additional configuration:\n\nUse the following API call, replacing `{TOKEN}` with your Plex token:\n```text\nhttps://plex.tv/api/resources?includeHttps=1&X-Plex-Token={TOKEN}\n```\n\nThis will return an XML response, including the full https URL:\n```xml\n<MediaContainer size=\"5\">\n  <Device name=\"Your Server Name\" product=\"Plex Media Server\" ...>\n    <Connection protocol=\"https\" address=\"192.168.x.x\" port=\"32400\" \n      uri=\"https://192-168-x-x.0123456789abcdef0123456789abcdef.plex.direct:32400\" local=\"1\"/>\n    ...\n  </Device>\n  ...\n</MediaContainer>\n```\nThanks anonysmussi for pointing this out!\n\n## Considerations\n\n- **Album Matching**: Ensure proper music library organization with matching folder names\n- **Cache Management**: Regular cache updates improve performance and accuracy\n- **API Rate Limits**: Be mindful of site-specific rate limits\n- **Required Credentials**: Valid API keys needed in configuration\n- **Site Specification**: The `--site` option is mandatory for relevant commands\n- **Logging Levels**: Adjust verbosity in configuration as needed\n- **Cache Tracking**: Separate caches for playlists, collections, and bookmarks enable independent updates\n- **Update Process**: Updates add new items while maintaining existing ones\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A tool for creating Plex playlists or collections from RED collages",
    "version": "1.7.1",
    "project_urls": {
        "Homepage": "https://github.com/marceljungle/red-plex"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b3196a71c6ba78c30e0a7b8c997b64a123499a479a636232eceee27f0c55b0f7",
                "md5": "f06d4bdb12a640abdac90dcb169572e4",
                "sha256": "56d4c6933dfa8e4daa8a10e1ce44e07744751afdcd298830fbb3c15243ab8962"
            },
            "downloads": -1,
            "filename": "red_plex-1.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f06d4bdb12a640abdac90dcb169572e4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 32441,
            "upload_time": "2024-12-19T21:07:57",
            "upload_time_iso_8601": "2024-12-19T21:07:57.093535Z",
            "url": "https://files.pythonhosted.org/packages/b3/19/6a71c6ba78c30e0a7b8c997b64a123499a479a636232eceee27f0c55b0f7/red_plex-1.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4774bca933cb6c8adb54a1feaf5dec67a39bd876706428f3938ab013a65f6c2b",
                "md5": "d20bc6154b7781908f9610f914b70d37",
                "sha256": "c4c0f789ae1333b60b2108ecdacd8fd09e331f6c415ce238c172c41af54e9b02"
            },
            "downloads": -1,
            "filename": "red_plex-1.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d20bc6154b7781908f9610f914b70d37",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 22082,
            "upload_time": "2024-12-19T21:08:00",
            "upload_time_iso_8601": "2024-12-19T21:08:00.123505Z",
            "url": "https://files.pythonhosted.org/packages/47/74/bca933cb6c8adb54a1feaf5dec67a39bd876706428f3938ab013a65f6c2b/red_plex-1.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-19 21:08:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "marceljungle",
    "github_project": "red-plex",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "plexapi",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "pyrate-limiter",
            "specs": []
        },
        {
            "name": "tenacity",
            "specs": []
        },
        {
            "name": "click",
            "specs": []
        },
        {
            "name": "pyyaml",
            "specs": []
        }
    ],
    "lcname": "red-plex"
}
        
Elapsed time: 0.98499s