mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 09:33:46 +01:00
beatport: Use track numbers from API (#2091)
* beatport: Use trackNumber from API instead of enumerating the tracks * beatport: Set medium_index to track number * Update changelog with fixes to beatport plugin
This commit is contained in:
parent
ce59658aec
commit
4c324fae2a
2 changed files with 8 additions and 5 deletions
|
|
@ -252,6 +252,7 @@ class BeatportTrack(BeatportObject):
|
|||
if 'slug' in data:
|
||||
self.url = "http://beatport.com/track/{0}/{1}".format(data['slug'],
|
||||
data['id'])
|
||||
self.track_number = data.get('trackNumber')
|
||||
|
||||
|
||||
class BeatportPlugin(BeetsPlugin):
|
||||
|
|
@ -406,8 +407,7 @@ class BeatportPlugin(BeetsPlugin):
|
|||
artist, artist_id = self._get_artist(release.artists)
|
||||
if va:
|
||||
artist = u"Various Artists"
|
||||
tracks = [self._get_track_info(x, index=idx)
|
||||
for idx, x in enumerate(release.tracks, 1)]
|
||||
tracks = [self._get_track_info(x) for x in release.tracks]
|
||||
|
||||
return AlbumInfo(album=release.name, album_id=release.beatport_id,
|
||||
artist=artist, artist_id=artist_id, tracks=tracks,
|
||||
|
|
@ -419,7 +419,7 @@ class BeatportPlugin(BeetsPlugin):
|
|||
catalognum=release.catalog_number, media=u'Digital',
|
||||
data_source=u'Beatport', data_url=release.url)
|
||||
|
||||
def _get_track_info(self, track, index=None):
|
||||
def _get_track_info(self, track):
|
||||
"""Returns a TrackInfo object for a Beatport Track object.
|
||||
"""
|
||||
title = track.name
|
||||
|
|
@ -427,10 +427,10 @@ class BeatportPlugin(BeetsPlugin):
|
|||
title += u" ({0})".format(track.mix_name)
|
||||
artist, artist_id = self._get_artist(track.artists)
|
||||
length = track.length.total_seconds()
|
||||
|
||||
return TrackInfo(title=title, track_id=track.beatport_id,
|
||||
artist=artist, artist_id=artist_id,
|
||||
length=length, index=index,
|
||||
length=length, index=track.track_number,
|
||||
medium_index=track.track_number,
|
||||
data_source=u'Beatport', data_url=track.url)
|
||||
|
||||
def _get_artist(self, artists):
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ Fixes:
|
|||
* :doc:`/plugins/permissions`: Fix a regression in the previous release where
|
||||
the plugin would always fail to set permissions (and log a warning).
|
||||
:bug:`2089`
|
||||
* :doc:`/plugins/beatport`: Use track numbers from Beatport (instead of
|
||||
determining them from the order of tracks) and set the `medium_index`
|
||||
value.
|
||||
* With :ref:`per_disc_numbering` enabled, some metadata sources (notably, the
|
||||
:doc:`/plugins/beatport`) would not set the track number at all. This is
|
||||
fixed. :bug:`2085`
|
||||
|
|
|
|||
Loading…
Reference in a new issue