mirror of
https://github.com/beetbox/beets.git
synced 2025-12-26 02:24:33 +01:00
lastgenre: "auto" config option
This commit is contained in:
parent
e50e28dc38
commit
3860a5ac27
2 changed files with 11 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue