changelog/thanks/style for #319

This commit is contained in:
Adrian Sampson 2013-06-07 20:53:53 -07:00
parent ac9e5b2054
commit d1ebe423c9
2 changed files with 9 additions and 4 deletions

View file

@ -139,10 +139,13 @@ class BeatportTrack(BeatportObject):
self.title = unicode(data['title'])
if 'mixName' in data:
self.mix_name = unicode(data['mixName'])
self.length = timedelta(milliseconds=data.get('lengthMs',0) or 0)
if self.length == 0:
(min, sec) = data.get('length','0:0').split(':')
self.length = timedelta(minutes=min, seconds=sec)
self.length = timedelta(milliseconds=data.get('lengthMs', 0) or 0)
if not self.length:
try:
min, sec = data.get('length', '0:0').split(':')
self.length = timedelta(minutes=int(min), seconds=int(sec))
except ValueError:
pass
if 'slug' in data:
self.url = "http://beatport.com/track/{0}/{1}".format(data['slug'],
data['id'])

View file

@ -34,6 +34,8 @@ And some bug fixes:
* Python 2.6 compatibility for :doc:`/plugins/beatport`. Thanks Wesley Bitter.
* Don't move the config file during a null migration. Thanks to Theofilos
Intzoglou.
* Fix an occasional crash in the :doc:`/plugins/beatport` when a length
field was missing from the API response. Thanks to Timothy Appnel.
1.2.0 (June 5, 2013)