Changed r.content to r.text

This commit is contained in:
echel0n 2014-04-03 21:08:51 -07:00
commit 8e7490ff80
7 changed files with 21 additions and 18 deletions

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
import time
import datetime import datetime
import logging import logging
import os import os
@ -123,7 +124,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
TransmissionClass.stop_torrent(inputID) TransmissionClass.stop_torrent(inputID)
if clientAgent == 'deluge' and delugeClient != "": if clientAgent == 'deluge' and delugeClient != "":
delugeClient.core.pause_torrent([inputID]) 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) Logger.debug("MAIN: Scanning files in directory: %s", inputDirectory)
@ -342,7 +343,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
TransmissionClass.start_torrent(inputID) TransmissionClass.start_torrent(inputID)
if clientAgent == 'deluge' and delugeClient != "": if clientAgent == 'deluge' and delugeClient != "":
delugeClient.core.resume_torrent([inputID]) delugeClient.core.resume_torrent([inputID])
datetime.time.sleep(5) time.sleep(5)
#cleanup #cleanup
if inputCategory in processCategories and result == 0 and os.path.isdir(outputDestination): if inputCategory in processCategories and result == 0 and os.path.isdir(outputDestination):
num_files_new = int(0) num_files_new = int(0)
@ -419,7 +420,7 @@ def external_script(outputDestination,torrentName,torrentLabel):
result = int(1) result = int(1)
final_result = final_result + result final_result = final_result + result
datetime.time.sleep(user_delay) time.sleep(user_delay)
num_files_new = int(0) num_files_new = int(0)
for dirpath, dirnames, filenames in os.walk(outputDestination): for dirpath, dirnames, filenames in os.walk(outputDestination):
for file in filenames: for file in filenames:

View file

@ -13,12 +13,12 @@ ssl = 0
web_root = web_root =
delay = 65 delay = 65
TimePerGiB = 60 TimePerGiB = 60
watch_dir =
method = renamer method = renamer
delete_failed = 0 delete_failed = 0
wait_for = 2 wait_for = 2
#### Set to 1 if CouchPotatoServer is running on a different server to your NZB client #### Set to 1 if CouchPotatoServer is running on a different server to your NZB client
remoteCPS = 0 remoteCPS = 0
watch_dir =
[SickBeard] [SickBeard]
#### autoProcessing for TV Series #### autoProcessing for TV Series
@ -123,7 +123,7 @@ transcode = 0
duplicate = 1 duplicate = 1
# Only works on Linux. Highest priority is -20, lowest priority is 19. # Only works on Linux. Highest priority is -20, lowest priority is 19.
niceness = 0 niceness = 0
ignoreExtensions = .avi,.mkv ignoreExtensions = .avi,.mkv,.mp4
outputVideoExtension = .mp4 outputVideoExtension = .mp4
outputVideoCodec = libx264 outputVideoCodec = libx264
outputVideoPreset = medium outputVideoPreset = medium

View file

@ -66,7 +66,7 @@ class autoProcessComics:
return 1 # failure return 1 # failure
if r.ok: 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 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 return 0 # Success

View file

@ -62,7 +62,7 @@ class autoProcessGames:
Logger.exception("Unable to open URL") Logger.exception("Unable to open URL")
return 1 # failure return 1 # failure
result = json.load(r.content) result = json.load(r.text)
Logger.info("Gamez returned %s", result) Logger.info("Gamez returned %s", result)
if result['success']: if result['success']:
Logger.info("Status for %s has been set to %s in Gamez", gamezID, downloadStatus) Logger.info("Status for %s has been set to %s in Gamez", gamezID, downloadStatus)

View file

@ -69,7 +69,7 @@ class autoProcessMovie:
release2 = [] release2 = []
moviestatus2 = [] moviestatus2 = []
try: try:
result = json.load(r.content) result = json.load(r.text)
movieid2 = [item["_id"] for item in result["movies"]] movieid2 = [item["_id"] for item in result["movies"]]
for item in result["movies"]: for item in result["movies"]:
if "identifier" in item: if "identifier" in item:
@ -143,7 +143,7 @@ class autoProcessMovie:
return None, None return None, None
try: try:
result = json.load(r.content) result = json.load(r.text)
movie_status = str(result["media"]["status"]) movie_status = str(result["media"]["status"])
Logger.debug("This movie is marked as status %s in CouchPotatoServer", movie_status) Logger.debug("This movie is marked as status %s in CouchPotatoServer", movie_status)
except: except:
@ -260,7 +260,7 @@ class autoProcessMovie:
Logger.exception("Unable to open URL") Logger.exception("Unable to open URL")
return 1 # failure return 1 # failure
result = json.load(r.content) result = json.load(r.text)
Logger.info("CouchPotatoServer returned %s", result) Logger.info("CouchPotatoServer returned %s", result)
if result['success']: if result['success']:
Logger.info("%s scan started on CouchPotatoServer for %s", method, nzbName) Logger.info("%s scan started on CouchPotatoServer for %s", method, nzbName)
@ -288,7 +288,7 @@ class autoProcessMovie:
Logger.exception("Unable to open URL") Logger.exception("Unable to open URL")
return 1 # failure 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) 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]','/','']: if delete_failed and not dirName in ['sys.argv[0]','/','']:
Logger.info("Deleting failed files and folder %s", dirName) 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. 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) Logger.info("SUCCESS: This movie is now marked as status %s in CouchPotatoServer", movie_status)
return 0 # success 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: else:
if release_status and initial_release_status and release_status != initial_release_status: # Something has changed. CPS must have processed this movie. 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) Logger.info("SUCCESS: This release is now marked as status %s in CouchPotatoServer", release_status)

View file

@ -1,4 +1,6 @@
import time
import datetime import datetime
import json
import logging import logging
import socket import socket
import requests import requests
@ -64,7 +66,7 @@ class autoProcessMusic:
Logger.info("Waiting for %s seconds to allow HeadPhones to process newly extracted files", str(delay)) 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) Logger.debug("Opening URL: %s", url)
@ -74,8 +76,8 @@ class autoProcessMusic:
Logger.exception("Unable to open URL") Logger.exception("Unable to open URL")
return 1 # failure return 1 # failure
Logger.info("HeadPhones returned %s", r.content) Logger.info("HeadPhones returned %s", r.text)
if r.content[0] == "OK": if r.text == "OK":
Logger.info("%s started on HeadPhones for %s", command, nzbName) Logger.info("%s started on HeadPhones for %s", command, nzbName)
else: else:
Logger.error("%s has NOT started on HeadPhones for %s. Exiting", command, nzbName) 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") Logger.info("The download failed. Nothing to process")
return 0 # Success (as far as this script is concerned) return 0 # Success (as far as this script is concerned)
if nzbName == "Manual Run": if clientAgent == "manual":
return 0 # success return 0 # success
# we will now wait 1 minutes for this album to be processed before returning to TorrentToMedia and unpausing. # 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... ## Hopefully we can use a "getHistory" check in here to confirm processing complete...
start = datetime.datetime.now() # set time for timeout 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 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. 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.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") # Logger.warning("The album does not appear to have changed status after 2 minutes. Please check HeadPhones Logs")

View file

@ -182,7 +182,7 @@ class autoProcessTV:
Logger.exception("Unable to open URL") Logger.exception("Unable to open URL")
return 1 # failure 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]','/','']: if status != 0 and delete_failed and not dirName in ['sys.argv[0]','/','']:
delete(dirName) delete(dirName)
return 0 # Success return 0 # Success