2013-03-02 21:26:28 +01:00
|
|
|
# ex:ts=4:sw=4:sts=4:et
|
|
|
|
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
2013-03-01 23:39:42 +01:00
|
|
|
from __future__ import absolute_import
|
2013-02-12 19:43:37 +01:00
|
|
|
import sys
|
|
|
|
import re
|
|
|
|
from urlparse import urlparse
|
|
|
|
import xml.etree.ElementTree as ET
|
|
|
|
|
2013-03-01 23:39:42 +01:00
|
|
|
from svtplay.utils import get_http_data
|
|
|
|
from svtplay.log import log
|
2013-03-10 14:56:10 +01:00
|
|
|
from svtplay.fetcher.rtmp import download_rtmp
|
2013-02-12 19:43:37 +01:00
|
|
|
|
2013-01-17 00:21:47 +01:00
|
|
|
class Viaplay():
|
|
|
|
def handle(self, url):
|
|
|
|
return ("tv3play.se" in url) or ("tv6play.se" in url) or ("tv8play.se" in url)
|
|
|
|
|
|
|
|
def get(self, options, url):
|
|
|
|
parse = urlparse(url)
|
|
|
|
match = re.search('\/play\/(.*)/?', parse.path)
|
|
|
|
if not match:
|
|
|
|
log.error("Cant find video file")
|
|
|
|
sys.exit(2)
|
|
|
|
url = "http://viastream.viasat.tv/PlayProduct/%s" % match.group(1)
|
|
|
|
options.other = ""
|
|
|
|
data = get_http_data(url)
|
|
|
|
xml = ET.XML(data)
|
|
|
|
filename = xml.find("Product").find("Videos").find("Video").find("Url").text
|
2013-03-10 14:03:07 +01:00
|
|
|
subtitle = xml.find("Product").find("SamiFile").text
|
2013-01-17 00:21:47 +01:00
|
|
|
|
|
|
|
if filename[:4] == "http":
|
|
|
|
data = get_http_data(filename)
|
|
|
|
xml = ET.XML(data)
|
|
|
|
filename = xml.find("Url").text
|
|
|
|
|
|
|
|
options.other = "-W http://flvplayer.viastream.viasat.tv/play/swf/player110516.swf?rnd=1315434062"
|
|
|
|
download_rtmp(options, filename)
|
2013-03-10 14:03:07 +01:00
|
|
|
if options.subtitle and subtitle:
|
|
|
|
if options.output != "-":
|
|
|
|
data = get_http_data(subtitle)
|
|
|
|
subtitle_sami(options, data)
|