Skip to content

Commit

Permalink
Merge pull request #3377 from rhlahuja/beatport-handle-none-key
Browse files Browse the repository at this point in the history
[beatport] Exclude invalid musical keys
  • Loading branch information
sampsyo authored Sep 28, 2019
2 parents d6e1a5c + 3ffaaa1 commit 56d382f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions beetsplug/beatport.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ def __init__(self, data):
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'):
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit 56d382f

Please sign in to comment.