1. Adrian Sampson
  2. beets

Commits

Adrian Sampson  committed bf27eed

lastgenre: "auto" config option

  • Participants
  • Parent commits cd7466a
  • Branches default

Comments (0)

Files changed (2)

File beetsplug/lastgenre/__init__.py

View file
 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'),
             '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()
 
     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)

File docs/plugins/lastgenre.rst

View file
 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.