Excludes angepasst, Download von Transcoding trennen, nach einem erfolgreichen Download stoppen, damit der Tivo Luft holen kann.

This commit is contained in:
Stefan Bethke 2010-07-12 05:50:43 +00:00
parent 46245a8c99
commit c290f91548

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# $Schlepperbande: src/tivomirror/tivomirror,v 1.26 2010/06/27 11:36:21 stb Exp $ # $Schlepperbande: src/tivomirror/tivomirror,v 1.27 2010/07/04 10:06:46 stb Exp $
# #
# Stefans Script, um die Sendungen vom Tivo runterzuladen und in MPEG4 # Stefans Script, um die Sendungen vom Tivo runterzuladen und in MPEG4
# zu transkodieren. # zu transkodieren.
@ -35,9 +35,10 @@ arset["House"] = 43
excludes = dict() excludes = dict()
excludes['Cops'] = 1 excludes['Cops'] = 1
excludes['Hot Pursuit'] = 1 excludes['Hot Pursuit'] = 1
excludes['Most Shocking'] = 1
excludes["World's Wildest Police Videos"] = 1 excludes["World's Wildest Police Videos"] = 1
excludes["World Cup Soccer"] = 1 #excludes["World Cup Soccer"] = 1
excludes["World Cup Live"] = 1 #excludes["World Cup Live"] = 1
class flushfile(object): class flushfile(object):
def __init__(self, f): def __init__(self, f):
@ -130,18 +131,8 @@ def transcode(file, src, passno, ar):
print " %s" % " ".join(transcode_opts) print " %s" % " ".join(transcode_opts)
subprocess.check_call(transcode_opts) subprocess.check_call(transcode_opts)
def download(file, url, mak, target):
def download_decode(file, url, mak, ar): print "--- dowloading \"%s\"" % (url)
#target = tmpmp2
target = "%s.mpg" % file
try:
os.makedirs(dir)
except OSError:
pass
if os.path.exists(target):
print " reusing existing download file"
else:
print "--- dowloading \"%s\" (ar %s)" % (url, ar)
p_curl = subprocess.Popen(["curl", "--anyauth", "--fail", \ p_curl = subprocess.Popen(["curl", "--anyauth", "--fail", \
"--insecure", "--cookie", "tivo/.cookies.txt", \ "--insecure", "--cookie", "tivo/.cookies.txt", \
"--silent", "--show-error", \ "--silent", "--show-error", \
@ -166,6 +157,18 @@ def download_decode(file, url, mak, ar):
print "error transcoding file: too small" print "error transcoding file: too small"
os.remove(target) os.remove(target)
raise OSError raise OSError
def download_decode(file, url, mak, ar):
#target = tmpmp2
target = "%s.mpg" % file
try:
os.makedirs(dir)
except OSError:
pass
#if os.path.exists(target):
# print " reusing existing download file"
#else:
download(file, url, mak, target)
return return
transcode(file, target, 1, ar) transcode(file, target, 1, ar)
transcode(file, target, 2, ar) transcode(file, target, 2, ar)
@ -230,6 +233,8 @@ for i in items:
downloaddb[name] = date downloaddb[name] = date
if getattr(downloaddb, "sync", None) and callable(downloaddb.sync): if getattr(downloaddb, "sync", None) and callable(downloaddb.sync):
downloaddb.sync() downloaddb.sync()
# stop after the fist successful download since the tivo hangs easily
break
except: except:
print "Error processing \"%s\"" % name print "Error processing \"%s\"" % name
print "*** Completed" print "*** Completed"