Refactor OUTPUTDIRECTORY -> OUTPUT_DIRECTORY

This commit is contained in:
Labrys of Knossos 2019-01-19 00:14:48 -05:00
commit a24367113b
3 changed files with 8 additions and 8 deletions

View file

@ -114,13 +114,13 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp
basename = os.path.basename(input_directory) basename = os.path.basename(input_directory)
basename = core.sanitize_name(input_name) \ basename = core.sanitize_name(input_name) \
if input_name == basename else os.path.splitext(core.sanitize_name(input_name))[0] if input_name == basename else os.path.splitext(core.sanitize_name(input_name))[0]
output_destination = os.path.join(core.OUTPUTDIRECTORY, input_category, basename) output_destination = os.path.join(core.OUTPUT_DIRECTORY, input_category, basename)
elif unique_path: elif unique_path:
output_destination = os.path.normpath( output_destination = os.path.normpath(
core.os.path.join(core.OUTPUTDIRECTORY, input_category, core.sanitize_name(input_name).replace(' ', '.'))) core.os.path.join(core.OUTPUT_DIRECTORY, input_category, core.sanitize_name(input_name).replace(' ', '.')))
else: else:
output_destination = os.path.normpath( output_destination = os.path.normpath(
core.os.path.join(core.OUTPUTDIRECTORY, input_category)) core.os.path.join(core.OUTPUT_DIRECTORY, input_category))
try: try:
output_destination = output_destination.encode(core.SYS_ENCODING) output_destination = output_destination.encode(core.SYS_ENCODING)
except UnicodeError: except UnicodeError:

View file

@ -140,7 +140,7 @@ NZB_DEFAULTDIR = None
TORRENT_CLIENTAGENT = None TORRENT_CLIENTAGENT = None
TORRENT_CLASS = None TORRENT_CLASS = None
USE_LINK = None USE_LINK = None
OUTPUTDIRECTORY = None OUTPUT_DIRECTORY = None
NOFLATTEN = [] NOFLATTEN = []
DELETE_ORIGINAL = None DELETE_ORIGINAL = None
TORRENT_CHMOD_DIRECTORY = None TORRENT_CHMOD_DIRECTORY = None
@ -255,7 +255,7 @@ def initialize(section=None):
global NZBGET_POSTPROCESS_ERROR, NZBGET_POSTPROCESS_NONE, NZBGET_POSTPROCESS_PAR_CHECK, NZBGET_POSTPROCESS_SUCCESS, \ global NZBGET_POSTPROCESS_ERROR, NZBGET_POSTPROCESS_NONE, NZBGET_POSTPROCESS_PAR_CHECK, NZBGET_POSTPROCESS_SUCCESS, \
NZBTOMEDIA_TIMEOUT, FORKS, FORK_DEFAULT, FORK_FAILED_TORRENT, FORK_FAILED, NOEXTRACTFAILED, SHOWEXTRACT, \ NZBTOMEDIA_TIMEOUT, FORKS, FORK_DEFAULT, FORK_FAILED_TORRENT, FORK_FAILED, NOEXTRACTFAILED, SHOWEXTRACT, \
NZBTOMEDIA_BRANCH, NZBTOMEDIA_VERSION, NEWEST_VERSION, NEWEST_VERSION_STRING, VERSION_NOTIFY, SYS_ARGV, CFG, \ NZBTOMEDIA_BRANCH, NZBTOMEDIA_VERSION, NEWEST_VERSION, NEWEST_VERSION_STRING, VERSION_NOTIFY, SYS_ARGV, CFG, \
SABNZB_NO_OF_ARGUMENTS, SABNZB_0717_NO_OF_ARGUMENTS, CATEGORIES, TORRENT_CLIENTAGENT, USE_LINK, OUTPUTDIRECTORY, \ SABNZB_NO_OF_ARGUMENTS, SABNZB_0717_NO_OF_ARGUMENTS, CATEGORIES, TORRENT_CLIENTAGENT, USE_LINK, OUTPUT_DIRECTORY, \
NOFLATTEN, UTORRENT_PASSWORD, UTORRENT_USER, UTORRENT_WEB_UI, DELUGE_HOST, DELUGE_PORT, DELUGE_USER, DELUGE_PASSWORD, VLEVEL, \ NOFLATTEN, UTORRENT_PASSWORD, UTORRENT_USER, UTORRENT_WEB_UI, DELUGE_HOST, DELUGE_PORT, DELUGE_USER, DELUGE_PASSWORD, VLEVEL, \
TRANSMISSION_HOST, TRANSMISSION_PORT, TRANSMISSION_PASSWORD, TRANSMISSION_USER, COMPRESSEDCONTAINER, MEDIACONTAINER, \ TRANSMISSION_HOST, TRANSMISSION_PORT, TRANSMISSION_PASSWORD, TRANSMISSION_USER, COMPRESSEDCONTAINER, MEDIACONTAINER, \
METACONTAINER, SECTIONS, ALL_FORKS, TEST_FILE, GENERALOPTS, LOG_GIT, GROUPS, SEVENZIP, CONCAT, VCRF, \ METACONTAINER, SECTIONS, ALL_FORKS, TEST_FILE, GENERALOPTS, LOG_GIT, GROUPS, SEVENZIP, CONCAT, VCRF, \
@ -394,7 +394,7 @@ def initialize(section=None):
TORRENT_CLIENTAGENT = CFG['Torrent']['clientAgent'] # utorrent | deluge | transmission | rtorrent | vuze | qbittorrent |other TORRENT_CLIENTAGENT = CFG['Torrent']['clientAgent'] # utorrent | deluge | transmission | rtorrent | vuze | qbittorrent |other
USE_LINK = CFG['Torrent']['useLink'] # no | hard | sym USE_LINK = CFG['Torrent']['useLink'] # no | hard | sym
OUTPUTDIRECTORY = CFG['Torrent']['outputDirectory'] # /abs/path/to/complete/ OUTPUT_DIRECTORY = CFG['Torrent']['outputDirectory'] # /abs/path/to/complete/
TORRENT_DEFAULTDIR = CFG['Torrent']['default_downloadDirectory'] TORRENT_DEFAULTDIR = CFG['Torrent']['default_downloadDirectory']
CATEGORIES = (CFG['Torrent']['categories']) # music,music_videos,pictures,software CATEGORIES = (CFG['Torrent']['categories']) # music,music_videos,pictures,software
NOFLATTEN = (CFG['Torrent']['noFlatten']) NOFLATTEN = (CFG['Torrent']['noFlatten'])

View file

@ -102,11 +102,11 @@ def get_dirs(section, subsection, link='hard'):
if core.USE_LINK == 'move': if core.USE_LINK == 'move':
try: try:
output_directory = os.path.join(core.OUTPUTDIRECTORY, subsection) output_directory = os.path.join(core.OUTPUT_DIRECTORY, subsection)
if os.path.exists(output_directory): if os.path.exists(output_directory):
to_return.extend(process_dir(output_directory, link)) to_return.extend(process_dir(output_directory, link))
except Exception as e: except Exception as e:
logger.error('Failed to add directories from {0} for post-processing: {1}'.format(core.OUTPUTDIRECTORY, e)) logger.error('Failed to add directories from {0} for post-processing: {1}'.format(core.OUTPUT_DIRECTORY, e))
if not to_return: if not to_return:
logger.debug('No directories identified in {0}:{1} for post-processing'.format(section, subsection)) logger.debug('No directories identified in {0}:{1} for post-processing'.format(section, subsection))