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

Add plugin for rtve.es live streams #509

Merged
merged 1 commit into from
Aug 25, 2014
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions docs/plugin_matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ nrk - tv.nrk.no Yes Yes Streams may be geo-restrict
- radio.nrk.no
oldlivestream livestream.com Yes No Only mobile streams are supported.
picarto picarto.tv Yes --
rtve rtve.es Yes No
speedrunslive speedrunslive.com Yes -- URL forwarder to Twitch channels.
streamingvi... [1]_ streamingvid... [2]_ Yes -- RTMP streams requires rtmpdump with
K-S-V patches.
Expand Down
40 changes: 40 additions & 0 deletions src/livestreamer/plugins/rtve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import re

from livestreamer.plugin import Plugin
from livestreamer.stream import HLSStream

_url_re = re.compile(r"""
https?://www\.rtve\.es/
(?P<channel_path>
noticias/directo-la-1|
television/la-2-directo|
deportes/directo/teledeporte|
noticias/directo/canal-24h
)
/?
""", re.VERBOSE)

_id_map = {
"noticias/directo-la-1": "LA1",
"television/la-2-directo": "LA2",
"deportes/directo/teledeporte": "TDP",
"noticias/directo/canal-24h": "24H",
}


class Rtve(Plugin):
@classmethod
def can_handle_url(cls, url):
return _url_re.match(url)

def __init__(self, url):
Plugin.__init__(self, url)
match = _url_re.match(url).groupdict()
self.channel_path = match["channel_path"]

def _get_streams(self):
stream_id = _id_map[self.channel_path]
hls_url = "http://iphonelive.rtve.es/{0}_LV3_IPH/{0}_LV3_IPH.m3u8".format(stream_id)
return HLSStream.parse_variant_playlist(self.session, hls_url)

__plugin__ = Rtve