diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index f13b62f1ed..cf90facbda 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -382,22 +382,18 @@ def commands(self): 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 @@ def lastgenre_func(lib, opts, args): 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)): diff --git a/docs/changelog.rst b/docs/changelog.rst index e0df4793c9..d5e9a04df8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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`. diff --git a/docs/plugins/lastgenre.rst b/docs/plugins/lastgenre.rst index 9604cf8aa5..c7d04fe259 100644 --- a/docs/plugins/lastgenre.rst +++ b/docs/plugins/lastgenre.rst @@ -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.