1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

Cosmetics

This commit is contained in:
Johan Andersson 2011-09-17 12:05:07 +02:00
parent a67d371d7d
commit 82eb9bdfdd

View File

@ -76,16 +76,16 @@ class Viaplay(Common):
other = "" other = ""
data = self.getdata(url) data = self.getdata(url)
xml = ET.XML(data) xml = ET.XML(data)
ss = xml.find("Product").find("Videos").find("Video").find("Url").text filename = xml.find("Product").find("Videos").find("Video").find("Url").text
if ss[:4] == "http": if filename[:4] == "http":
data = self.getdata(ss) data = self.getdata(filename)
xml = ET.XML(data) xml = ET.XML(data)
ss = xml.find("Url").text filename = xml.find("Url").text
if not self.output: if not self.output:
self.output = os.path.basename(ss) self.output = os.path.basename(filename)
print "Outfile: ", self.output print "Outfile: ", self.output
other = "-W http://flvplayer.viastream.viasat.tv/play/swf/player110516.swf?rnd=1315434062" other = "-W http://flvplayer.viastream.viasat.tv/play/swf/player110516.swf?rnd=1315434062"
self.getrtmp(ss, self.output, self.live, other) self.getrtmp(filename, self.output, self.live, other)
class Tv4play(Common): class Tv4play(Common):
def __init__(self, output, quality, live): def __init__(self, output, quality, live):
@ -143,10 +143,10 @@ class Svtplay(Common):
match = re.search('url:(.*)\,bitrate:([0-9]+)', f) match = re.search('url:(.*)\,bitrate:([0-9]+)', f)
streams[int(match.group(2))] = match.group(1) streams[int(match.group(2))] = match.group(1)
if not self.quality: if not self.quality:
stream = streams[sorted(streams.keys()).pop()] filename = streams[sorted(streams.keys()).pop()]
else: else:
try: try:
stream = streams[int(self.quality)] filename = streams[int(self.quality)]
except (ValueError, KeyError): except (ValueError, KeyError):
print "Err: Cant find that quality. try 2400 (720p), 1400 (high), 850 (mid) or 320 (low)" print "Err: Cant find that quality. try 2400 (720p), 1400 (high), 850 (mid) or 320 (low)"
sys.exit(2) sys.exit(2)
@ -155,16 +155,16 @@ class Svtplay(Common):
if not match: if not match:
print "Err: cant find stream" print "Err: cant find stream"
sys.exit(2) sys.exit(2)
stream = match.group(1) filename = match.group(1)
if not self.output: if not self.output:
self.output = os.path.basename(stream) self.output = os.path.basename(filename)
print "Outfile: ", self.output print "Outfile: ", self.output
if stream[0:4] == "rtmp": if stream[0:4] == "rtmp":
self.getrtmp(stream, self.output, self.live, other) self.getrtmp(filename, self.output, self.live, other)
else: else:
self.gethttp(stream,self.output) self.gethttp(filename, self.output)
def main(): def main():
""" Main program """ """ Main program """