mirror of
https://github.com/beetbox/beets.git
synced 2025-12-22 08:34:23 +01:00
lastgenre: Fix album not falling back to artist stage
which was the usual behaviour in lastgenre ever since and it should be kept that way. Also refactor "if track" to use a similar notation for overall code readability.
This commit is contained in:
parent
2b276e07f1
commit
edd366e766
1 changed files with 10 additions and 11 deletions
|
|
@ -357,6 +357,7 @@ class LastGenrePlugin(plugins.BeetsPlugin):
|
|||
and the whitelist feature was disabled.
|
||||
"""
|
||||
keep_genres = []
|
||||
new_genres = []
|
||||
label = ""
|
||||
genres = self._get_existing_genres(obj)
|
||||
|
||||
|
|
@ -374,17 +375,15 @@ class LastGenrePlugin(plugins.BeetsPlugin):
|
|||
|
||||
# Run through stages: track, album, artist,
|
||||
# album artist, or most popular track genre.
|
||||
if (
|
||||
isinstance(obj, library.Item)
|
||||
and "track" in self.sources
|
||||
and (new_genres := self.fetch_track_genre(obj))
|
||||
):
|
||||
if isinstance(obj, library.Item) and "track" in self.sources:
|
||||
if new_genres := self.fetch_track_genre(obj):
|
||||
label = "track"
|
||||
elif "album" in self.sources and (
|
||||
new_genres := self.fetch_album_genre(obj)
|
||||
):
|
||||
|
||||
if not new_genres and "album" in self.sources:
|
||||
if new_genres := self.fetch_album_genre(obj):
|
||||
label = "album"
|
||||
elif "artist" in self.sources:
|
||||
|
||||
if not new_genres and "artist" in self.sources:
|
||||
new_genres = None
|
||||
if isinstance(obj, library.Item):
|
||||
new_genres = self.fetch_artist_genre(obj)
|
||||
|
|
|
|||
Loading…
Reference in a new issue