mirror of
https://github.com/beetbox/beets.git
synced 2025-12-14 12:35:19 +01:00
93 lines
3.3 KiB
ReStructuredText
93 lines
3.3 KiB
ReStructuredText
LastGenre Plugin
|
|
================
|
|
|
|
The MusicBrainz database `does not contain genre information`_. Therefore, when
|
|
importing and autotagging music, beets does not assign a genre. The
|
|
``lastgenre`` plugin fetches *tags* from `Last.fm`_ and assigns them as genres
|
|
to your albums and items. The plugin is included with beets as of version
|
|
1.0b11.
|
|
|
|
.. _does not contain genre information:
|
|
http://musicbrainz.org/doc/General_FAQ#Why_does_MusicBrainz_not_support_genre_information.3F
|
|
.. _Last.fm: http://last.fm/
|
|
|
|
The plugin requires `pylast`_, which you can install using `pip`_ by typing::
|
|
|
|
pip install pylast
|
|
|
|
After you have pylast installed, enable the plugin by putting ``lastgenre`` on
|
|
your ``plugins`` line in :doc:`config file </reference/config>`.
|
|
|
|
The plugin chooses genres based on a *whitelist*, meaning that only certain
|
|
tags can be considered genres. This way, tags like "my favorite music" or "seen
|
|
live" won't be considered genres. The plugin ships with a fairly extensive
|
|
internal whitelist, but you can set your own in the config file using the
|
|
``whitelist`` configuration value::
|
|
|
|
lastgenre:
|
|
whitelist: /path/to/genres.txt
|
|
|
|
The genre list file should contain one genre per line. Blank lines are ignored.
|
|
For the curious, the default genre list is generated by a `script that scrapes
|
|
Wikipedia`_.
|
|
|
|
.. _pip: http://www.pip-installer.org/
|
|
.. _pylast: http://code.google.com/p/pylast/
|
|
.. _script that scrapes Wikipedia: https://gist.github.com/1241307
|
|
|
|
By default, beets will always fetch new genres, even if the files already have
|
|
once. To instead leave genres in place in when they pass the whitelist, set
|
|
the ``force`` option to "no".
|
|
|
|
If no genre is found, the file will be left unchanged. To instead specify a
|
|
fallback genre, use the ``fallback`` configuration option. You can, of
|
|
course, use the empty string as a fallback, like so::
|
|
|
|
lastgenre:
|
|
fallback: ''
|
|
|
|
|
|
Canonicalization
|
|
----------------
|
|
|
|
The plugin can also *canonicalize* genres, meaning that more obscure genres can
|
|
be turned into coarser-grained ones that are present in the whitelist. This
|
|
works using a tree of nested genre names, represented using `YAML`_, where the
|
|
leaves of the tree represent the most specific genres.
|
|
|
|
To enable canonicalization, set the ``canonical`` configuration value::
|
|
|
|
lastgenre:
|
|
canonical: ''
|
|
|
|
Setting this value to the empty string will use a built-in canonicalization
|
|
tree. You can also set it to a path, just like the ``whitelist`` config value,
|
|
to use your own tree.
|
|
|
|
.. _YAML: http://www.yaml.org/
|
|
|
|
|
|
Genre Source
|
|
------------
|
|
|
|
When looking up genres for albums or individual tracks, you can choose whether
|
|
to use Last.fm tags on the album, the artist, or the track. For example, you
|
|
might want all the albums for a certain artist to carry the same genre. Set the
|
|
``source`` configuration value to "album", "track", or "artist", like so::
|
|
|
|
lastgenre:
|
|
source: artist
|
|
|
|
The default is "album". When set to "track", the plugin will fetch *both*
|
|
album-level and track-level genres for your music when importing albums.
|
|
|
|
|
|
Running Manually
|
|
----------------
|
|
|
|
In addition to running automatically on import, the plugin can also run manually
|
|
from the command line. Use the command ``beet lastgenre [QUERY]`` to fetch
|
|
genres for albums matching a certain query.
|
|
|
|
To disable automatic genre fetching on import, set the ``auto`` config option
|
|
to false.
|