mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 22:03:13 -07:00
Less indenting, no duped functioned :)
This commit is contained in:
parent
24b24e140e
commit
b7b7fa9fe8
1 changed files with 13 additions and 19 deletions
|
@ -4,6 +4,9 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
Logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def nzbtomedia_configure_logging(dirname):
|
def nzbtomedia_configure_logging(dirname):
|
||||||
logFile = os.path.join(dirname, "postprocess.log")
|
logFile = os.path.join(dirname, "postprocess.log")
|
||||||
logging.config.fileConfig(os.path.join(dirname, "autoProcessMedia.cfg"))
|
logging.config.fileConfig(os.path.join(dirname, "autoProcessMedia.cfg"))
|
||||||
|
@ -14,23 +17,14 @@ def nzbtomedia_configure_logging(dirname):
|
||||||
|
|
||||||
|
|
||||||
def create_destination(outputDestination):
|
def create_destination(outputDestination):
|
||||||
if not os.path.exists(outputDestination):
|
if os.path.exists(outputDestination):
|
||||||
try:
|
return
|
||||||
Logger.info("CREATE DESTINATION: Creating destination folder: %s", outputDestination)
|
try:
|
||||||
os.makedirs(outputDestination)
|
Logger.info("CREATE DESTINATION: Creating destination folder: %s", outputDestination)
|
||||||
except Exception, e:
|
os.makedirs(outputDestination)
|
||||||
Logger.error("CREATE DESTINATION: Not possible to create destination folder: %s. Exiting", e)
|
except Exception, e:
|
||||||
sys.exit(-1)
|
Logger.error("CREATE DESTINATION: Not possible to create destination folder: %s. Exiting", e)
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
def create_destination(outputDestination):
|
|
||||||
if not os.path.exists(outputDestination):
|
|
||||||
try:
|
|
||||||
Logger.info("CREATE DESTINATION: Creating destination folder: %s", outputDestination)
|
|
||||||
os.makedirs(outputDestination)
|
|
||||||
except Exception, e:
|
|
||||||
Logger.error("CREATE DESTINATION: Not possible to create destination folder: %s. Exiting", e)
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_other(args):
|
def parse_other(args):
|
||||||
|
@ -57,7 +51,7 @@ def parse_deluge(args):
|
||||||
# Deluge usage: call TorrentToMedia.py TORRENT_ID TORRENT_NAME TORRENT_DIR
|
# 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
|
||||||
inputHash = ''
|
inputHash = ''
|
||||||
return inputDirectory, inputName, inputCategory, inputHash
|
return inputDirectory, inputName, inputCategory, inputHash
|
||||||
|
|
||||||
|
@ -66,7 +60,7 @@ def parse_transmission(args):
|
||||||
# Transmission usage: call TorrenToMedia.py (%TR_TORRENT_DIR% %TR_TORRENT_NAME% is passed on as environmental variables)
|
# Transmission usage: call TorrenToMedia.py (%TR_TORRENT_DIR% %TR_TORRENT_NAME% is passed on as environmental variables)
|
||||||
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
|
||||||
inputHash = ''
|
inputHash = ''
|
||||||
return inputDirectory, inputName, inputCategory, inputHash
|
return inputDirectory, inputName, inputCategory, inputHash
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue