mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-07 21:51:11 -07:00
fixed indentation and some minor cleanup
This commit is contained in:
parent
d78aab5d77
commit
b01ca87bbe
2 changed files with 328 additions and 333 deletions
|
@ -413,9 +413,8 @@ sys.stdout = log_file
|
||||||
# Hardlink solution with uTorrent
|
# Hardlink solution with uTorrent
|
||||||
if inputHash and useLink:
|
if inputHash and useLink:
|
||||||
Logger.debug("MAIN: We are using hardlinks with uTorrent, calling uTorrent to pause download")
|
Logger.debug("MAIN: We are using hardlinks with uTorrent, calling uTorrent to pause download")
|
||||||
utorrentClass = UTorrentClient(uTorrentWEBui, uTorrentUSR, uTorrentPWD)
|
|
||||||
utorrentClass.stop(inputHash)
|
utorrentClass.stop(inputHash)
|
||||||
time.sleep(5)
|
time.sleep(5) # Give uTorrent some time to catch up with the change
|
||||||
|
|
||||||
if inputCategory == movieCategory:
|
if inputCategory == movieCategory:
|
||||||
Logger.info("MAIN: Calling postprocessing script for CouchPotatoServer")
|
Logger.info("MAIN: Calling postprocessing script for CouchPotatoServer")
|
||||||
|
|
|
@ -3,6 +3,7 @@ import logging.config
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from utorrent.client import UTorrentClient
|
||||||
|
|
||||||
def nzbtomedia_configure_logging(dirname):
|
def nzbtomedia_configure_logging(dirname):
|
||||||
logFile = os.path.join(dirname, "postprocess.log")
|
logFile = os.path.join(dirname, "postprocess.log")
|
||||||
|
@ -12,37 +13,33 @@ def nzbtomedia_configure_logging(dirname):
|
||||||
fileHandler.level = logging.DEBUG
|
fileHandler.level = logging.DEBUG
|
||||||
logging.getLogger().addHandler(fileHandler)
|
logging.getLogger().addHandler(fileHandler)
|
||||||
|
|
||||||
|
|
||||||
def parse_other(args):
|
def parse_other(args):
|
||||||
return os.path.normpath(sys.argv[1]), '', ''
|
return os.path.normpath(sys.argv[1]), '', ''
|
||||||
|
|
||||||
|
|
||||||
def parse_utorrent(args):
|
def parse_utorrent(args):
|
||||||
# We will pass in 'utorrent' '%D', '%N', and '%L' (if it exists), from uTorrent
|
# uTorrent usage: call TorrentToMedia.py "%D" "%N" "%L" "%I"
|
||||||
# In short pass "/path/to/downloaded/torrent/ name" to TorrentToMedia.py, eg >>>> TorrentToMedia.py /Downloaded/MovieName.2013.BluRay.1080p.x264-10bit.DTS MovieName.2013.BluRay.1080p.x264-10bit.DTS <<<<
|
|
||||||
inputDirectory = os.path.normpath(sys.argv[2])
|
inputDirectory = os.path.normpath(sys.argv[2])
|
||||||
inputName = sys.argv[3]
|
inputName = sys.argv[3]
|
||||||
try: #assume we have a label.
|
try:
|
||||||
inputCategory = sys.argv[4] # We dont have a category yet
|
inputCategory = sys.argv[4]
|
||||||
except:
|
except:
|
||||||
inputCategory = '' # We dont have a category yet
|
inputCategory = ''
|
||||||
|
inputHash = sys.argv[5]
|
||||||
|
if inputHash and useLink:
|
||||||
|
utorrentClass = UTorrentClient(uTorrentWEBui, uTorrentUSR, uTorrentPWD)
|
||||||
|
|
||||||
def parse_deluge(args):
|
def parse_deluge(args):
|
||||||
# We will assume this to be the passin from deluge. torrent id, torrent name, torrent save path.
|
# Deluge usage: call TorrentToMedia.py TORRENT_ID TORRENT_NAME TORRENT_DIR
|
||||||
inputDirectory = os.path.normpath(sys.argv[3])
|
inputDirectory = os.path.normpath(sys.argv[3])
|
||||||
inputName = sys.argv[2]
|
inputName = sys.argv[2]
|
||||||
inputCategory = '' # We dont have a category yet
|
inputCategory = '' # We dont have a category yet
|
||||||
|
|
||||||
|
|
||||||
def parse_transmission(args):
|
def parse_transmission(args):
|
||||||
# We will pass in %TR_TORRENT_DIR% %TR_TORRENT_NAME% from Transmission
|
# Transmission usage: call TorrenToMedia.py (%TR_TORRENT_DIR% %TR_TORRENT_NAME% is passed on as environmental variables)
|
||||||
# In short pass "/path/to/downloaded/torrent/ name" to TorrentToMedia.py, eg >>>> TorrentToMedia.py /Downloaded/MovieName.2013.BluRay.1080p.x264-10bit.DTS MovieName.2013.BluRay.1080p.x264-10bit.DTS <<<<
|
|
||||||
inputDirectory = os.path.normpath(os.getenv('TR_TORRENT_DIR'))
|
inputDirectory = os.path.normpath(os.getenv('TR_TORRENT_DIR'))
|
||||||
inputName = os.getenv('TR_TORRENT_NAME')
|
inputName = os.getenv('TR_TORRENT_NAME')
|
||||||
inputCategory = '' # We dont have a category yet
|
inputCategory = '' # We dont have a category yet
|
||||||
|
|
||||||
|
|
||||||
__ARG_PARSERS__ = {
|
__ARG_PARSERS__ = {
|
||||||
'other': parse_other,
|
'other': parse_other,
|
||||||
'utorrent': parse_utorrent,
|
'utorrent': parse_utorrent,
|
||||||
|
@ -50,7 +47,6 @@ __ARG_PARSERS__ = {
|
||||||
'transmission': parse_transmission,
|
'transmission': parse_transmission,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def parse_args(clientAgent):
|
def parse_args(clientAgent):
|
||||||
parseFunc = __ARG_PARSERS__.get(clientAgent, None)
|
parseFunc = __ARG_PARSERS__.get(clientAgent, None)
|
||||||
if not parseFunc:
|
if not parseFunc:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue