pause before transcoding and deleting samples.

This commit is contained in:
Clinton Hall 2013-03-11 22:19:00 -07:00
commit 9e3a05c229

View file

@ -105,6 +105,19 @@ def main(inputDirectory, inputName, inputCategory, inputHash):
continue continue
flatten(outputDestination) flatten(outputDestination)
#### quick 'n dirty hardlink solution for uTorrent, need to implent support for deluge, transmission
if not extractionSuccess and inputHash and useLink and clientAgent == 'utorrent':
try:
Logger.debug("MAIN: Connecting to uTorrent: %s", uTorrentWEBui)
utorrentClass = UTorrentClient(uTorrentWEBui, uTorrentUSR, uTorrentPWD)
except Exception as e:
Logger.error("MAIN: Failed to connect to uTorrent: %s", e)
Logger.debug("MAIN: Stoping torrent %s in uTorrent while processing", inputName)
utorrentClass.stop(inputHash)
time.sleep(5) # Give uTorrent some time to catch up with the change
##### quick 'n dirty hardlink solution for uTorrent, need to implent support for deluge, transmission
# Now check if movie files exist in destination: # Now check if movie files exist in destination:
for dirpath, dirnames, filenames in os.walk(outputDestination): for dirpath, dirnames, filenames in os.walk(outputDestination):
for file in filenames: for file in filenames:
@ -121,19 +134,6 @@ def main(inputDirectory, inputName, inputCategory, inputHash):
if video2 >= video and video2 > 0: # Check that all video files were moved if video2 >= video and video2 > 0: # Check that all video files were moved
status = 0 status = 0
processCategories = {cpsCategory, sbCategory, hpCategory, mlCategory}
if inputCategory and not (inputCategory in processCategories): # no extra processign to be done... yet.
Logger.info("MAIN: No further processing to be done for category %s.", inputCategory)
Logger.info("MAIN: All done.")
sys.exit(0)
if status == 0: #### Maybe we should move this to a more appropriate place?
Logger.info("MAIN: Successful run")
Logger.debug("MAIN: Calling autoProcess script for successful download.")
else:
Logger.error("MAIN: Something failed! Please check logs. Exiting")
sys.exit(-1)
#### Delete original files from uTorrent #### Delete original files from uTorrent
if deleteOriginal and clientAgent == 'utorrent': if deleteOriginal and clientAgent == 'utorrent':
try: try:
@ -146,18 +146,16 @@ def main(inputDirectory, inputName, inputCategory, inputHash):
utorrentClass.removedata(inputHash) utorrentClass.removedata(inputHash)
time.sleep(5) # Give uTorrent some time to catch up with the change time.sleep(5) # Give uTorrent some time to catch up with the change
#### quick 'n dirty hardlink solution for uTorrent, need to implent support for deluge, transmission processCategories = {cpsCategory, sbCategory, hpCategory, mlCategory, gzCategory}
if not extractionSuccess and inputHash and useLink and clientAgent == 'utorrent' and not deleteOriginal: if inputCategory and not (inputCategory in processCategories): # no extra processign to be done... yet.
try: Logger.info("MAIN: No further processing to be done for category %s.", inputCategory)
Logger.debug("MAIN: Connecting to uTorrent: %s", uTorrentWEBui) result = 1
utorrentClass = UTorrentClient(uTorrentWEBui, uTorrentUSR, uTorrentPWD) elif status == 0: #### Maybe we should move this to a more appropriate place?
except Exception as e: Logger.info("MAIN: Successful run")
Logger.error("MAIN: Failed to connect to uTorrent: %s", e) Logger.debug("MAIN: Calling autoProcess script for successful download.")
else:
Logger.debug("MAIN: Stoping torrent %s in uTorrent while processing", inputName) Logger.error("MAIN: Something failed! Please check logs. Exiting")
utorrentClass.stop(inputHash) sys.exit(-1)
time.sleep(5) # Give uTorrent some time to catch up with the change
##### quick 'n dirty hardlink solution for uTorrent, need to implent support for deluge, transmission
# Now we pass off to CouchPotato or Sick-Beard # Now we pass off to CouchPotato or Sick-Beard
if inputCategory == cpsCategory: if inputCategory == cpsCategory: