mirror of
https://github.com/beetbox/beets.git
synced 2026-03-06 05:02:12 +01:00
Dedupe genres parsing in beatport
This commit is contained in:
parent
2c63fe77ce
commit
10d13992e6
2 changed files with 6 additions and 10 deletions
|
|
@ -234,9 +234,11 @@ class BeatportObject:
|
|||
)
|
||||
if "artists" in data:
|
||||
self.artists = [(x["id"], str(x["name"])) for x in data["artists"]]
|
||||
if "genres" in data:
|
||||
genre_list = [str(x["name"]) for x in data["genres"]]
|
||||
self.genres = unique_list(genre_list)
|
||||
|
||||
self.genres = unique_list(
|
||||
x["name"]
|
||||
for x in (*data.get("subGenres", []), *data.get("genres", []))
|
||||
)
|
||||
|
||||
def artists_str(self) -> str | None:
|
||||
if self.artists is not None:
|
||||
|
|
@ -305,12 +307,6 @@ class BeatportTrack(BeatportObject):
|
|||
self.bpm = data.get("bpm")
|
||||
self.initial_key = str((data.get("key") or {}).get("shortName"))
|
||||
|
||||
# Extract genres list from subGenres or genres
|
||||
self.genres = unique_list(
|
||||
str(x.get("name"))
|
||||
for x in data.get("subGenres") or data.get("genres") or []
|
||||
)
|
||||
|
||||
|
||||
class BeatportPlugin(MetadataSourcePlugin):
|
||||
_client: BeatportClient | None = None
|
||||
|
|
|
|||
|
|
@ -474,7 +474,7 @@ class BeatportTest(BeetsTestCase):
|
|||
item.year = 2016
|
||||
item.comp = False
|
||||
item.label_name = "Gravitas Recordings"
|
||||
item.genres = ["Glitch Hop"]
|
||||
item.genres = ["Glitch Hop", "Breaks"]
|
||||
item.year = 2016
|
||||
item.month = 4
|
||||
item.day = 11
|
||||
|
|
|
|||
Loading…
Reference in a new issue