Skip to main content

Easily manage your CD collection with beets

Project description

beets-cdman

This beets plugin lets you easily manage your collection of CDs. You can define CDs in your beets config and with CD definition files, and easily add, remove, or reorder folders.

cdman can't burn CDs, but this can be done by other software such as Brasero on GNOME, or K3b on KDE.

Install

Run this in your beets environment:

pip install beets-cdman

Setup your beets config:

plugins:
  ...
  - cdman

cdman:
  # Path to where you want your CDs to be stored.
  path: ~/Music/CDs  # optional, default ~/Music/CDs

  # The bitrate to use when populating MP3 CDs. This value is in kliobits.
  mp3_bitrate: 192  # optional, default 192

  # How audio CDs should be populated.
  #  - copy: Copy the file from your library to the CD directory
  #  - hard_link: Hard links the file from your library to the CD directory
  #  - soft_link: Soft links the file from your library to the CD directory
  #    - NOTE: Not all filesystems support this
  audio_populate_mode: copy  # optional, defaults to copy

  # How many threads to allocate. Unless you know what you're doing, you should leave this undefined.
  # threads: 12  # optional, default is your hardware thread count

  # This points to CD definitions made in external files
  # Don't use relative paths, as sometimes the system won't be able to find your definitions.
  # You can use `~` to indicate your home directory.
  cd_files:  # optional
    - /path/to/my/cd_file.yml
    - ./dont/use/relative/paths.yml

  # This defines CDs to populate with tracks
  cds:  # optional
    # This will create a CD directory in ~/Music/CDs/mp3-cd-name
    mp3-cd-name:
      # What type of CD this is.
      #  - mp3: An MP3 CD is defined by folders, and converts all tracks to MP3.
      #  - audio: The classic CD standard, simply plops files inside the folder.
      type: mp3

      # You can define the MP3 bitrate to use per-CD if you want.
      # This value overrides your config
      bitrate: 192  # optional, defaults to config

      folders:
        __root__:  # This is a special name that puts tracks inside of this folder directly into the CD folder instead.
          tracks:
            # Tracks can be defined with Beets queries or playlist files
            # There is no limit to the number of query or playlist fields, and they can be intermixed.
            - query: "'artist:Daft Punk'"
            - playlist: "/path/to/playlist_file.m3u"
        foals:
          # You can explicitly define your folder name here.
          # Leaving it undefined simply uses the key used to define this folder,
          # which is `foals` in this case.
          name: "Backwards Foals"  # optional, defaults to folder key
          tracks:
            # Track order matters! This will order the CD so that Part 2 plays before Part 1.
            - query: "'artist:Foals' 'album:Everything Not Saved Will Be Lost, Part 2'"
            - query: "'artist:Foals' 'album:Everything Not Saved Will Be Lost, Part 1'"

Note the use of double and single quotes. The double quotes are to ensure YAML doesn't get confused. The single quotes are to send singular expressions to beets. For example, "'artist:Daft Punk' 'album:Discovery'" would match all songs in the Discovery album and made by Daft Punk.

Usage

To create your CDs, simply run

beet cdman

This will look through your beets config for any CDs defined in there. If any are found, it will then create a folder in your path and place files inside the created folder.

You can also pass in paths to CD definition files, or directories containing CD definition files:

beet cdman daft-punk.yml rock.yml cd-definitions/

MP3 CDs

When cdman encounters an MP3 CD definition, it will create folders inside the CD folder and then convert all music files found from the configured tracks to an MP3. You can configure the bitrate of these MP3s with the mp3_bitrate config field, changing the bitrate field in the CD definition, or by passing --bitrate into the command.

For example, an MP3 CD definition that looks like this:

discoveries:
  type: mp3
  bitrate: 128
  folders:
    daft-punk:
      name: "Daft Punk"
      tracks:
        - query: "'artist:Daft Punk' 'album:Discovery'"
    Fantom87:
      tracks:
        - query: "'artist:Fantom87' 'album:Discovery'"

the-french-house:
  type: mp3
  bitrate: 256
  folders:
    Joshua:
      tracks:
        - query: "'artist:French79' 'album:Joshua'"
    Teenagers:
      tracks:
        - query: "'artist:French79' 'album:Teenagers'"

Would create a directory structure like this:

/path/to/cds_path:
    ├── discoveries
    │   ├── 01 Daft Punk
    │   │   ├── 01 One More Time.mp3
    │   │   ├── 02 Aerodynamic.mp3
    │   │   └── ...
    │   └── 02 Fantom87
    │       ├── 01 Pay Phone.mp3
    │       ├── 02 Oh, Dreamer.mp3
    │       └── ...
    └── the-french-house
        ├── 01 Joshua
        │   ├── 01 Remedy.mp3
        │   ├── 02 Hold On.mp3
        │   └── ...
        └── 02 Teenagers
            ├── 01 One for Wendy.mp3
            ├── 02 Burning Legend.mp3
            └── ...

Audio CDs

When cdman encounters an Audio CD definition, it will simply populate the CD folder with all music files found from the configured tracks. It can either copy, soft link, or hard link the files. You can configure this behavior with the audio_populate_mode config field, changing the populate_mode field in the CD definition, or by passing --populate-mode into the command.

For example, an Audio CD definition that looks like this:

not-saved-part-1:
  type: audio
  populate_mode: soft_link
  tracks:
    - query: "'artist:Foals' 'album:Everything Not Saved Will Be Lost, Part 1'"

not-saved-part-1:
  type: audio
  populate_mode: copy
  tracks:
    - query: "'artist:Foals' 'album:Everything Not Saved Will Be Lost, Part 2'"

Would create a directory structure like this:

/path/to/cds_path:
    ├── not-saved-part-1
    │   ├── 01 Moonlight.flac -> /path/to/Moonlight.flac
    │   ├── 02 Exits.flac -> /path/to/Exits.flac
    │   └── ...
    └── not-saved-part-2
        ├── 01 Red Desert.m4a
        ├── 02 The Runner.m4a
        └── ...

CD Definition Files

CD definition files let you define CDs in external files, to help keep your beets config file less cluttered. CD definition files follow the same format as the beets config cds field.

You can find an example CD definition file here

Credits

The music files used for testing are all created by Scott Buckley, and is protected under CC-BY 4.0.

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_cdman-1.0.0.tar.gz (29.1 kB view details)

Uploaded Source

Built Distribution

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

beets_cdman-1.0.0-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file beets_cdman-1.0.0.tar.gz.

File metadata

  • Download URL: beets_cdman-1.0.0.tar.gz
  • Upload date:
  • Size: 29.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.7 Linux/6.17.0-6-generic

File hashes

Hashes for beets_cdman-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6e950b15b73907d36c3327dbcfdb2c674b51ea241d1de36d4676d4a63fabc8dd
MD5 53d725f1536a783d62c96b0dd12c18fd
BLAKE2b-256 fe3e34d9c93d3c836f612e5ed3d9dbe17d843eb06199cefda62f725ae083d777

See more details on using hashes here.

File details

Details for the file beets_cdman-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: beets_cdman-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.7 Linux/6.17.0-6-generic

File hashes

Hashes for beets_cdman-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85a861e3f0b95ddda17596d0cd43d8e279879753a26215766c02de59378d7917
MD5 81a293695c0438d9c7a4323cd21a6f30
BLAKE2b-256 953779138b92df5670694ecf182ee63ed451435fb1dd66aea21872f2303c7264

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