mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Test for presence and non-emptiness in one go.
This commit is contained in:
parent
9a4175dcd0
commit
dfb6fc3f5b
1 changed files with 2 additions and 2 deletions
|
|
@ -263,9 +263,9 @@ class BeatportTrack(BeatportObject):
|
|||
self.musical_key = six.text_type(data['key'].get('shortName'))
|
||||
|
||||
# Use 'subgenre' and if not present, 'genre' as a fallback.
|
||||
if 'subGenres' in data and data['subGenres']:
|
||||
if data.get('subGenres'):
|
||||
self.genre = six.text_type(data['subGenres'][0].get('name'))
|
||||
elif 'genres' in data and data['genres']:
|
||||
elif data.get('genres'):
|
||||
self.genre = six.text_type(data['genres'][0].get('name'))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue