allow custom aprams in auto fork Fixes #501 Improve exceptions Fixes #527

This commit is contained in:
clinton-hall 2014-08-09 09:54:56 +09:30
commit 8e073de00a
5 changed files with 10 additions and 7 deletions

View file

@ -161,7 +161,7 @@ class autoProcessMovie:
if os.path.isdir(SpecificPath):
dirName = SpecificPath
process_all_exceptions(inputName.lower(), dirName)
process_all_exceptions(inputName, dirName)
inputName, dirName = convert_to_ascii(inputName, dirName)
if not listMediaFiles(dirName, media=True, audio=False, meta=False, archives=False) and listMediaFiles(dirName, media=False, audio=False, meta=False, archives=True) and extract:

View file

@ -77,7 +77,7 @@ class autoProcessMusic:
if os.path.isdir(SpecificPath):
dirName = SpecificPath
process_all_exceptions(inputName.lower(), dirName)
process_all_exceptions(inputName, dirName)
inputName, dirName = convert_to_ascii(inputName, dirName)
if not listMediaFiles(dirName, media=False, audio=True, meta=False, archives=False) and listMediaFiles(dirName, media=False, audio=False, meta=False, archives=True) and extract:

View file

@ -136,7 +136,7 @@ class autoProcessTV:
if fork not in nzbtomedia.SICKBEARD_TORRENT or (clientAgent in ['nzbget','sabnzbd'] and nzbExtractionBy != "Destination"):
if inputName:
process_all_exceptions(inputName.lower(), dirName)
process_all_exceptions(inputName, dirName)
inputName, dirName = convert_to_ascii(inputName, dirName)
# Now check if tv files exist in destination.

View file

@ -61,6 +61,8 @@ def autoFork(section, inputCategory):
fork = ['default', {}]
elif fork == "auto":
params = nzbtomedia.ALL_FORKS
rem_params = []
logger.info("Attempting to auto-detect %s fork" % inputCategory)
# define the order to test. Default must be first since the default fork doesn't reject parameters.
# then in order of most unique parameters.
@ -74,8 +76,6 @@ def autoFork(section, inputCategory):
except requests.ConnectionError:
logger.info("Could not connect to %s:%s to perform auto-fork detection!" % (section, inputCategory))
if r.ok:
params = nzbtomedia.ALL_FORKS
rem_params = []
for param in params:
if not 'name="%s"' %(param) in r.text:
rem_params.append(param)
@ -87,6 +87,9 @@ def autoFork(section, inputCategory):
break
if detected:
logger.info("%s:%s fork auto-detection successful ..." % (section, inputCategory))
elif rem_params:
logger.info("%s:%s fork auto-detection found custom params %s" % (section, inputCategory, params))
fork = ['custom', params]
else:
logger.info("%s:%s fork auto-detection failed" % (section, inputCategory))
fork = nzbtomedia.FORKS.items()[nzbtomedia.FORKS.keys().index(nzbtomedia.FORK_DEFAULT)]

View file

@ -32,10 +32,10 @@ def process_all_exceptions(name, dirname):
def replace_filename(filename, dirname, name):
head, fileExtension = os.path.splitext(os.path.basename(filename))
if media_pattern.search(os.path.basename(dirname)) is not None:
if media_pattern.search(os.path.basename(dirname).replace(' ','.')) is not None:
newname = os.path.basename(dirname)
logger.debug("Replacing file name %s with directory name %s" % (head, newname), "EXCEPTION")
elif media_pattern.search(name) is not None:
elif media_pattern.search(name.replace(' ','.').lower()) is not None:
newname = name
logger.debug("Replacing file name %s with download name %s" % (head, newname), "EXCEPTION")
else: