From 958a969d67e2797b15dfc74433b2bf8c598c1a2c Mon Sep 17 00:00:00 2001 From: Paul LaMendola Date: Tue, 17 Nov 2015 03:33:58 -0500 Subject: [PATCH 1/2] Maybe fixed ustream validation failure. --- src/livestreamer/plugins/ustreamtv.py | 45 ++++++++++++++++----------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/livestreamer/plugins/ustreamtv.py b/src/livestreamer/plugins/ustreamtv.py index 74c04c7c..a21727d1 100644 --- a/src/livestreamer/plugins/ustreamtv.py +++ b/src/livestreamer/plugins/ustreamtv.py @@ -71,25 +71,30 @@ }] ) }) -_stream_schema = validate.Schema({ - "name": validate.text, - "url": validate.text, - "streams": validate.all( - _amf3_array, - [{ - "chunkId": validate.any(int, float), - "chunkRange": {validate.text: validate.text}, - "chunkTime": validate.any(int, float), - "offset": validate.any(int, float), - "offsetInMs": validate.any(int, float), - "streamName": validate.text, - validate.optional("bitrate"): validate.any(int, float), - validate.optional("height"): validate.any(int, float), - validate.optional("description"): validate.text, - validate.optional("isTranscoded"): bool - }], - ) -}) +_stream_schema = validate.Schema( + validate.any({ + "name": validate.text, + "url": validate.text, + "streams": validate.all( + _amf3_array, + [{ + "chunkId": validate.any(int, float), + "chunkRange": {validate.text: validate.text}, + "chunkTime": validate.any(int, float), + "offset": validate.any(int, float), + "offsetInMs": validate.any(int, float), + "streamName": validate.text, + validate.optional("bitrate"): validate.any(int, float), + validate.optional("height"): validate.any(int, float), + validate.optional("description"): validate.text, + validate.optional("isTranscoded"): bool + }], + ) + }, + { + "name": validate.text + }) +) _channel_schema = validate.Schema({ validate.optional("stream"): validate.any( validate.all( @@ -502,6 +507,8 @@ def _get_desktop_streams(self, channel_id): streams = {} for provider in channel["stream"]: + if provider["name"] == u"uhs_akamai": # not heavily tested, but got a stream working + continue provider_url = provider["url"] provider_name = provider["name"] for stream_index, stream_info in enumerate(provider["streams"]): From 08bc23204bb7ea0fbdb0b145ffa9e91218787540 Mon Sep 17 00:00:00 2001 From: Paul LaMendola Date: Tue, 17 Nov 2015 03:37:10 -0500 Subject: [PATCH 2/2] More strict test for weird stream. --- src/livestreamer/plugins/ustreamtv.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/livestreamer/plugins/ustreamtv.py b/src/livestreamer/plugins/ustreamtv.py index a21727d1..8c9cba24 100644 --- a/src/livestreamer/plugins/ustreamtv.py +++ b/src/livestreamer/plugins/ustreamtv.py @@ -92,7 +92,8 @@ ) }, { - "name": validate.text + "name": validate.text, + "varnishUrl": validate.text }) ) _channel_schema = validate.Schema({