Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support tracks that do not have audio analysis.

  • Loading branch information...
commit ab5701f33a5d568996055e442c2b818994fa6153 1 parent 4d1e47a
Dan Stowell stowell authored echonest committed
Showing with 10 additions and 8 deletions.
  1. +9 −7 pyechonest/track.py
  2. +1 −1  setup.py
16 pyechonest/track.py
View
@@ -130,13 +130,15 @@ def _track_from_response(response):
energy = audio_summary.get('energy', 0)
danceability = audio_summary.get('danceability', 0)
speechiness = audio_summary.get('speechiness', 0)
- json_url = audio_summary['analysis_url']
- json_string = urllib2.urlopen(json_url).read()
- analysis = json.loads(json_string)
- nested_track = analysis.pop('track')
- track.update(analysis)
- track.update(nested_track)
- track.update({'analysis_url': json_url, 'energy': energy,
+ json_url = audio_summary.get('analysis_url')
+ if json_url:
+ json_string = urllib2.urlopen(json_url).read()
+ analysis = json.loads(json_string)
+ nested_track = analysis.pop('track')
+ track.update(analysis)
+ track.update(nested_track)
+ track.update({'analysis_url': json_url})
+ track.update({ 'energy': energy,
'danceability': danceability,
'speechiness': speechiness})
return Track(identifier, md5, track)
2  setup.py
View
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# encoding: utf-8
-__version__ = "4.2.19"
+__version__ = "4.2.20"
# $Source$
from sys import version
Please sign in to comment.
Something went wrong with that request. Please try again.