[8tracks] Use predefined avg duration when duration is negative (Closes #5200)
authorSergey M․ <dstftw@gmail.com>
Sat, 14 Mar 2015 09:52:06 +0000 (15:52 +0600)
committerSergey M․ <dstftw@gmail.com>
Sat, 14 Mar 2015 09:52:06 +0000 (15:52 +0600)
youtube_dl/extractor/eighttracks.py

index fb5dbbe2b0c7d9bd15b87426e446ce73f903a6eb..869ff72d654d732a0e092f209cbb910af3d0bd5e 100644 (file)
@@ -117,6 +117,9 @@ class EightTracksIE(InfoExtractor):
         track_count = data['tracks_count']
         duration = data['duration']
         avg_song_duration = float(duration) / track_count
+        # duration is sometimes negative, use predefined avg duration
+        if avg_song_duration <= 0:
+            avg_song_duration = 300
         first_url = 'http://8tracks.com/sets/%s/play?player=sm&mix_id=%s&format=jsonh' % (session, mix_id)
         next_url = first_url
         entries = []