MCPcopy
hub / github.com/mvdctop/Movie_Data_Capture / main

Function main

Movie_Data_Capture.py:501–615  ·  view source on GitHub ↗
(args: tuple)

Source from the content-addressed store, hash-verified

499
500
501def main(args: tuple) -> Path:
502 (single_file_path, custom_number, logdir, regexstr, zero_op, no_net_op, search, specified_source,
503 specified_url) = args
504 conf = config.getInstance()
505 main_mode = conf.main_mode()
506 folder_path = ""
507 if main_mode not in (1, 2, 3):
508 print(f"[-]Main mode must be 1 or 2 or 3! You can run '{os.path.basename(sys.argv[0])} --help' for more help.")
509 os._exit(4)
510
511 signal.signal(signal.SIGINT, signal_handler)
512 if sys.platform == 'win32':
513 signal.signal(signal.SIGBREAK, sigdebug_handler)
514 else:
515 signal.signal(signal.SIGWINCH, sigdebug_handler)
516 dupe_stdout_to_logfile(logdir)
517
518 platform_total = str(
519 ' - ' + platform.platform() + ' \n[*] - ' + platform.machine() + ' - Python-' + platform.python_version())
520
521 print('[*]================= Movie Data Capture =================')
522 print('[*]' + version.center(54))
523 print('[*]======================================================')
524 print('[*]' + platform_total)
525 print('[*]======================================================')
526
527 start_time = time.time()
528 print('[+]Start at', time.strftime("%Y-%m-%d %H:%M:%S"))
529
530 print(f"[+]Load Config file '{conf.ini_path}'.")
531 if conf.debug():
532 print('[+]Enable debug')
533 if conf.link_mode() in (1, 2):
534 print('[!]Enable {} link'.format(('soft', 'hard')[conf.link_mode() - 1]))
535 if len(sys.argv) > 1:
536 print('[!]CmdLine:', " ".join(sys.argv[1:]))
537 print('[+]Main Working mode ## {}: {} ## {}{}{}'
538 .format(*(main_mode, ['Scraping', 'Organizing', 'Scraping in analysis folder'][main_mode - 1],
539 "" if not conf.multi_threading() else ", multi_threading on",
540 "" if conf.nfo_skip_days() == 0 else f", nfo_skip_days={conf.nfo_skip_days()}",
541 "" if conf.stop_counter() == 0 else f", stop_counter={conf.stop_counter()}"
542 ) if not single_file_path else ('-', 'Single File', '', '', ''))
543 )
544
545 create_failed_folder(conf.failed_folder())
546
547 # create OpenCC converter
548 ccm = conf.cc_convert_mode()
549 try:
550 oCC = None if ccm == 0 else OpenCC('t2s.json' if ccm == 1 else 's2t.json')
551 except:
552 # some OS no OpenCC cpython, try opencc-python-reimplemented.
553 # pip uninstall opencc && pip install opencc-python-reimplemented
554 oCC = None if ccm == 0 else OpenCC('t2s' if ccm == 1 else 's2t')
555
556 if not search == '':
557 search_list = search.split(",")
558 for i in search_list:

Callers 1

Calls 15

get_data_from_jsonFunction · 0.90
debug_printFunction · 0.90
get_numberFunction · 0.90
dupe_stdout_to_logfileFunction · 0.85
create_failed_folderFunction · 0.85
movie_listsFunction · 0.85
create_data_and_moveFunction · 0.85
rm_empty_folderFunction · 0.85
close_logfileFunction · 0.85
main_modeMethod · 0.80
_exitMethod · 0.80

Tested by

no test coverage detected