mirror of
https://github.com/beetbox/beets.git
synced 2025-12-31 13:02:47 +01:00
lastgenre: Place to_delim. func near _get_genre
and the other helpers.
This commit is contained in:
parent
eba3dc15fd
commit
15f4b2ac29
1 changed files with 12 additions and 12 deletions
|
|
@ -164,18 +164,6 @@ class LastGenrePlugin(plugins.BeetsPlugin):
|
|||
|
||||
# More canonicalization and general helpers.
|
||||
|
||||
def _to_delimited_genre_string(self, tags: list[str]) -> str:
|
||||
"""Reduce tags list to configured count, format and return as delimited
|
||||
string."""
|
||||
separator = self.config["separator"].as_str()
|
||||
max_count = self.config["count"].get(int)
|
||||
|
||||
genres = tags[:max_count]
|
||||
if self.config["title_case"]:
|
||||
genres = [g.title() for g in genres]
|
||||
|
||||
return separator.join(genres)
|
||||
|
||||
def _get_depth(self, tag):
|
||||
"""Find the depth of a tag in the genres tree."""
|
||||
depth = None
|
||||
|
|
@ -296,6 +284,18 @@ class LastGenrePlugin(plugins.BeetsPlugin):
|
|||
|
||||
# Main processing: _get_genre() and helpers.
|
||||
|
||||
def _to_delimited_genre_string(self, tags: list[str]) -> str:
|
||||
"""Reduce tags list to configured count, format and return as delimited
|
||||
string."""
|
||||
separator = self.config["separator"].as_str()
|
||||
max_count = self.config["count"].get(int)
|
||||
|
||||
genres = tags[:max_count]
|
||||
if self.config["title_case"]:
|
||||
genres = [g.title() for g in genres]
|
||||
|
||||
return separator.join(genres)
|
||||
|
||||
def _get_existing_genres(self, obj: Union[Album, Item]) -> list[str]:
|
||||
"""Return a list of genres for this Item or Album. Empty string genres
|
||||
are removed."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue