Refactor USELINK -> USE_LINK

This commit is contained in:
Labrys of Knossos 2019-01-19 00:13:51 -05:00
commit 28f1bc35c5
6 changed files with 9 additions and 9 deletions

View file

@ -196,7 +196,7 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp
if torrent_no_link == 0: if torrent_no_link == 0:
try: try:
core.copy_link(inputFile, target_file, core.USELINK) core.copy_link(inputFile, target_file, core.USE_LINK)
core.remove_read_only(target_file) core.remove_read_only(target_file)
except Exception: except Exception:
logger.error('Failed to link: {0} to {1}'.format(inputFile, target_file)) logger.error('Failed to link: {0} to {1}'.format(inputFile, target_file))
@ -270,7 +270,7 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp
core.update_download_info_status(input_name, 1) core.update_download_info_status(input_name, 1)
# remove torrent # remove torrent
if core.USELINK == 'move-sym' and not core.DELETE_ORIGINAL == 1: if core.USE_LINK == 'move-sym' and not core.DELETE_ORIGINAL == 1:
logger.debug('Checking for sym-links to re-direct in: {0}'.format(input_directory)) logger.debug('Checking for sym-links to re-direct in: {0}'.format(input_directory))
for dirpath, dirs, files in os.walk(input_directory): for dirpath, dirs, files in os.walk(input_directory):
for file in files: for file in files:

View file

@ -139,7 +139,7 @@ NZB_DEFAULTDIR = None
TORRENT_CLIENTAGENT = None TORRENT_CLIENTAGENT = None
TORRENT_CLASS = None TORRENT_CLASS = None
USELINK = None USE_LINK = None
OUTPUTDIRECTORY = None OUTPUTDIRECTORY = None
NOFLATTEN = [] NOFLATTEN = []
DELETE_ORIGINAL = None DELETE_ORIGINAL = 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, USELINK, OUTPUTDIRECTORY, \ SABNZB_NO_OF_ARGUMENTS, SABNZB_0717_NO_OF_ARGUMENTS, CATEGORIES, TORRENT_CLIENTAGENT, USE_LINK, OUTPUTDIRECTORY, \
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, \
@ -393,7 +393,7 @@ def initialize(section=None):
GROUPS = None GROUPS = 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
USELINK = CFG['Torrent']['useLink'] # no | hard | sym USE_LINK = CFG['Torrent']['useLink'] # no | hard | sym
OUTPUTDIRECTORY = CFG['Torrent']['outputDirectory'] # /abs/path/to/complete/ OUTPUTDIRECTORY = 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

View file

@ -152,7 +152,7 @@ def process(section, dir_name, input_name=None, status=0, client_agent='manual',
if not release and '.cp(tt' not in video and imdbid: if not release and '.cp(tt' not in video and imdbid:
video_name, video_ext = os.path.splitext(video) video_name, video_ext = os.path.splitext(video)
video2 = '{0}.cp({1}){2}'.format(video_name, imdbid, video_ext) video2 = '{0}.cp({1}){2}'.format(video_name, imdbid, video_ext)
if not (client_agent in [core.TORRENT_CLIENTAGENT, 'manual'] and core.USELINK == 'move-sym'): if not (client_agent in [core.TORRENT_CLIENTAGENT, 'manual'] and core.USE_LINK == 'move-sym'):
logger.debug('Renaming: {0} to: {1}'.format(video, video2)) logger.debug('Renaming: {0} to: {1}'.format(video, video2))
os.rename(video, video2) os.rename(video, video2)

View file

@ -47,7 +47,7 @@ def process(section, dir_name, input_name=None, failed=False, client_agent='manu
delete_failed = int(cfg.get('delete_failed', 0)) delete_failed = int(cfg.get('delete_failed', 0))
nzb_extraction_by = cfg.get('nzbExtractionBy', 'Downloader') nzb_extraction_by = cfg.get('nzbExtractionBy', 'Downloader')
process_method = cfg.get('process_method') process_method = cfg.get('process_method')
if client_agent == core.TORRENT_CLIENTAGENT and core.USELINK == 'move-sym': if client_agent == core.TORRENT_CLIENTAGENT and core.USE_LINK == 'move-sym':
process_method = 'symlink' process_method = 'symlink'
remote_path = int(cfg.get('remote_path', 0)) remote_path = int(cfg.get('remote_path', 0))
wait_for = int(cfg.get('wait_for', 2)) wait_for = int(cfg.get('wait_for', 2))

View file

@ -100,7 +100,7 @@ def get_dirs(section, subsection, link='hard'):
except Exception as e: except Exception as e:
logger.error('Failed to add directories from {0} for post-processing: {1}'.format(watch_directory, e)) logger.error('Failed to add directories from {0} for post-processing: {1}'.format(watch_directory, e))
if core.USELINK == 'move': if core.USE_LINK == 'move':
try: try:
output_directory = os.path.join(core.OUTPUTDIRECTORY, subsection) output_directory = os.path.join(core.OUTPUTDIRECTORY, subsection)
if os.path.exists(output_directory): if os.path.exists(output_directory):

View file

@ -85,7 +85,7 @@ def resume_torrent(client_agent, input_hash, input_id, input_name):
def remove_torrent(client_agent, input_hash, input_id, input_name): def remove_torrent(client_agent, input_hash, input_id, input_name):
if core.DELETE_ORIGINAL == 1 or core.USELINK == 'move': if core.DELETE_ORIGINAL == 1 or core.USE_LINK == 'move':
logger.debug('Deleting torrent {0} from {1}'.format(input_name, client_agent)) logger.debug('Deleting torrent {0} from {1}'.format(input_name, client_agent))
try: try:
if client_agent == 'utorrent' and core.TORRENT_CLASS != '': if client_agent == 'utorrent' and core.TORRENT_CLASS != '':