Skip to main content

A Redacted plugin for Beets.

Project description

Redacted Beets Plugin

A Beets plugin for matching albums to torrents on Redacted.

Installation

  1. Install the redacted plugin via Pip with pip install beets-redacted. If you installed Beets via PipX, then you can use pipx inject beets beets-redacted.
  2. Create a Redacted API key. Go to your user's 'Settings' page, then to the 'Access Settings' section. Under 'API Keys', enter a name for your new API key (perhaps 'beets-redacted'), copy the key in the 'API Key' field for your Beets config, check only the 'Torrents' checkbox, and check the 'Confirm API Key' checkbox. Then, save your profile. The new API Key should then be present with the name you gave it.
  3. Update your Beets configuration. Enable the redacted plugin, and configure the API Key you generated above:
plugins:
  - redacted

redacted:
  api_key: <your new api key>

Configuration

The configuration options are

  • api_key (required): Your Redacted API key, with at least 'torrents' scope. If user_id is also set, the API key must also have the 'User' scope.
  • user_id (default: empty): Your Redacted user id, used only for looking up your snatches to improve torrent matching. To find your Redacted user id, go to your profile and copy the "id" parameter from the URL bar. It will likely be a number between 1 and 100,000.
  • auto (default: no): When enabled, search for matching torrents during import.
  • force (default: no): When enabled, search for matching torrents even for albums that already have a match in the database.
  • pretend (default: no): When enabled, show the changes that would be made to the database, but do not modify the database.
  • min_score (experimental, default: 0.75): Minimum match score needed to consider a torrent to be a match to an album. Likely to be changed soon.

For example,

redacted:
  api_key: ...
  user_id: ...
  auto: no
  force: no
  pretend: no
  min_score: 0.75

Some of these parameters can also be set on the command line, with -f / --force, -p / --pretend, and -m 0.75 / --min-score=0.75.

Usage

Match torrents for the entire library:

beet redacted

Match torrents for Radiohead albums:

beet redacted Radiohead

Match torrents for Radiohead albums, and overwrite the existing matches:

beet redacted -f Radiohead

List albums that don't have a matching torrent, which may be albums to upload:

beet ls -a red_torrentid::^$

(note: matching torrents is fuzzy and imperfect and has room for improvement. It's likely that there are torrents for albums without matches. Please do not automatically upload all unmatched albums without review - you are responsible for your own uploads)

List albums that are missing tracks (using the missing plugin) and have a matching torrent, which may be candidates for snatching to fill gaps in the library:

beet missing -a -c -f '$albumartist - $album: Missing $missing; Red: https://redacted.sh/torrents.php?id=$red_groupid&torrentid=$red_torrentid' ^red_torrentid::^$

Roadmap

  1. Improved album - torrent matching logic.
  2. Configure preferred torrent encoding, e.g. 'Lossless' > '24bit Lossless' > 'V0 (VBR)' > '320'.
  3. Command for snatching and exporting .torrent files.

Planned matching improvements:

  • Prioritize user's snatches
  • If possible, re-use Beets' distance matching algorithm.
  • Add fields other than artist name, album name, and year to the matching process. It should also include the album's media, distributor, multiple artists, remastering, format, encoding, if it's personal freeleech, and if it's bookmarked.

Contributing

Comments and suggestions are welcome. Discussion may happen in the Redacted forum thread. Pull requests will be eagerly considered.

Development environment

The plugin uses Poetry and Poe the Poet to manage the package, its dependencies, and to format, lint, and test the code. Please ensure you have both installed and are familiar with their usage.

While Beets supports Python 3.8+, this plugin requires 3.9+.

Set up the development environment:

# Install dependencies
poetry install

# Install Git pre-commit hooks
poetry run pre-commit install

Run Beets using the development plugin:

poetry run beet redacted

Sort imports, format, lint, run tests, and check types:

poetry run poe sort
poetry run poe format
poetry run poe lint
poetry run poe test
poetry run poe type

Sort, format, and run tests - useful for AI agents' self-iteration:

poetry run poe check

Sort imports, format, run tests, lint, and check types - enforced on merging pull requests:

poetry run poe checkall

Development guidelines

To support AI-assisted development, strong type checking is required and it's imperative to maintain very high code coverage with effective unit tests.

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

beets_redacted-0.1.1.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

beets_redacted-0.1.1-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file beets_redacted-0.1.1.tar.gz.

File metadata

  • Download URL: beets_redacted-0.1.1.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for beets_redacted-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2408d1123b965cc8d671812cc6e75642384a1e49c0ac56a12d79675e407b46a4
MD5 d0a9f9267ec4f2fb220de7b70b17a849
BLAKE2b-256 f9d295e041c18221ff9c85fa0cfd3086b25b70e81a94a3ae1d82154e74db54e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for beets_redacted-0.1.1.tar.gz:

Publisher: python-publish.yml on Judas-red/beets-redacted

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

File details

Details for the file beets_redacted-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: beets_redacted-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for beets_redacted-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06a24216022418f7b42e1844f5fde9ccd4700b110320d3ccaa2ed64fefa1af39
MD5 534a6191b4d20c59711ce8d636506cb1
BLAKE2b-256 a0f7262c635c0b2fcf69006d16f996ef8d3ff2ca1f3cdc9dd6f856a3d2c48fd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for beets_redacted-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on Judas-red/beets-redacted

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