Skip to content

Commit 4dba2b6

Browse files
authored
Merge pull request #14 from MemQu/dev
Correcting errors with --dir
2 parents 0b848b9 + fc1ae0b commit 4dba2b6

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

subtotxt.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,12 @@ def copy():
325325

326326
def junk_strip(line):
327327
"""Based on PR #4 by eMPee584. Looping is terrible, but, a required evil it seems."""
328-
for junk in sub.junk:
329-
try:
330-
line = re.sub(rf"{junk}", "", line)
331-
except Exception: # Line may become blank if we remove Closed Captions
332-
pass
328+
if sub.junk:
329+
for junk in sub.junk:
330+
try:
331+
line = re.sub(rf"{junk}", "", line)
332+
except Exception: # Line may become blank if we remove Closed Captions
333+
pass
333334
return line
334335

335336

@@ -517,11 +518,20 @@ def check_it_works(in_file): # Pytest runner
517518
files = list(filter(lambda p: p.suffix in {".srt", ".vtt", ".ssa", ".ass"}, Path(args.dir).glob("*")))
518519
how_many = len(files)
519520
c = 0
520-
print(f"Multi file mode. Found {how_many} files.")
521+
print(f"Multi file mode. Found {how_many} files. The files are:")
522+
for idx, f in enumerate(files):
523+
print(str(idx + 1) + ": " + str(f))
521524
print("-" * 22)
522525
for f in files:
523-
file.set(f)
526+
file.set_file(f)
527+
file.set_over(args.overwrite)
528+
enc.check_encoding()
524529
enc.force_utf8(args.utf8)
530+
sub.testsub()
531+
sub.set_no_names(args.nonames) # True/False
532+
sub.set_no_sort(args.nosort) # True/False
533+
sub.screen_output(args.screen) # True/False
534+
sub.one_line(args.oneliners) # True/False
525535
do_work()
526536
print("-" * 22)
527537
c += 1

0 commit comments

Comments
 (0)