Skip to content

Commit

Permalink
compressed compiled version, cleaned gui script
Browse files Browse the repository at this point in the history
  • Loading branch information
bindestriche committed Mar 8, 2024
1 parent f878c23 commit 0735db5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 59 deletions.
Binary file modified srt_fixer_gui.exe
Binary file not shown.
60 changes: 1 addition & 59 deletions srt_fixer_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,65 +14,6 @@



def main():
parser = argparse.ArgumentParser(description="fix duplicate lines in srt converted youtube auto generated subtitles")
parser.add_argument("input", nargs="?", help="Input subtitle file.")
parser.add_argument("-o", "--output", help="Output subtitle file.")
parser.add_argument("-idir", "--input-directory", help="Input directory containing subtitle files.")
parser.add_argument("-odir", "--output-directory", help="Output directory for processed subtitle files.")
args = parser.parse_args()
input_directory = args.input_directory
output_directory = args.output_directory

if input_directory:
if not os.path.isdir(input_directory):
print(f"Input directory '{input_directory}' does not exist or is not accessible.")
return

if not output_directory:
output_directory = input_directory

if not os.path.exists(output_directory):
os.makedirs(output_directory)

if not TQDM_INSTALLED:
filelist = os.listdir(input_directory)
filecount = len(filelist)
counter = 1
for file in filelist:
deciles = int(counter / filecount * 20)
print(f"processing SRT files:|{'█' * deciles}{' ' * (20 - deciles)}| {counter}/{filecount}", end='\r')
if counter == filecount:
print("\n", end="\r")
counter += 1
if file.endswith(".srt"):
file_path = os.path.join(input_directory, file)
new_file_path = os.path.join(output_directory, file[:-4] + ".fixed.srt")
process_srt(file_path, new_file_path)
else:
for file in tqdm(os.listdir(input_directory), desc="Processing SRT files", unit="file",
bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}'):
if file.endswith(".srt"):
file_path = os.path.join(input_directory, file)
new_file_path = os.path.join(output_directory, file[:-4] + ".fixed.srt")
process_srt(file_path, new_file_path)
else:
file_path = args.input
if not file_path or not os.path.isfile(file_path):
print(f"Input file '{file_path}' does not exist or is not accessible.")
return

new_file_path = args.output or file_path[:-4] + ".fixed.srt"
process_srt(file_path, new_file_path)




if __name__ == "__main__":
main()



import tkinter as tk
from tkinter import ttk, filedialog
import os
Expand Down Expand Up @@ -137,6 +78,7 @@ def fix_subtitles():
input_folder_path = tk.StringVar()
output_dir_path = tk.StringVar()


input_file_label = ttk.Label(root, text="Input subtitle file:")
input_file_entry = ttk.Entry(root, textvariable=input_file_path)
input_file_button = ttk.Button(root, text="Browse", command=open_input_file)
Expand Down

0 comments on commit 0735db5

Please sign in to comment.