mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 06:13:19 -07:00
Standardize auto-processor usage
This commit is contained in:
parent
0e12fc9ba8
commit
d7b777814a
2 changed files with 51 additions and 33 deletions
|
@ -235,26 +235,35 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp
|
|||
if core.TORRENT_CHMOD_DIRECTORY:
|
||||
core.rchmod(output_destination, core.TORRENT_CHMOD_DIRECTORY)
|
||||
|
||||
result = ProcessResult(
|
||||
message='',
|
||||
status_code=0,
|
||||
)
|
||||
if section_name == 'UserScript':
|
||||
result = external_script(output_destination, input_name, input_category, section)
|
||||
elif section_name in ['CouchPotato', 'Radarr', 'Watcher3']:
|
||||
result = movies.process(section_name, output_destination, input_name, status, client_agent, input_hash, input_category)
|
||||
elif section_name in ['SickBeard', 'SiCKRAGE', 'NzbDrone', 'Sonarr']:
|
||||
if input_hash:
|
||||
else:
|
||||
process_map = {
|
||||
'CouchPotato': movies.process,
|
||||
'Radarr': movies.process,
|
||||
'Watcher3': movies.process,
|
||||
'SickBeard': tv.process,
|
||||
'SiCKRAGE': tv.process,
|
||||
'NzbDrone': tv.process,
|
||||
'Sonarr': tv.process,
|
||||
'LazyLibrarian': books.process,
|
||||
'HeadPhones': music.process,
|
||||
'Lidarr': music.process,
|
||||
'Mylar': comics.process,
|
||||
'Gamez': games.process,
|
||||
}
|
||||
if input_hash and section_name in ['SickBeard', 'SiCKRAGE', 'NzbDrone', 'Sonarr']:
|
||||
input_hash = input_hash.upper()
|
||||
result = tv.process(section_name, output_destination, input_name, status, client_agent, input_hash, input_category)
|
||||
elif section_name in ['HeadPhones', 'Lidarr']:
|
||||
result = music.process(section_name, output_destination, input_name, status, client_agent, input_category)
|
||||
elif section_name == 'Mylar':
|
||||
result = comics.process(section_name, output_destination, input_name, status, client_agent, input_category)
|
||||
elif section_name == 'Gamez':
|
||||
result = games.process(section_name, output_destination, input_name, status, client_agent, input_category)
|
||||
elif section_name == 'LazyLibrarian':
|
||||
result = books.process(section_name, output_destination, input_name, status, client_agent, input_category)
|
||||
processor = process_map[section_name]
|
||||
result = processor(
|
||||
section=section_name,
|
||||
dir_name=output_destination,
|
||||
input_name=input_name,
|
||||
status=status,
|
||||
client_agent=client_agent,
|
||||
download_id=input_hash,
|
||||
input_category=input_category,
|
||||
)
|
||||
|
||||
plex_update(input_category)
|
||||
|
||||
|
|
|
@ -116,24 +116,33 @@ def process(input_directory, input_name=None, status=0, client_agent='manual', d
|
|||
|
||||
logger.info('Calling {0}:{1} to post-process:{2}'.format(section_name, input_category, input_name))
|
||||
|
||||
if section_name in ['CouchPotato', 'Radarr', 'Watcher3']:
|
||||
result = movies.process(section_name, input_directory, input_name, status, client_agent, download_id, input_category, failure_link)
|
||||
elif section_name in ['SickBeard', 'SiCKRAGE', 'NzbDrone', 'Sonarr']:
|
||||
result = tv.process(section_name, input_directory, input_name, status, client_agent, download_id, input_category, failure_link)
|
||||
elif section_name in ['HeadPhones', 'Lidarr']:
|
||||
result = music.process(section_name, input_directory, input_name, status, client_agent, input_category)
|
||||
elif section_name == 'Mylar':
|
||||
result = comics.process(section_name, input_directory, input_name, status, client_agent, input_category)
|
||||
elif section_name == 'Gamez':
|
||||
result = games.process(section_name, input_directory, input_name, status, client_agent, input_category)
|
||||
elif section_name == 'LazyLibrarian':
|
||||
result = books.process(section_name, input_directory, input_name, status, client_agent, input_category)
|
||||
elif section_name == 'UserScript':
|
||||
if section_name == 'UserScript':
|
||||
result = external_script(input_directory, input_name, input_category, section[usercat])
|
||||
else:
|
||||
result = ProcessResult(
|
||||
message='',
|
||||
status_code=-1,
|
||||
process_map = {
|
||||
'CouchPotato': movies.process,
|
||||
'Radarr': movies.process,
|
||||
'Watcher3': movies.process,
|
||||
'SickBeard': tv.process,
|
||||
'SiCKRAGE': tv.process,
|
||||
'NzbDrone': tv.process,
|
||||
'Sonarr': tv.process,
|
||||
'LazyLibrarian': books.process,
|
||||
'HeadPhones': music.process,
|
||||
'Lidarr': music.process,
|
||||
'Mylar': comics.process,
|
||||
'Gamez': games.process,
|
||||
}
|
||||
processor = process_map[section_name]
|
||||
result = processor(
|
||||
section=section_name,
|
||||
dir_name=input_directory,
|
||||
input_name=input_name,
|
||||
status=status,
|
||||
client_agent=client_agent,
|
||||
download_id=download_id,
|
||||
input_category=input_category,
|
||||
failure_link=failure_link,
|
||||
)
|
||||
|
||||
plex_update(input_category)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue