No description
Find a file
Jonathan Matthews 7cfc39ea27 Realign with known-working code after review by @mkhl
@mkhl was kind enough to do a drive-by review of my proposed changes,
which I'll include here as the GitHub URI may bit-rot over time (it's
technically
[here](bc21caa0d5),
but that commit isn't part of the `beets` repo, so may get GC'd).

I've encorporated all their proposed changes, as their code is being run
against an existing Beets library, whereas my changes were made as I
tried to set up Beets for the first time - thus I'm inclined to trust
their known-working code more than my own!

This is a review starting at
bc21caa0d5 (diff-d53f73df7f26990645e7bdac865ef86a52b67bafc6fe6ad69890b510a57e2955R210)
(`class DelimeteredString(String):`)

> for context this is the version i'm using now:
>
> ```python
> class DelimitedString(String):
>     model_type = list
>
>     def __init__(self, delimiter):
>         self.delimiter = delimiter
>
>     def format(self, value):
>         return self.delimiter.join(value)
>
>     def parse(self, string):
>         if not string:
>             return []
>         return string.split(self.delimiter)
>
>     def to_sql(self, model_value):
>         return self.delimiter.join(model_value)
> ```
>
> i think 'delimited string' is the correct term here
>
> the rest of the code doesn't seem to use many abbreviations, so calling the property `delimiter` seems appropriate
>
> i don't think a default value for the delimiter makes a lot of sense?
>
> the list comprehension and string conversions in `to_sql` don't seem necessary to me, see above. did you run into trouble without them?
>
> the `from_sql` seems to just be missing functionality from the `Type` parent and seems completely unnecessary
>
> `parse` shouldn't be able to fail because at that point, we've ensured that its argument is actually a string. i also added a `if not string` condition because otherwise the empty list of album types would turn into the list containing the empty string (because that's what split returns)
>
> if we don't define a `format` method here we print the internal python representation of the values (i.e. `['album', 'live']` or somesuch) in the `beet write` output. joining on the delimiter nicely formats the output :)
>
> just so i don't ping you twice unnecessarily, i think it's better to instantiate this type with `'; '` (semicolon space) as the delimiter, because that's what was used before to join the albumtypes and what we'll find in the database

All these changes have been made, including the switch from `;` to
`;<space>` as the in-DB separator.
2023-02-27 13:28:29 +01:00
.github add mypy to actions, but allow failure 2022-12-18 09:09:49 +01:00
beets Realign with known-working code after review by @mkhl 2023-02-27 13:28:29 +01:00
beetsplug Deprecate absubmit and update acousticbrainz plugins 2023-02-20 17:42:07 -05:00
docs Merge pull request #4636 from trolley/topic/deprecate-acousticbrainz 2023-02-21 17:42:25 +01:00
extra release.py: fix version regex (remove u'' string prefix) 2022-08-20 07:30:15 +02:00
test Merge pull request #4374 from wisp3rwind/pr_drop_old_python 2023-02-19 10:19:36 +01:00
.coveragerc remove references to nose 2020-07-07 15:28:38 -07:00
.gitignore Exclude lib64 from git whether folder or symlink 2021-11-30 11:49:24 -05:00
.mypy.ini mypy: ignore_missing_imports = True 2022-12-18 09:09:49 +01:00
beet pyupgrade root 2021-08-25 15:27:16 +10:00
codecov.yml Disable CodeCov annotations (see #4337) 2022-05-17 14:15:17 -04:00
CONTRIBUTING.rst docs: remove unused link target, update links to python docs 2022-12-18 09:20:04 +01:00
LICENSE Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
MANIFEST.in Include extra bits in the source distribution 2016-08-22 23:54:36 -07:00
README.rst new link for HTML5 audio 2022-03-13 16:14:14 +00:00
README_kr.rst new link for HTML5 audio 2022-03-13 16:14:14 +00:00
SECURITY.md Create security policy 2021-12-22 09:34:41 -08:00
setup.cfg Reformat flake8 config comments 2022-11-28 07:58:01 -08:00
setup.py Merge pull request #4374 from wisp3rwind/pr_drop_old_python 2023-02-19 10:19:36 +01:00
tox.ini add mypy tox environment and dependencies 2022-12-18 09:09:49 +01:00

.. image:: https://img.shields.io/pypi/v/beets.svg
    :target: https://pypi.python.org/pypi/beets

.. image:: https://img.shields.io/codecov/c/github/beetbox/beets.svg
    :target: https://codecov.io/github/beetbox/beets

.. image:: https://github.com/beetbox/beets/workflows/ci/badge.svg?branch=master
    :target: https://github.com/beetbox/beets/actions

.. image:: https://repology.org/badge/tiny-repos/beets.svg
    :target: https://repology.org/project/beets/versions


beets
=====

Beets is the media library management system for obsessive music geeks.

The purpose of beets is to get your music collection right once and for all.
It catalogs your collection, automatically improving its metadata as it goes.
It then provides a bouquet of tools for manipulating and accessing your music.

Here's an example of beets' brainy tag corrector doing its thing::

  $ beet import ~/music/ladytron
  Tagging:
      Ladytron - Witching Hour
  (Similarity: 98.4%)
   * Last One Standing      -> The Last One Standing
   * Beauty                 -> Beauty*2
   * White Light Generation -> Whitelightgenerator
   * All the Way            -> All the Way...

Because beets is designed as a library, it can do almost anything you can
imagine for your music collection. Via `plugins`_, beets becomes a panacea:

- Fetch or calculate all the metadata you could possibly need: `album art`_,
  `lyrics`_, `genres`_, `tempos`_, `ReplayGain`_ levels, or `acoustic
  fingerprints`_.
- Get metadata from `MusicBrainz`_, `Discogs`_, and `Beatport`_. Or guess
  metadata using songs' filenames or their acoustic fingerprints.
- `Transcode audio`_ to any format you like.
- Check your library for `duplicate tracks and albums`_ or for `albums that
  are missing tracks`_.
- Clean up crufty tags left behind by other, less-awesome tools.
- Embed and extract album art from files' metadata.
- Browse your music library graphically through a Web browser and play it in any
  browser that supports `HTML5 Audio`_.
- Analyze music files' metadata from the command line.
- Listen to your library with a music player that speaks the `MPD`_ protocol
  and works with a staggering variety of interfaces.

If beets doesn't do what you want yet, `writing your own plugin`_ is
shockingly simple if you know a little Python.

.. _plugins: https://beets.readthedocs.org/page/plugins/
.. _MPD: https://www.musicpd.org/
.. _MusicBrainz music collection: https://musicbrainz.org/doc/Collections/
.. _writing your own plugin:
    https://beets.readthedocs.org/page/dev/plugins.html
.. _HTML5 Audio:
    https://html.spec.whatwg.org/multipage/media.html#the-audio-element
.. _albums that are missing tracks:
    https://beets.readthedocs.org/page/plugins/missing.html
.. _duplicate tracks and albums:
    https://beets.readthedocs.org/page/plugins/duplicates.html
.. _Transcode audio:
    https://beets.readthedocs.org/page/plugins/convert.html
.. _Discogs: https://www.discogs.com/
.. _acoustic fingerprints:
    https://beets.readthedocs.org/page/plugins/chroma.html
.. _ReplayGain: https://beets.readthedocs.org/page/plugins/replaygain.html
.. _tempos: https://beets.readthedocs.org/page/plugins/acousticbrainz.html
.. _genres: https://beets.readthedocs.org/page/plugins/lastgenre.html
.. _album art: https://beets.readthedocs.org/page/plugins/fetchart.html
.. _lyrics: https://beets.readthedocs.org/page/plugins/lyrics.html
.. _MusicBrainz: https://musicbrainz.org/
.. _Beatport: https://www.beatport.com

Install
-------

You can install beets by typing ``pip install beets``.
Beets has also been packaged in the `software repositories`_ of several
distributions. Check out the `Getting Started`_ guide for more information.

.. _Getting Started: https://beets.readthedocs.org/page/guides/main.html
.. _software repositories: https://repology.org/project/beets/versions

Contribute
----------

Thank you for considering contributing to ``beets``! Whether you're a
programmer or not, you should be able to find all the info you need at
`CONTRIBUTING.rst`_.

.. _CONTRIBUTING.rst: https://github.com/beetbox/beets/blob/master/CONTRIBUTING.rst

Read More
---------

Learn more about beets at `its Web site`_. Follow `@b33ts`_ on Twitter for
news and updates.

.. _its Web site: https://beets.io/
.. _@b33ts: https://twitter.com/b33ts/

Contact
-------
* Encountered a bug you'd like to report? Check out our `issue tracker`_!
    * If your issue hasn't already been reported, please `open a new ticket`_
      and we'll be in touch with you shortly.
    * If you'd like to vote on a feature/bug, simply give a :+1: on issues
      you'd like to see prioritized over others.
* Need help/support, would like to start a discussion, have an idea for a new
  feature, or would just like to introduce yourself to the team? Check out
  `GitHub Discussions`_ or `Discourse`_!

.. _GitHub Discussions: https://github.com/beetbox/beets/discussions
.. _issue tracker: https://github.com/beetbox/beets/issues
.. _open a new ticket: https://github.com/beetbox/beets/issues/new/choose
.. _Discourse: https://discourse.beets.io/

Authors
-------

Beets is by `Adrian Sampson`_ with a supporting cast of thousands.

.. _Adrian Sampson: https://www.cs.cornell.edu/~asampson/