def test_scripts_main(): # Format: ['(TYPE) line content', ...] labeled_data = scripts.main(script_file) assert labeled_data[5 - 1] == '(S) INT. KIEV APARTMENT - NIGHT' assert labeled_data[8 - 1] == '(M) ON THE SCREEN' assert labeled_data[29 - 1] == '(N) JACK reacts. ' assert labeled_data[25 - 1] == '(C) KASIMOV' assert labeled_data[26 - 1] == '(D) You\'re the only one who can help me. '
def main(): scripts.main()
import os import sys from pathlib import Path oldDir = os.getcwd() os.chdir(str(Path(__file__).parent)) import scripts os.chdir(oldDir) ret = scripts.main(sys.argv[1:]) sys.exit(ret)
def entry(): scripts.main(sys.argv)
from scripts import main from config import load_conf def main(): config = load_conf(args) app = init_app(config) if app.config.WEBSOCKET: from sanic.websocket import WebSocketProtocol app.run(host=app.config.HOST, port=app.config.PORT, worker=app.config.WORKER, protocol=WebSocketProtocol, debug=False, access_log=False) else: app.run(host=app.config.HOST, port=app.config.PORT, worker=app.config.WORKER, debug=False, access_log=False) if __name__ == "__main__": main()
import subtitles import scripts import aligner subtitle_file = 'mi.srt' script_file = 'mi.txt' subtitle_list = subtitles.main(subtitle_file) script_list = scripts.main(script_file) cleaned_script = aligner.clean_script_dialogue(script_list) cleaned_script_norm = [] for item in cleaned_script: cleaned_script_norm.append(item[0]) aligned_data = aligner.select_dialogue(subtitle_list, cleaned_script_norm) pos_count = aligner.find_differences(subtitle_list, cleaned_script_norm) character_match = aligner.character_dialogue(subtitle_list, script_list, cleaned_script_norm, aligned_data) timestamped_script = aligner.align_timestamp(cleaned_script, aligned_data, script_list, subtitle_list) def test_subtitles_main(): # Format: [['sub number', 'timeframe', 'sub line'], [...]] subtitle_list = subtitles.main(subtitle_file) assert subtitle_list[3 - 1][0] == '3' assert subtitle_list[9 - 1][1] == '00:03:00,015 --> 00:03:00,975' assert subtitle_list[2 - 1][2] == 'Come on.' def test_subtitles_open_subs(): # Format: [['sub number', 'timeframe', 'sub line'], [...]] subtitle_list = subtitles.open_subs(subtitle_file)
def main(argv): argv = get_arguments() subtitle_list = subtitles.main(argv['Subtitle file']) script_list = scripts.main(argv['Script file']) choice = ask_choice() execute_choice(choice, subtitle_list, script_list)