[soundcloud] Always add streaming formats

pull/2617/head
Philipp Hagemeister 2014-03-24 02:21:17 +01:00
parent 83622b6d2f
commit 5e114e4bfe
1 changed files with 30 additions and 29 deletions

View File

@ -124,18 +124,20 @@ class SoundcloudIE(InfoExtractor):
'description': info['description'],
'thumbnail': thumbnail,
}
formats = []
if info.get('downloadable', False):
# We can build a direct link to the song
format_url = (
'https://api.soundcloud.com/tracks/{0}/download?client_id={1}'.format(
track_id, self._CLIENT_ID))
result['formats'] = [{
formats.append({
'format_id': 'download',
'ext': info.get('original_format', 'mp3'),
'url': format_url,
'vcodec': 'none',
}]
else:
'preference': 10,
})
# We have to retrieve the url
streams_url = ('http://api.soundcloud.com/i1/tracks/{0}/streams?'
'client_id={1}&secret_token={2}'.format(track_id, self._IPHONE_CLIENT_ID, secret_token))
@ -143,7 +145,6 @@ class SoundcloudIE(InfoExtractor):
streams_url,
track_id, 'Downloading track url')
formats = []
format_dict = json.loads(stream_json)
for key, stream_url in format_dict.items():
if key.startswith('http'):