Skip to content
This repository
Browse code

Support tracks that do not have audio analysis.

  • Loading branch information...
commit ab5701f33a5d568996055e442c2b818994fa6153 1 parent 4d1e47a
Dan Stowell stowell authored echonest committed

Showing 2 changed files with 10 additions and 8 deletions. Show diff stats Hide diff stats

  1. +9 7 pyechonest/track.py
  2. +1 1  setup.py
16 pyechonest/track.py
@@ -130,13 +130,15 @@ def _track_from_response(response):
130 130 energy = audio_summary.get('energy', 0)
131 131 danceability = audio_summary.get('danceability', 0)
132 132 speechiness = audio_summary.get('speechiness', 0)
133   - json_url = audio_summary['analysis_url']
134   - json_string = urllib2.urlopen(json_url).read()
135   - analysis = json.loads(json_string)
136   - nested_track = analysis.pop('track')
137   - track.update(analysis)
138   - track.update(nested_track)
139   - track.update({'analysis_url': json_url, 'energy': energy,
  133 + json_url = audio_summary.get('analysis_url')
  134 + if json_url:
  135 + json_string = urllib2.urlopen(json_url).read()
  136 + analysis = json.loads(json_string)
  137 + nested_track = analysis.pop('track')
  138 + track.update(analysis)
  139 + track.update(nested_track)
  140 + track.update({'analysis_url': json_url})
  141 + track.update({ 'energy': energy,
140 142 'danceability': danceability,
141 143 'speechiness': speechiness})
142 144 return Track(identifier, md5, track)
2  setup.py
... ... @@ -1,7 +1,7 @@
1 1 #!/usr/bin/env python
2 2 # encoding: utf-8
3 3
4   -__version__ = "4.2.19"
  4 +__version__ = "4.2.20"
5 5
6 6 # $Source$
7 7 from sys import version

0 comments on commit ab5701f

Please sign in to comment.
Something went wrong with that request. Please try again.