Skip to content

Commit 2338985

Browse files
authored
Merge pull request #148 from marceljungle/copilot/fix-42177ad9-1e36-4cef-977a-83c1fa1ff330
Improve project README with comprehensive documentation and enhanced metadata
2 parents ee883a5 + 8975911 commit 2338985

4 files changed

Lines changed: 248 additions & 38 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 marceljungle
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 205 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
11
# red-plex
22

3-
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.
3+
[![PyPI version](https://badge.fury.io/py/red-plex.svg)](https://badge.fury.io/py/red-plex)
4+
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
7+
A command-line tool for creating and updating Plex collections based on collages and bookmarks from Gazelle-based music trackers like **Redacted** ("RED") and **Orpheus Network** ("OPS").
8+
9+
red-plex bridges the gap between your curated music collections on private trackers and your personal Plex media server, automatically creating and maintaining Plex collections that mirror your tracker collages and bookmarks.
10+
11+
## Quick Start
12+
13+
1. **Install red-plex**: `pip install red-plex`
14+
2. **Configure your API keys**: `red-plex config edit`
15+
3. **Create your first collection**: `red-plex collages convert 12345 --site red`
16+
17+
## What are RED and OPS?
18+
19+
- **Redacted (RED)**: A private music tracker focused on high-quality audio files
20+
- **Orpheus Network (OPS)**: Another private music tracker with curated content
21+
- Both use the Gazelle framework and offer "collages" (curated collections) and personal bookmarks
422

523
## Table of Contents
24+
- [Prerequisites](#prerequisites)
25+
- [Installation](#installation)
26+
- [Getting API Keys](#getting-api-keys)
27+
- [Configuration](#configuration)
628
- [Overview](#overview)
729
- [Features](#features)
8-
- [Installation](#installation)
930
- [Usage & Commands](#usage--commands)
1031
- [Configuration Commands](#configuration-commands)
1132
- [Collages](#collages)
@@ -18,21 +39,102 @@ red-plex is a command-line tool for creating and updating Plex collections based
1839
- [Using Query Fetch Mode](#using-query-fetch-mode)
1940
- [Configuration Details](#configuration-details)
2041
- [Configuration Tips](#configuration-tips)
21-
- [Considerations](#considerations)
42+
- [Troubleshooting](#troubleshooting)
43+
- [Important Considerations](#important-considerations)
44+
- [Contributing](#contributing)
2245

2346
---
2447

48+
## Prerequisites
49+
50+
- **Python 3.8 or higher**
51+
- **Plex Media Server** with a configured music library
52+
- **Active account** on RED and/or OPS with API access
53+
- **Music library** organized in your Plex server
54+
55+
## Installation
56+
57+
### Using pip (recommended)
58+
59+
```bash
60+
pip install red-plex
61+
```
62+
63+
### Using pipx (isolated environment)
64+
65+
```bash
66+
pipx install red-plex
67+
```
68+
69+
### From source
70+
71+
```bash
72+
git clone https://github.com/marceljungle/red-plex.git
73+
cd red-plex
74+
pip install -e .
75+
```
76+
77+
## Getting API Keys
78+
79+
### For Redacted (RED)
80+
1. Log into your RED account
81+
2. Go to your profile settings
82+
3. Navigate to "Access Settings" or "API"
83+
4. Generate a new API key
84+
5. **Keep this key secure and private**
85+
86+
### For Orpheus Network (OPS)
87+
1. Log into your OPS account
88+
2. Go to your user settings
89+
3. Find the API section
90+
4. Generate a new API key
91+
5. **Keep this key secure and private**
92+
93+
## Configuration
94+
95+
After installation, you need to configure red-plex with your credentials:
96+
97+
```bash
98+
# Open configuration file in your default editor
99+
red-plex config edit
100+
```
101+
102+
Edit the configuration file with your details:
103+
104+
```yaml
105+
LOG_LEVEL: INFO
106+
PLEX_URL: http://localhost:32400
107+
PLEX_TOKEN: your_plex_token_here
108+
SECTION_NAME: Music
109+
RED:
110+
API_KEY: your_red_api_key_here
111+
BASE_URL: https://redacted.sh
112+
RATE_LIMIT:
113+
calls: 10
114+
seconds: 10
115+
OPS:
116+
API_KEY: your_ops_api_key_here
117+
BASE_URL: https://orpheus.network
118+
RATE_LIMIT:
119+
calls: 4
120+
seconds: 15
121+
```
122+
123+
### Getting Your Plex Token
124+
125+
Visit: https://plex.tv/api/resources?includeHttps=1&X-Plex-Token={YOUR_TOKEN}
126+
25127
## Overview
26128
27-
- **Stores Data in SQLite**: Instead of CSV-based caches, red-plex now stores albums, collages, and bookmarks in a lightweight SQLite database.
28-
- **Collages & Bookmarks**: Fetch and manage torrent-based collages or personal bookmarks from Gazelle-based sites.
129+
- **Stores Data in SQLite**: Instead of CSV-based "caches," red-plex now stores albums, collages, and bookmarks in a lightweight SQLite database.
130+
- **Collages & Bookmarks**: Fetch and manage torrent-based "collages" or personal "bookmarks" from Gazelle-based sites.
29131
- **Plex Integration**: Compare the torrent group info with your Plex music library to create or update Plex collections.
30132
- **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).
31133
- **Incremental Updating**: Update previously created collections as new albums become available or site data changes.
32134

33135
## Features
34136

35-
- **Multi-Site**: Works with Redacted (red) and Orpheus Network (ops).
137+
- **Multi-Site**: Works with Redacted ("red") and Orpheus Network ("ops").
36138
- **Collections from Collages/Bookmarks**: Create or update entire Plex collections for each collage or bookmarked set.
37139
- **Local SQLite Database**: All data (albums, collages, bookmarks) is kept in one DB, no more CSV.
38140
- **Two Fetch Modes**: Choose between `torrent_name` (default) for direct path matching or `query` for metadata-based searches in Plex.
@@ -41,20 +143,6 @@ red-plex is a command-line tool for creating and updating Plex collections based
41143
- **Simple CLI**: All major tasks are accessed via subcommands like `collages`, `bookmarks`, `db`, etc.
42144
- **Python 3.8+ Compatible**: Runs on modern Python versions with no external database dependencies.
43145

44-
## Installation
45-
46-
Install via pip:
47-
48-
```bash
49-
pip install red-plex
50-
```
51-
52-
Or use pipx for an isolated environment:
53-
54-
```bash
55-
pipx install red-plex
56-
```
57-
58146
## Usage & Commands
59147

60148
Type `red-plex --help` for detailed usage. Below is a summary of the main commands.
@@ -76,7 +164,7 @@ red-plex config reset
76164

77165
```bash
78166
# Create Plex collections for specific collage IDs
79-
red-plex collages convert [COLLAGE_IDS] --site [red|ops] --fetch-mode [torrent_name|query]
167+
red-plex collages convert [COLLAGE_IDS] --site [red|ops] --fetch-mode [normal|query]
80168
81169
# Update all collages in the database, re-checking the site data
82170
red-plex collages update --fetch-mode [torrent_name|query]
@@ -96,10 +184,15 @@ red-plex bookmarks update --fetch-mode [torrent_name|query]
96184

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

99-
- **torrent_name** (default): Searches for directories matching the torrent folder name.
100-
- **query**: Searches using `Artist` and `Album` metadata, ideal for organized libraries managed by tools like Beets or Lidarr.
187+
#### For `collages convert`:
188+
- **torrent_name** (default): Searches for directories matching the torrent folder name
189+
- **query**: Searches using `Artist` and `Album` metadata, ideal for organized libraries managed by tools like Beets or Lidarr
190+
191+
#### For other commands (`collages update`, `bookmarks convert`, `bookmarks update`):
192+
- **torrent_name** (default): Searches for directories matching the torrent folder name
193+
- **query**: Searches using `Artist` and `Album` metadata, ideal for organized libraries managed by tools like Beets or Lidarr
101194

102-
This option applies to `collages convert`, `collages update`, `bookmarks convert`, and `bookmarks update`. Defaults to `torrent_name` if omitted.
195+
> **Note**: There's a terminology difference between commands - `collages convert` uses "normal" while other commands use "torrent_name", but both refer to the same functionality.
103196

104197
### Database Commands
105198

@@ -149,13 +242,33 @@ red-plex db albums update
149242
### Using Query Fetch Mode
150243

151244
```bash
152-
# Create a collection using query mode
245+
# Create a collection using query mode (for Beets/Lidarr organized libraries)
153246
red-plex collages convert 12345 --site red --fetch-mode query
154247
155248
# Update all bookmarks using query mode
156249
red-plex bookmarks update --site ops -fm query
157250
```
158251

252+
### Complete Workflow Example
253+
254+
```bash
255+
# 1. First time setup
256+
red-plex config edit # Add your API keys and Plex details
257+
258+
# 2. Update your local album database from Plex
259+
red-plex db albums update
260+
261+
# 3. Create collections from specific collages
262+
red-plex collages convert 12345 67890 --site red
263+
264+
# 4. Create collection from your bookmarks
265+
red-plex bookmarks convert --site red
266+
267+
# 5. Later, update all collections with new releases
268+
red-plex collages update
269+
red-plex bookmarks update
270+
```
271+
159272
## Configuration Details
160273

161274
By default, configuration is stored in `~/.config/red-plex/config.yml`:
@@ -186,14 +299,72 @@ SECTION_NAME: Music
186299
https://plex.tv/api/resources?includeHttps=1&X-Plex-Token={YOUR_TOKEN}
187300
```
188301
- Look for the `<Device>` node in the XML for a `uri`, use this `plex.direct` address.
302+
- Use `DEBUG` log level for verbose debugging information
303+
- Use `WARNING` log level for minimal output
304+
305+
## Troubleshooting
306+
307+
### Common Issues
308+
309+
#### "No module named 'plexapi'" Error
310+
```bash
311+
pip install plexapi
312+
# or
313+
pip install red-plex --upgrade
314+
```
315+
316+
#### Authentication Errors
317+
- Verify your API keys are correct in `config.yml`
318+
- Check that your Plex token is valid
319+
- Ensure you have access to the sites you're trying to use
320+
321+
#### No Albums Found
322+
- Run `red-plex db albums update` to refresh your Plex library
323+
- Check that your Plex music library is properly configured
324+
- Verify the `SECTION_NAME` in your config matches your Plex music library name
325+
326+
#### Rate Limiting Issues
327+
- The tool respects site rate limits automatically
328+
- If you encounter issues, try reducing the rate limit values in your config
189329

190-
## Considerations
330+
#### Fetch Mode Issues
331+
- Use `torrent_name`/`normal` mode if your library structure matches torrent folder names
332+
- Use `query` mode if you use Beets, Lidarr, or have renamed your music files
333+
- Try both modes to see which works better for your library
334+
335+
### Getting Help
336+
337+
1. Check the logs with `LOG_LEVEL: DEBUG` in your config
338+
2. Verify your configuration with `red-plex config show`
339+
3. Test your Plex connection by running `red-plex db albums update`
340+
4. Open an issue on GitHub with detailed error messages
341+
342+
## Important Considerations
343+
344+
- **Album Matching Strategy**:
345+
- `torrent_name`/`normal` (default): Matches albums by comparing torrent folder names with Plex directory paths
346+
- `query`: Uses artist and album metadata for matching, ideal for libraries organized by Beets, Lidarr, or other tools that rename files
347+
- **Database Management**: All data is stored in `red_plex.db`. Use database reset commands (`db albums reset`, etc.) to clear specific tables when needed
348+
- **Site Credentials**: Ensure your API keys are valid and have proper permissions
349+
- **Rate Limiting**: The tool automatically respects site-specific rate limits to avoid being banned
350+
- **Logging Levels**:
351+
- `DEBUG`: Verbose output for troubleshooting
352+
- `INFO`: Standard information (default)
353+
- `WARNING`: Minimal output
354+
- **Collection Updates**: When you run `collages update` or `bookmarks update`, new albums are added to existing Plex collections, but removed items from tracker collages are not automatically removed from Plex collections
355+
356+
## Contributing
357+
358+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
359+
360+
### Development Setup
361+
362+
```bash
363+
git clone https://github.com/marceljungle/red-plex.git
364+
cd red-plex
365+
pip install -e .
366+
```
367+
368+
---
191369

192-
- **Album Matching**:
193-
- `torrent_name` (default): Matches folder paths.
194-
- `query`: Uses metadata for reliable matching in renamed libraries.
195-
- **Database**: All data in `red_plex.db`. Reset tables with `db albums reset`, etc.
196-
- **Site Credentials**: Ensure valid API keys in `config.yml`.
197-
- **Rate Limits**: Adheres to site-specific settings.
198-
- **Logging**: Use `DEBUG` for verbose logs or `WARNING` for less output.
199-
- **Updates**: `collages update` and `bookmarks update` add new albums but do not remove existing items in Plex.
370+
**Disclaimer**: This tool is for personal use with your own music library and tracker accounts. Respect the rules and terms of service of the private trackers you use.

red_plex/infrastructure/cli/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ def update_collages(ctx, fetch_mode: str):
143143
help='Specify the site: red (Redacted) or ops (Orpheus).')
144144
@click.option(
145145
'--fetch-mode', '-fm',
146-
type=click.Choice(['normal', 'query'], case_sensitive=False), # Added case_sensitive
147-
default='normal',
146+
type=click.Choice(['torrent_name', 'query'], case_sensitive=False), # Added case_sensitive
147+
default='torrent_name',
148148
show_default=True,
149149
help=(
150150
'(Optional) Album lookup strategy:\n'
151-
'\n- normal: uses torrent dir name (original behavior).\n'
151+
'\n- torrent_name: uses torrent dir name (original behavior).\n'
152152
'\n- query: uses Plex queries (Beets/Lidarr friendly).\n'
153153
)
154154
)

setup.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,20 @@
2525
setup(
2626
name='red_plex',
2727
version=version,
28-
description='A tool for creating Plex playlists or collections from RED collages',
28+
description='A CLI tool for creating Plex collections from RED and OPS collages and bookmarks',
2929
long_description=long_description,
3030
long_description_content_type="text/markdown",
3131
author='marceljungle',
3232
author_email='gigi.dan2011@gmail.com',
3333
url='https://github.com/marceljungle/red-plex',
34+
project_urls={
35+
'Bug Reports': 'https://github.com/marceljungle/red-plex/issues',
36+
'Source': 'https://github.com/marceljungle/red-plex',
37+
'Documentation': 'https://github.com/marceljungle/red-plex#readme',
38+
},
39+
keywords='plex music collections red ops redacted orpheus gazelle tracker',
3440
packages=find_namespace_packages(include=['red_plex*']),
41+
python_requires='>=3.8',
3542
include_package_data=True,
3643
install_requires=[
3744
'plexapi',
@@ -46,7 +53,18 @@
4653
red-plex=red_plex.infrastructure.cli.cli:main
4754
''',
4855
classifiers=[
56+
'Development Status :: 4 - Beta',
57+
'Intended Audience :: End Users/Desktop',
58+
'License :: OSI Approved :: MIT License',
4959
'Programming Language :: Python :: 3',
60+
'Programming Language :: Python :: 3.8',
61+
'Programming Language :: Python :: 3.9',
62+
'Programming Language :: Python :: 3.10',
63+
'Programming Language :: Python :: 3.11',
64+
'Programming Language :: Python :: 3.12',
5065
'Operating System :: OS Independent',
66+
'Topic :: Multimedia :: Sound/Audio',
67+
'Topic :: Internet :: WWW/HTTP :: Indexing/Search',
68+
'Environment :: Console',
5169
],
5270
)

0 commit comments

Comments
 (0)