diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index 5dd47a994..6dcd9e9fd 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -191,7 +191,6 @@ options = { class LastGenrePlugin(plugins.BeetsPlugin): def __init__(self): super(LastGenrePlugin, self).__init__() - self.import_stages = [self.imported] self.config.add({ 'whitelist': os.path.join(os.path.dirname(__file__), 'genres.txt'), @@ -199,8 +198,12 @@ class LastGenrePlugin(plugins.BeetsPlugin): 'canonical': None, 'source': 'album', 'force': False, + 'auto': True, }) + if self.config['auto']: + self.import_stages = [self.imported] + # Read the whitelist file. wl_filename = self.config['whitelist'].as_filename() whitelist = set() @@ -345,6 +348,10 @@ class LastGenrePlugin(plugins.BeetsPlugin): def imported(self, session, task): """Event hook called when an import task finishes.""" + # Always force a "real" lookup during import. + if not self.config['force']: + self.config['force'] = True + if task.is_album: album = session.lib.get_album(task.album_id) album.genre, src = self._get_album_genre(album) diff --git a/docs/plugins/lastgenre.rst b/docs/plugins/lastgenre.rst index 59c51db3e..949286068 100644 --- a/docs/plugins/lastgenre.rst +++ b/docs/plugins/lastgenre.rst @@ -80,3 +80,6 @@ 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.