import sys
import re

def remove_numbers_from_srt(input_file, output_file):
    """
    SRT 자막 파일에서 순서 번호를 제거합니다.

    Args:
        input_file (str): 입력 SRT 파일 경로.
        output_file (str): 출력 SRT 파일 경로.
    """

    with open(input_file, 'r', encoding='utf-8') as f_in, open(output_file, 'w', encoding='utf-8') as f_out:
        lines = f_in.readlines()
        i = 0
        while i < len(lines):
            # 순서 번호 라인 제거
            if re.match(r'^\d+\s*$', lines[i]):
                i += 1
                continue
            # 빈 줄 제거
            if lines[i].strip() == '':
                i += 1
                continue
            f_out.write(lines[i])
            i += 1

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("사용법: python seqdel.py input.srt output.srt")
        sys.exit(1)

    input_file = sys.argv[1]
    output_file = sys.argv[2]

    remove_numbers_from_srt(input_file, output_file)
    print(f"순서 번호 제거 완료: {output_file}")