You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
869 B
26 lines
869 B
from pathlib import Path
|
|
|
|
from app.logic import sonarr, config, radarr
|
|
from app.cmd import setup_and_parse_args
|
|
from app.logger import Logger
|
|
from app.trash_error import TrashError
|
|
|
|
# --------------------------------------------------------------------------------------------------
|
|
def main(root_directory: Path):
|
|
args = setup_and_parse_args()
|
|
logger = Logger(args)
|
|
|
|
config.load_config(args, logger, root_directory)
|
|
|
|
subcommand_handlers = {
|
|
('sonarr', 'profile'): sonarr.process_profile,
|
|
('sonarr', 'quality'): sonarr.process_quality,
|
|
('radarr', 'quality'): radarr.process_quality,
|
|
}
|
|
|
|
server_name = args.type.split(':')[0]
|
|
|
|
try:
|
|
subcommand_handlers[server_name, args.subcommand](args, logger)
|
|
except KeyError:
|
|
raise TrashError(f'{args.subcommand} support in {server_name} is not implemented yet') |