Skip to content

Commit a2bb967

Browse files
authored
Add files via upload
1 parent fee86ca commit a2bb967

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

win/autosrt.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from pathlib import Path
2727
import shlex
2828

29-
VERSION = "1.3.3"
29+
VERSION = "1.3.4"
3030

3131

3232
#======================================================== ffmpeg_progress_yield ========================================================#
@@ -1715,6 +1715,29 @@ def __call__(self, media_filepath):
17151715
return
17161716

17171717

1718+
def has_subtitles(media_filepath):
1719+
if "\\" in media_filepath:
1720+
media_filepath = media_filepath.replace("\\", "/")
1721+
1722+
ffmpeg_cmd = [
1723+
"ffmpeg",
1724+
"-y",
1725+
"-i", media_filepath,
1726+
"-map", "0:s:0",
1727+
"-f", "srt",
1728+
"-"
1729+
]
1730+
1731+
result = subprocess.run(ffmpeg_cmd, capture_output=True, text=True)
1732+
#print(result.stdout)
1733+
#print(result.stderr)
1734+
1735+
if result.stdout:
1736+
return True # Subtitles detected
1737+
else:
1738+
return False # No subtitles detected
1739+
1740+
17181741
def show_progress(media_filepath, progress):
17191742
global pbar
17201743
pbar.update(progress)
@@ -1876,9 +1899,10 @@ def main():
18761899
rendered_media_filepath = None
18771900

18781901
for media_filepath in media_filepaths:
1879-
if ".rendered." in str(media_filepath):
1902+
if has_subtitles(media_filepath):
18801903
media_filepaths.remove(media_filepath)
18811904

1905+
18821906
for media_filepath in media_filepaths:
18831907
print("Processing {}".format(media_filepath))
18841908

0 commit comments

Comments
 (0)