File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change 2626from pathlib import Path
2727import 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+
17181741def 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
You can’t perform that action at this time.
0 commit comments