Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ustream: fix desktop stream validation #1227

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions src/livestreamer/plugins/ustreamtv.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from livestreamer.compat import urlparse, urljoin, range
from livestreamer.exceptions import StreamError, PluginError, NoStreamsError
from livestreamer.packages.flashmedia.types import ScriptDataReference
from livestreamer.plugin import Plugin, PluginOptions
from livestreamer.plugin.api import http, validate
from livestreamer.stream import RTMPStream, HLSStream, HTTPStream, Stream
Expand Down Expand Up @@ -71,11 +72,11 @@
}]
)
})
_stream_schema = validate.Schema(
validate.any({
"name": validate.text,
"url": validate.text,
"streams": validate.all(
_stream_schema = validate.Schema({
"name": validate.text,
"url": validate.text,
"streams": validate.any(
validate.all(
_amf3_array,
[{
"chunkId": validate.any(int, float),
Expand All @@ -89,13 +90,10 @@
validate.optional("description"): validate.text,
validate.optional("isTranscoded"): bool
}],
)
},
{
"name": validate.text,
"varnishUrl": validate.text
})
)
),
ScriptDataReference
)
})
_channel_schema = validate.Schema({
validate.optional("stream"): validate.any(
validate.all(
Expand Down Expand Up @@ -508,11 +506,11 @@ 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"]):
if not isinstance(stream_info, dict):
continue
stream = None
stream_height = int(stream_info.get("height", 0))
stream_name = stream_info.get("description")
Expand Down