mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
Simplify _get_genre keep_existing conditional
- If the keep_existing option is set, just remember everything for now. - Dedup happening later on via _combine... _resolve_genres... - Even knowing if whitelist or not is not important at this point.
This commit is contained in:
parent
f698f21a28
commit
f16e671ff6
1 changed files with 6 additions and 7 deletions
|
|
@ -388,19 +388,18 @@ class LastGenrePlugin(plugins.BeetsPlugin):
|
|||
genres = self._get_existing_genres(obj, separator)
|
||||
if genres and not self.config["force"]:
|
||||
# Without force we don't touch pre-populated tags and return early
|
||||
# with the original contents. We format back to string tough.
|
||||
# with the original contents. We deduplicate and format back to
|
||||
# string though.
|
||||
keep_genres = self._dedup_genres(genres)
|
||||
return separator.join(keep_genres), "keep"
|
||||
|
||||
if self.config["force"]:
|
||||
# Simply forcing doesn't keep any.
|
||||
keep_genres = []
|
||||
# keep_existing remembers, according to the whitelist setting,
|
||||
# any or just allowed genres.
|
||||
if self.config["keep_existing"] and self.config["whitelist"]:
|
||||
keep_genres = self._dedup_genres(genres, whitelist_only=True)
|
||||
elif self.config["keep_existing"]:
|
||||
keep_genres = self._dedup_genres(genres)
|
||||
# Remember existing genres if required. Whitelist validation is
|
||||
# handled later in _resolve_genres.
|
||||
if self.config["keep_existing"]:
|
||||
keep_genres = [g.lower() for g in genres]
|
||||
|
||||
# Track genre (for Items only).
|
||||
if isinstance(obj, library.Item) and "track" in self.sources:
|
||||
|
|
|
|||
Loading…
Reference in a new issue