mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Fixed create_destination
This commit is contained in:
parent
8ebc2648d4
commit
3e952ba035
3 changed files with 24 additions and 20 deletions
|
@ -129,16 +129,6 @@ def is_sample(filePath, inputName, minSampleSize):
|
|||
return ('sample' in filePath.lower()) and (not 'sample' in inputName) and (os.path.getsize(filePath) < SIZE_CUTOFF)
|
||||
|
||||
|
||||
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 copy_link(source, target, useLink, outputDestination):
|
||||
create_destination(outputDestination)
|
||||
if useLink:
|
||||
|
|
|
@ -2,6 +2,7 @@ import os
|
|||
import sys
|
||||
import logging
|
||||
from subprocess import call
|
||||
from nzbToMediaUtil import create_destination
|
||||
|
||||
|
||||
Logger = logging.getLogger()
|
||||
|
@ -100,6 +101,9 @@ def extract(dirpath, file, outputDestination):
|
|||
Logger.debug("EXTRACTOR: Unknown file type: %s", ext[1])
|
||||
return False
|
||||
|
||||
# Create outputDestination folder
|
||||
create_destination(outputDestination)
|
||||
|
||||
Logger.info("Extracting %s to %s", filePath, outputDestination)
|
||||
Logger.debug("Extracting %s %s %s", cmd, filePath, outputDestination)
|
||||
pwd = os.getcwd() # Get our Present Working Directory
|
||||
|
|
|
@ -5,12 +5,22 @@ import sys
|
|||
|
||||
|
||||
def nzbtomedia_configure_logging(dirname):
|
||||
logFile = os.path.join(dirname, "postprocess.log")
|
||||
logging.config.fileConfig(os.path.join(dirname, "autoProcessMedia.cfg"))
|
||||
fileHandler = logging.FileHandler(logFile, encoding='utf-8', delay=True)
|
||||
fileHandler.formatter = logging.Formatter('%(asctime)s|%(levelname)-7.7s %(message)s', '%H:%M:%S')
|
||||
fileHandler.level = logging.DEBUG
|
||||
logging.getLogger().addHandler(fileHandler)
|
||||
logFile = os.path.join(dirname, "postprocess.log")
|
||||
logging.config.fileConfig(os.path.join(dirname, "autoProcessMedia.cfg"))
|
||||
fileHandler = logging.FileHandler(logFile, encoding='utf-8', delay=True)
|
||||
fileHandler.formatter = logging.Formatter('%(asctime)s|%(levelname)-7.7s %(message)s', '%H:%M:%S')
|
||||
fileHandler.level = logging.DEBUG
|
||||
logging.getLogger().addHandler(fileHandler)
|
||||
|
||||
|
||||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue