[urort] Update to new multi-format protocol

This commit is contained in:
Philipp Hagemeister 2014-12-12 20:55:18 +01:00
parent 19bf2b4e88
commit baa7081d68

View File

@ -18,11 +18,10 @@ class UrortIE(InfoExtractor):
'url': 'https://urort.p3.no/#!/Band/Gerilja', 'url': 'https://urort.p3.no/#!/Band/Gerilja',
'md5': '5ed31a924be8a05e47812678a86e127b', 'md5': '5ed31a924be8a05e47812678a86e127b',
'info_dict': { 'info_dict': {
'id': '33124-4', 'id': '33124-24',
'ext': 'mp3', 'ext': 'mp3',
'title': 'The Bomb', 'title': 'The Bomb',
'thumbnail': 're:^https?://.+\.jpg', 'thumbnail': 're:^https?://.+\.jpg',
'like_count': int,
'uploader': 'Gerilja', 'uploader': 'Gerilja',
'uploader_id': 'Gerilja', 'uploader_id': 'Gerilja',
'upload_date': '20100323', 'upload_date': '20100323',
@ -36,20 +35,28 @@ class UrortIE(InfoExtractor):
playlist_id = self._match_id(url) playlist_id = self._match_id(url)
fstr = compat_urllib_parse.quote("InternalBandUrl eq '%s'" % playlist_id) fstr = compat_urllib_parse.quote("InternalBandUrl eq '%s'" % playlist_id)
json_url = 'http://urort.p3.no/breeze/urort/TrackDtos?$filter=' + fstr json_url = 'http://urort.p3.no/breeze/urort/TrackDTOViews?$filter=%s&$orderby=Released%%20desc&$expand=Tags%%2CFiles' % fstr
songs = self._download_json(json_url, playlist_id) songs = self._download_json(json_url, playlist_id)
entries = []
entries = [{ for s in songs:
'id': '%d-%s' % (s['BandId'], s['$id']), formats = [{
'title': s['Title'], 'tbr': f.get('Quality'),
'url': s['TrackUrl'], 'ext': f['FileType'],
'ext': 'mp3', 'format_id': '%s-%s' % (f['FileType'], f.get('Quality', '')),
'uploader_id': playlist_id, 'url': 'http://p3urort.blob.core.windows.net/tracks/%s' % f['FileRef'],
'uploader': s.get('BandName', playlist_id), 'preference': 3 if f['FileType'] == 'mp3' else 2,
'like_count': s.get('LikeCount'), } for f in s['Files']]
'thumbnail': 'http://urort.p3.no/cloud/images/%s' % s['Image'], self._sort_formats(formats)
'upload_date': unified_strdate(s.get('Released')), e = {
} for s in songs] 'id': '%d-%s' % (s['BandId'], s['$id']),
'title': s['Title'],
'uploader_id': playlist_id,
'uploader': s.get('BandName', playlist_id),
'thumbnail': 'http://urort.p3.no/cloud/images/%s' % s['Image'],
'upload_date': unified_strdate(s.get('Released')),
'formats': formats,
}
entries.append(e)
return { return {
'_type': 'playlist', '_type': 'playlist',