1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 13:44:14 +01:00

Main function.. no global variables

This commit is contained in:
Johan Andersson 2011-03-19 14:09:31 +01:00
parent a2229b17e8
commit 090fa40ba6

View File

@ -24,7 +24,7 @@ def calc_data(byte, total):
def getrtmp(url, output):
""" Get the stream from RTMP """
other = ""
other = ""
if url[4:5] == "e":
""" For encrypted streams """
other = "-l 2"
@ -52,23 +52,27 @@ def gethttp(url, output):
fd.close()
argv = sys.argv[1]
DATA = getdata(argv)
MATCH = re.search('dynamicStreams=(.*)\&amp\;background', DATA)
if MATCH:
new = MATCH.group(1)
tmp = new.split("|")
MATCH = re.search('url:(.*)\,', tmp[0])
else:
MATCH = re.search('pathflv=(.*)\&amp\;background', DATA)
if not MATCH:
print "Err: cant find stream"
sys.exit(2)
def main():
argv = sys.argv[1]
DATA = getdata(argv)
MATCH = re.search('dynamicStreams=(.*)\&amp\;background', DATA)
if MATCH:
new = MATCH.group(1)
tmp = new.split("|")
MATCH = re.search('url:(.*)\,', tmp[0])
else:
MATCH = re.search('pathflv=(.*)\&amp\;background', DATA)
if not MATCH:
print "Err: cant find stream"
sys.exit(2)
STREAM = MATCH.group(1)
OUTPUT = os.path.basename(STREAM)
STREAM = MATCH.group(1)
OUTPUT = os.path.basename(STREAM)
if STREAM[0:4] == "rtmp":
getrtmp(STREAM, OUTPUT)
else:
gethttp(STREAM, OUTPUT)
if STREAM[0:4] == "rtmp":
getrtmp(STREAM, OUTPUT)
else:
gethttp(STREAM, OUTPUT)
if __name__ == "__main__":
main()