diff --git a/resolv/resolvers/filebox.py b/resolv/resolvers/filebox.py index cee9795..c8bdff1 100644 --- a/resolv/resolvers/filebox.py +++ b/resolv/resolvers/filebox.py @@ -21,7 +21,14 @@ def resolve(url): video_file = matches.group(1) - return { 'title': "", 'videos': { 'video': video_file } } + stream_dict = { + 'url' : video_file, + 'quality' : "unknown", + 'priority' : 1, + 'format' : "unknown" + } + + return { 'title': "", 'videos': [stream_dict] } def resolve2(url): # This is a fallback function in case no video could be found through the resolve() method. diff --git a/resolv/resolvers/putlocker.py b/resolv/resolvers/putlocker.py index 9f485cd..b603e3a 100644 --- a/resolv/resolvers/putlocker.py +++ b/resolv/resolvers/putlocker.py @@ -52,4 +52,11 @@ def resolve(url): except: raise ResolverError("Could not find the video title.") - return { 'title': video_title, 'videos': { 'video': video_file } } + stream_dict = { + 'url' : video_file, + 'quality' : "unknown", + 'priority' : 1, + 'format' : "unknown" + } + + return { 'title': video_title, 'videos': [stream_dict] } diff --git a/resolv/resolvers/sockshare.py b/resolv/resolvers/sockshare.py index f1811c0..079b110 100644 --- a/resolv/resolvers/sockshare.py +++ b/resolv/resolvers/sockshare.py @@ -52,4 +52,11 @@ def resolve(url): except: raise ResolverError("Could not find the video title.") - return { 'title': video_title, 'videos': { 'video': video_file } } + stream_dict = { + 'url' : video_file, + 'quality' : "unknown", + 'priority' : 1, + 'format' : "unknown" + } + + return { 'title': video_title, 'videos': [stream_dict] } diff --git a/resolv/resolvers/youtube.py b/resolv/resolvers/youtube.py index aae294c..6ffd2e1 100644 --- a/resolv/resolvers/youtube.py +++ b/resolv/resolvers/youtube.py @@ -28,7 +28,7 @@ def resolve(url): except: raise ResolverError("The YouTube player configuration is corrupted.") - stream_pool = {} + stream_pool = [] for stream in streams: fields = stream.split('&') @@ -55,18 +55,30 @@ def resolve(url): if quality == "small": video_quality = "240p" + video_priority = 5 elif quality == "medium": video_quality = "360p" + video_priority = 4 elif quality == "large": video_quality = "480p" + video_priority = 3 elif quality == "hd720": video_quality = "720p" + video_priority = 2 elif quality == "hd1080": video_quality = "1080p" + video_priority = 1 else: video_quality = "unknown" - stream_pool['video_%s_%s' % (video_quality, video_format)] = video_url + stream_dict = { + 'url' : video_url, + 'quality' : video_quality, + 'priority' : video_priority, + 'format' : video_format + } + + stream_pool.append(stream_dict) try: video_title = unescape(re.search('', contents).group(1))