Schoenheit

This commit is contained in:
Stefan Bethke 2010-12-18 22:53:24 +00:00
parent 045d6f88b0
commit 9fe8a84533

View file

@ -1,6 +1,6 @@
#!/usr/local/bin/python
# $Schlepperbande: src/tivomirror/tivomirror,v 1.37 2010/12/18 09:12:01 stb Exp $
# $Schlepperbande: src/tivomirror/tivomirror,v 1.38 2010/12/18 10:03:31 stb Exp $
#
# Stefans Script, um die Sendungen vom Tivo runterzuladen und in MPEG4
# zu transkodieren.
@ -16,6 +16,7 @@ import signal
import shutil
import subprocess
import sys
import time
import urllib2
import xml.dom.minidom
@ -175,6 +176,7 @@ def transcode(file, src, passno, ar):
def download(file, url, mak, target):
print "--- dowloading \"%s\"" % (url)
start = time.clock()
p_curl = subprocess.Popen(["curl", "--anyauth", "--fail", \
"--insecure", "--cookie", "tivo/.cookies.txt", \
"--silent", "--show-error", \
@ -190,10 +192,14 @@ def download(file, url, mak, target):
except OSError:
pass
raise e
if os.path.getsize(target) < 1024:
size = os.path.getsize(target)
if size < 1024:
print "error transcoding file: too small"
os.remove(target)
raise TivoException("downloaded file is too small")
elapsed = time.clock() - start
throughput = size / elapsed
print "%d bytes transferred in %d seconds, %4.1fk/s" % (size, elapsed, throughput / 1000.0)
def download_decode(file, url, mak, ar):
@ -248,6 +254,7 @@ for i in items:
url = getTagText(i, "Url")
inprogress = getTagText(i, "InProgress")
available = getTagText(i, "Available")
sourcesize = int(getTagText(i, "SourceSize"))
if episode == "":
episode = date
name = "%s - %s" % (title, episode)
@ -269,12 +276,12 @@ for i in items:
print "*** skipping \"%s\": is not available" % name
continue
if downloaddb.has_key(name):
print "*** skipping \"%s\": already downloaded" % name
#print "*** skipping \"%s\": already downloaded" % name
continue
if excludes.has_key(title) or excludes.has_key(episode) or excludes.has_key(name):
print "*** skipping \"%s\": excluded" % name
continue
print "*** downloading \"%s\"" % name
print "*** downloading \"%s\": %.3fGB" % (name, sourcesize / 1e9)
try:
download_decode(file, url, mak, ar)
downloaddb[name] = date