Exceptions loggen; jetzt ist tivomirror silent (-v verwenden)

This commit is contained in:
Stefan Bethke 2014-07-01 17:04:17 +00:00
parent 8cd90d5984
commit cc0e499908

View file

@ -1,6 +1,6 @@
#!/usr/local/bin/python #!/usr/local/bin/python
# $Schlepperbande: src/tivomirror/tivomirror,v 1.57 2014/07/01 07:04:45 stb Exp $ # $Schlepperbande: src/tivomirror/tivomirror,v 1.58 2014/07/01 16:57:33 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.
@ -386,31 +386,34 @@ def main():
handler.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')) handler.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
logger.addHandler(handler) logger.addHandler(handler)
options, remainder = getopt.getopt(sys.argv[1:], 'dvT', try:
['ignoreepisodetitle']) options, remainder = getopt.getopt(sys.argv[1:], 'dvT',
['ignoreepisodetitle'])
for opt, arg in options: for opt, arg in options:
if opt in ('-T', '--ignoreepisodetitle'): if opt in ('-T', '--ignoreepisodetitle'):
ignoreepisodetitle = True ignoreepisodetitle = True
if opt in ('-d'): if opt in ('-d'):
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
if opt in ('-v'): if opt in ('-v'):
handler = logging.StreamHandler() handler = logging.StreamHandler()
logger.addHandler(handler) logger.addHandler(handler)
downloaddb = anydbm.open("downloads.db", "c") downloaddb = anydbm.open("downloads.db", "c")
logger.info("*** Getting listing") logger.info("*** Getting listing")
dom = gettoc() dom = gettoc()
savetoc(dom) savetoc(dom)
if len(remainder) == 1: if len(remainder) == 1:
if remainder[0] == "list": if remainder[0] == "list":
printtoc(dom, downloaddb) printtoc(dom, downloaddb)
elif remainder[0] == "mirror": elif remainder[0] == "mirror":
mirror(dom, downloaddb)
else:
mirror(dom, downloaddb) mirror(dom, downloaddb)
else:
mirror(dom, downloaddb)
downloaddb.close() downloaddb.close()
except Exception:
logger.exception("")
logger.info("*** Completed") logger.info("*** Completed")
if __name__ == "__main__": if __name__ == "__main__":