Skip to main content

Beets plugins to synchronize a music library with a Plex Media Server.

Project description

beets-plex

Beets plugins to synchronize a music library with a Plex Media Server.

Beets and Plex index the same files on a shared mount, so matching is by exact file path — no fuzzy matching, no discovery. Two plugins ship in one package:

  • ratingtag — stores a rating in the beets database and in file tags.
  • plex — targeted library scans on import/move/remove, two-way rating sync, a one-way pull of Plex play statistics, and one-way push of query-defined playlists and track collections.

Install

pip install beets-plex

Requires Python 3.10–3.14. Then enable and configure the plugins in your beets config — see Configuration.

For development, from a checkout:

pip install -e '.[test]'

Configuration

Enable the plugins and configure them under a shared plex: section in your beets config. ratingtag needs no configuration for defaults; plex needs at least a token and the library_name of your Plex music library.

plugins: ratingtag plex

plex:
    # Connection
    host: localhost         # Plex server host
    port: 32400             # Plex server port
    token: ""               # Plex auth token (required)
    library_name: Music     # name of the Plex music library section
    secure: no              # yes connects over https instead of http

    # Path translation (beets and Plex see the same files on a shared mount)
    beets_dir: ""           # beets-side path prefix; defaults to beets' `directory`
    plex_dir: ""            # Plex-side path prefix; defaults to `beets_dir`

    # Rating sync
    rating_conflict: plex   # who wins a genuine conflict: plex | beets | skip

    # Playlists and collections (one-way, beets query -> Plex)
    playlists: []           # list of {name, query} pushed as Plex playlists
    collections: []         # list of {name, query} pushed as Plex collections
    prune_empty: no         # delete a playlist/collection whose query now matches nothing

    # Auto-scan on import/move/remove
    auto_scan: no           # trigger targeted Plex scans from beets operations
    scan_threshold: 100     # above this many touched directories, do one full refresh

beets_dir/plex_dir are the fixed prefixes that rewrite a beets file path to its Plex-side path; leave them equal when beets and Plex mount the library at the same path. playlists and collections each take a list of mappings, for example:

plex:
    playlists:
        - name: Favourites
          query: "rating:8..10"
    collections:
        - name: Recently Rated
          query: "plex_lastratedat:-4w.."

Replacing plexupdate

plex.auto_scan replaces beets' built-in plexupdate plugin: instead of a full library refresh, it triggers targeted scans of just the directories an import, move, or remove touched. To use it, remove plexupdate from your plugins line and set plex.auto_scan: yes — running both would scan twice.

Usage

beet plex status                  # connection, library size, match counts
beet plex stats [QUERY]           # pull Plex play counts/timestamps into beets
beet plex sync [QUERY]            # two-way rating sync
beet plex playlists [NAME ...]    # push configured playlists (all, or the named ones)
beet plex collections [NAME ...]  # push configured collections

Pass -p/--pretend to any subcommand to print what would change without writing anything. With no subcommand, beet plex runs status.

Contributing

See CONTRIBUTING.md: small pull requests, each closing its own issue; Conventional Commits; ruff and pytest green.

License

MIT — see LICENSE.

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_plex-0.1.0.tar.gz (48.3 kB view details)

Uploaded Source

Built Distribution

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

beets_plex-0.1.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file beets_plex-0.1.0.tar.gz.

File metadata

  • Download URL: beets_plex-0.1.0.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for beets_plex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b215c67c343d48ba4c93ecc2523dc6be51140aa1ab936b622e3c528abba61a15
MD5 66b18b049482af00848eae76bd053d75
BLAKE2b-256 b0bfc797a0b5ff85bf8d5d3ecef7ce26db5bb1900cfa6cdbb27a60bec07819db

See more details on using hashes here.

Provenance

The following attestation bundles were made for beets_plex-0.1.0.tar.gz:

Publisher: release.yml on pvliesdonk/beets-plex

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_plex-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: beets_plex-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for beets_plex-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4f2b9b14933c7fc9475e56f843c5363408681aedb91df251b4437d64e941049
MD5 425a9d134a966c40992ea5385748f0b3
BLAKE2b-256 fc52f23c3c89247b9909781c28f3c3e8f5c74b647fee2ad65976c0e2ce8dd1de

See more details on using hashes here.

Provenance

The following attestation bundles were made for beets_plex-0.1.0-py3-none-any.whl:

Publisher: release.yml on pvliesdonk/beets-plex

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