- Improved doc and changelog

- Cleaner implementation of mutual excursion of the command line
arguments.
This commit is contained in:
Rainer Hihn 2019-04-21 18:32:41 +02:00
parent ddd7b4b3b4
commit b7d3ef6274
3 changed files with 9 additions and 10 deletions

View file

@ -382,22 +382,18 @@ class LastGenrePlugin(plugins.BeetsPlugin):
help=u'genre source: artist, album, or track'
)
lastgenre_cmd.parser.add_option(
u'-A', u'--items', action='store_true',
u'-A', u'--items', action='store_false', dest='album',
help=u'match items instead of albums')
lastgenre_cmd.parser.add_option(
u'-a', u'--albums', action='store_true',
u'-a', u'--albums', action='store_true', dest='album',
help=u'match albums instead of items')
lastgenre_cmd.parser.set_defaults(query_type='albums')
lastgenre_cmd.parser.set_defaults(album=True)
def lastgenre_func(lib, opts, args):
write = ui.should_write()
self.config.set_args(opts)
if opts.albums and opts.items:
self._log.error(u'options -a and -A are mutually exclusive')
return
if opts.albums:
if opts.album:
# Fetch genres for whole albums
for album in lib.albums(ui.decargs(args)):
album.genre, src = self._get_genre(album)
@ -417,7 +413,7 @@ class LastGenrePlugin(plugins.BeetsPlugin):
if write:
item.try_write()
elif opts.items:
else:
# Just query singletons, i.e. items that are not part of
# an album
for item in lib.items(ui.decargs(args)):

View file

@ -6,7 +6,7 @@ Changelog
New features:
* LastGenre can now be used to fetch genres for singletons.
* :doc:`/plugins/lastgenre`: Added option ``-A`` to match individual tracks and singletons.
* The disambiguation string for identifying albums in the importer now shows
the catalog number.
Thanks to :user:`8h2a`.

View file

@ -157,5 +157,8 @@ In addition to running automatically on import, the plugin can also be run manua
from the command line. Use the command ``beet lastgenre [QUERY]`` to fetch
genres for albums or items matching a certain query.
By default, ``beet lastgenre`` matches albums. If you would like to match
individual tracks or singletons, use the ``-A`` switch: ``beet lastgenre -A [QUERY]``.
To disable automatic genre fetching on import, set the ``auto`` config option
to false.