diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 4a3ea7ca..b6f0b25f 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +import time import datetime import logging import os @@ -123,7 +124,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): TransmissionClass.stop_torrent(inputID) if clientAgent == 'deluge' and delugeClient != "": delugeClient.core.pause_torrent([inputID]) - datetime.time.sleep(5) # Give Torrent client some time to catch up with the change + time.sleep(5) # Give Torrent client some time to catch up with the change Logger.debug("MAIN: Scanning files in directory: %s", inputDirectory) @@ -342,7 +343,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): TransmissionClass.start_torrent(inputID) if clientAgent == 'deluge' and delugeClient != "": delugeClient.core.resume_torrent([inputID]) - datetime.time.sleep(5) + time.sleep(5) #cleanup if inputCategory in processCategories and result == 0 and os.path.isdir(outputDestination): num_files_new = int(0) @@ -419,7 +420,7 @@ def external_script(outputDestination,torrentName,torrentLabel): result = int(1) final_result = final_result + result - datetime.time.sleep(user_delay) + time.sleep(user_delay) num_files_new = int(0) for dirpath, dirnames, filenames in os.walk(outputDestination): for file in filenames: diff --git a/autoProcessMedia.cfg.sample b/autoProcessMedia.cfg.sample index 64904fba..0c779f3b 100644 --- a/autoProcessMedia.cfg.sample +++ b/autoProcessMedia.cfg.sample @@ -13,12 +13,12 @@ ssl = 0 web_root = delay = 65 TimePerGiB = 60 -watch_dir = method = renamer delete_failed = 0 wait_for = 2 #### Set to 1 if CouchPotatoServer is running on a different server to your NZB client remoteCPS = 0 +watch_dir = [SickBeard] #### autoProcessing for TV Series @@ -123,7 +123,7 @@ transcode = 0 duplicate = 1 # Only works on Linux. Highest priority is -20, lowest priority is 19. niceness = 0 -ignoreExtensions = .avi,.mkv +ignoreExtensions = .avi,.mkv,.mp4 outputVideoExtension = .mp4 outputVideoCodec = libx264 outputVideoPreset = medium diff --git a/nzbtomedia/autoProcess/autoProcessComics.py b/nzbtomedia/autoProcess/autoProcessComics.py index 353a85ec..5fce575b 100644 --- a/nzbtomedia/autoProcess/autoProcessComics.py +++ b/nzbtomedia/autoProcess/autoProcessComics.py @@ -66,7 +66,7 @@ class autoProcessComics: return 1 # failure if r.ok: - Logger.info("%s", r.content) + Logger.info("%s", r.text) time.sleep(60) #wait 1 minute for now... need to see just what gets logged and how long it takes to process return 0 # Success diff --git a/nzbtomedia/autoProcess/autoProcessGames.py b/nzbtomedia/autoProcess/autoProcessGames.py index 966852c1..e6b1f3b0 100644 --- a/nzbtomedia/autoProcess/autoProcessGames.py +++ b/nzbtomedia/autoProcess/autoProcessGames.py @@ -62,7 +62,7 @@ class autoProcessGames: Logger.exception("Unable to open URL") return 1 # failure - result = json.load(r.content) + result = json.load(r.text) Logger.info("Gamez returned %s", result) if result['success']: Logger.info("Status for %s has been set to %s in Gamez", gamezID, downloadStatus) diff --git a/nzbtomedia/autoProcess/autoProcessMovie.py b/nzbtomedia/autoProcess/autoProcessMovie.py index eda0b998..c58f0aed 100644 --- a/nzbtomedia/autoProcess/autoProcessMovie.py +++ b/nzbtomedia/autoProcess/autoProcessMovie.py @@ -69,7 +69,7 @@ class autoProcessMovie: release2 = [] moviestatus2 = [] try: - result = json.load(r.content) + result = json.load(r.text) movieid2 = [item["_id"] for item in result["movies"]] for item in result["movies"]: if "identifier" in item: @@ -143,7 +143,7 @@ class autoProcessMovie: return None, None try: - result = json.load(r.content) + result = json.load(r.text) movie_status = str(result["media"]["status"]) Logger.debug("This movie is marked as status %s in CouchPotatoServer", movie_status) except: @@ -260,7 +260,7 @@ class autoProcessMovie: Logger.exception("Unable to open URL") return 1 # failure - result = json.load(r.content) + result = json.load(r.text) Logger.info("CouchPotatoServer returned %s", result) if result['success']: Logger.info("%s scan started on CouchPotatoServer for %s", method, nzbName) @@ -288,7 +288,7 @@ class autoProcessMovie: Logger.exception("Unable to open URL") return 1 # failure - Logger.info("%s", r.content) + Logger.info("%s", r.text) Logger.info("Movie %s set to try the next best release on CouchPotatoServer", movie_id) if delete_failed and not dirName in ['sys.argv[0]','/','']: Logger.info("Deleting failed files and folder %s", dirName) @@ -314,7 +314,7 @@ class autoProcessMovie: if movie_status and initial_status and movie_status != initial_status: # Something has changed. CPS must have processed this movie. Logger.info("SUCCESS: This movie is now marked as status %s in CouchPotatoServer", movie_status) return 0 # success - datetime.time.sleep(pause_for) # Just stop this looping infinitely and hogging resources for 2 minutes ;) + time.sleep(pause_for) # Just stop this looping infinitely and hogging resources for 2 minutes ;) else: if release_status and initial_release_status and release_status != initial_release_status: # Something has changed. CPS must have processed this movie. Logger.info("SUCCESS: This release is now marked as status %s in CouchPotatoServer", release_status) diff --git a/nzbtomedia/autoProcess/autoProcessMusic.py b/nzbtomedia/autoProcess/autoProcessMusic.py index e002dad3..9a157797 100644 --- a/nzbtomedia/autoProcess/autoProcessMusic.py +++ b/nzbtomedia/autoProcess/autoProcessMusic.py @@ -1,4 +1,6 @@ +import time import datetime +import json import logging import socket import requests @@ -64,7 +66,7 @@ class autoProcessMusic: Logger.info("Waiting for %s seconds to allow HeadPhones to process newly extracted files", str(delay)) - datetime.time.sleep(delay) + time.sleep(delay) Logger.debug("Opening URL: %s", url) @@ -74,8 +76,8 @@ class autoProcessMusic: Logger.exception("Unable to open URL") return 1 # failure - Logger.info("HeadPhones returned %s", r.content) - if r.content[0] == "OK": + Logger.info("HeadPhones returned %s", r.text) + if r.text == "OK": Logger.info("%s started on HeadPhones for %s", command, nzbName) else: Logger.error("%s has NOT started on HeadPhones for %s. Exiting", command, nzbName) @@ -85,14 +87,14 @@ class autoProcessMusic: Logger.info("The download failed. Nothing to process") return 0 # Success (as far as this script is concerned) - if nzbName == "Manual Run": + if clientAgent == "manual": return 0 # success # we will now wait 1 minutes for this album to be processed before returning to TorrentToMedia and unpausing. ## Hopefully we can use a "getHistory" check in here to confirm processing complete... start = datetime.datetime.now() # set time for timeout while (datetime.datetime.now() - start) < datetime.timedelta(minutes=1): # only wait 2 minutes, then return to TorrentToMedia - datetime.time.sleep(20) # Just stop this looping infinitely and hogging resources for 2 minutes ;) + time.sleep(20) # Just stop this looping infinitely and hogging resources for 2 minutes ;) else: # The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resume seeding now. Logger.info("This album should have completed processing. Please check HeadPhones Logs") # Logger.warning("The album does not appear to have changed status after 2 minutes. Please check HeadPhones Logs") diff --git a/nzbtomedia/autoProcess/autoProcessTV.py b/nzbtomedia/autoProcess/autoProcessTV.py index d10f9a86..06fa8237 100644 --- a/nzbtomedia/autoProcess/autoProcessTV.py +++ b/nzbtomedia/autoProcess/autoProcessTV.py @@ -182,7 +182,7 @@ class autoProcessTV: Logger.exception("Unable to open URL") return 1 # failure - Logger.info("%s", r.content) + Logger.info("%s", r.text) if status != 0 and delete_failed and not dirName in ['sys.argv[0]','/','']: delete(dirName) return 0 # Success