Beispiel #1
0
def get_both_subtitles_from_open_subtitle(file_path, result_subtitle_file):
    open_subtitle_chs = get_opensubtitle_sub(file_path, 'chs')
    open_subtitle_eng = get_opensubtitle_sub(file_path)
    if open_subtitle_eng and open_subtitle_chs:
        srt_merge([open_subtitle_chs, open_subtitle_eng], result_subtitle_file,
                  0)
    elif open_subtitle_eng:
        srt_merge([open_subtitle_eng], result_subtitle_file, 0, 2)
        logger.info('chinese sub file not found')
    elif open_subtitle_chs:
        srt_merge([open_subtitle_chs], result_subtitle_file, 0, 2)
        logger.info('english sub file not found')
    else:
        logger.warning('NO SUB FILE FOUND for file: %s', file_path)
Beispiel #2
0
def get_chs_from_open_subtitle(sub_shooter, file_path, result_subtitle_file):
    open_subtitle = get_opensubtitle_sub(file_path, 'chs')
    if not open_subtitle:
        logger.info('chinese sub file not found')
        srt_merge([sub_shooter], result_subtitle_file, 0, 2)
    else:
        srt_merge([sub_shooter, open_subtitle], result_subtitle_file, 0)
Beispiel #3
0
def get_eng_from_open_subtitile(sub_shooter, file_path, result_subtitle_file):
    sub_eng = get_opensubtitle_sub(file_path)
    if not sub_eng:
        logger.info('english sub file not found')
        srt_merge([sub_shooter], result_subtitle_file, 0, 2)
    else:
        srt_merge([sub_eng, sub_shooter], result_subtitle_file, 0)