Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #352 from papplampe/develop
Added picarto plugin
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from livestreamer.exceptions import PluginError, NoStreamsError | ||
from livestreamer.plugin import Plugin | ||
from livestreamer.stream import RTMPStream | ||
from livestreamer.compat import urlparse | ||
from livestreamer.utils import parse_qsd | ||
|
||
class Picarto(Plugin): | ||
|
||
@classmethod | ||
def can_handle_url(self, url): | ||
return "picarto.tv" in url | ||
|
||
def _get_streams(self): | ||
params = parse_qsd(urlparse(self.url).query) | ||
if not 'watch' in params: | ||
raise NoStreamsError(self.url) | ||
channel = params['watch'] | ||
|
||
if not RTMPStream.is_usable(self.session): | ||
raise PluginError("rtmpdump is not usable but required by Picarto plugin") | ||
|
||
streams = {} | ||
streams["live"] = RTMPStream(self.session, { | ||
"rtmp": "rtmp://199.189.86.17/dsapp/{0}.flv".format(channel), | ||
"pageUrl": self.url, | ||
"live": True | ||
}) | ||
return streams | ||
|
||
__plugin__ = Picarto |