Skip to content

Commit 0735db5

Browse files
committed
compressed compiled version, cleaned gui script
1 parent f878c23 commit 0735db5

File tree

2 files changed

+1
-59
lines changed

2 files changed

+1
-59
lines changed

srt_fixer_gui.exe

-9.89 MB
Binary file not shown.

srt_fixer_gui.py

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,65 +14,6 @@
1414

1515

1616

17-
def main():
18-
parser = argparse.ArgumentParser(description="fix duplicate lines in srt converted youtube auto generated subtitles")
19-
parser.add_argument("input", nargs="?", help="Input subtitle file.")
20-
parser.add_argument("-o", "--output", help="Output subtitle file.")
21-
parser.add_argument("-idir", "--input-directory", help="Input directory containing subtitle files.")
22-
parser.add_argument("-odir", "--output-directory", help="Output directory for processed subtitle files.")
23-
args = parser.parse_args()
24-
input_directory = args.input_directory
25-
output_directory = args.output_directory
26-
27-
if input_directory:
28-
if not os.path.isdir(input_directory):
29-
print(f"Input directory '{input_directory}' does not exist or is not accessible.")
30-
return
31-
32-
if not output_directory:
33-
output_directory = input_directory
34-
35-
if not os.path.exists(output_directory):
36-
os.makedirs(output_directory)
37-
38-
if not TQDM_INSTALLED:
39-
filelist = os.listdir(input_directory)
40-
filecount = len(filelist)
41-
counter = 1
42-
for file in filelist:
43-
deciles = int(counter / filecount * 20)
44-
print(f"processing SRT files:|{'█' * deciles}{' ' * (20 - deciles)}| {counter}/{filecount}", end='\r')
45-
if counter == filecount:
46-
print("\n", end="\r")
47-
counter += 1
48-
if file.endswith(".srt"):
49-
file_path = os.path.join(input_directory, file)
50-
new_file_path = os.path.join(output_directory, file[:-4] + ".fixed.srt")
51-
process_srt(file_path, new_file_path)
52-
else:
53-
for file in tqdm(os.listdir(input_directory), desc="Processing SRT files", unit="file",
54-
bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}'):
55-
if file.endswith(".srt"):
56-
file_path = os.path.join(input_directory, file)
57-
new_file_path = os.path.join(output_directory, file[:-4] + ".fixed.srt")
58-
process_srt(file_path, new_file_path)
59-
else:
60-
file_path = args.input
61-
if not file_path or not os.path.isfile(file_path):
62-
print(f"Input file '{file_path}' does not exist or is not accessible.")
63-
return
64-
65-
new_file_path = args.output or file_path[:-4] + ".fixed.srt"
66-
process_srt(file_path, new_file_path)
67-
68-
69-
70-
71-
if __name__ == "__main__":
72-
main()
73-
74-
75-
7617
import tkinter as tk
7718
from tkinter import ttk, filedialog
7819
import os
@@ -137,6 +78,7 @@ def fix_subtitles():
13778
input_folder_path = tk.StringVar()
13879
output_dir_path = tk.StringVar()
13980

81+
14082
input_file_label = ttk.Label(root, text="Input subtitle file:")
14183
input_file_entry = ttk.Entry(root, textvariable=input_file_path)
14284
input_file_button = ttk.Button(root, text="Browse", command=open_input_file)

0 commit comments

Comments
 (0)