Merge pull request #3377 from rhlahuja/beatport-handle-none-key

[beatport] Exclude invalid musical keys
This commit is contained in:
Adrian Sampson 2019-09-28 16:43:12 -04:00 committed by GitHub
commit 56d382f58e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -257,10 +257,10 @@ class BeatportTrack(BeatportObject):
self.url = "https://beatport.com/track/{0}/{1}" \
.format(data['slug'], data['id'])
self.track_number = data.get('trackNumber')
if 'bpm' in data:
self.bpm = data['bpm']
if 'key' in data:
self.musical_key = six.text_type(data['key'].get('shortName'))
self.bpm = data.get('bpm')
self.musical_key = six.text_type(
(data.get('key') or {}).get('shortName')
)
# Use 'subgenre' and if not present, 'genre' as a fallback.
if data.get('subGenres'):

View file

@ -73,6 +73,8 @@ New features:
* :doc:`/plugins/beatport`: The plugin now gets the musical key, BPM and the
genre for each track.
:bug:`2080`
* :doc:`/plugins/beatport`: Fix default assignment of the musical key.
:bug:`3377`
Fixes: