mirror of
https://github.com/karl0ss/bazarr-ai-sub-generator.git
synced 2025-04-26 06:49:22 +01:00
dont process files with subtitles
This commit is contained in:
parent
fc1e05fce1
commit
e44448e33e
@ -4,7 +4,7 @@ import tempfile
|
|||||||
import time
|
import time
|
||||||
from typing import List, Dict, Any
|
from typing import List, Dict, Any
|
||||||
from utils.files import filename, write_srt
|
from utils.files import filename, write_srt
|
||||||
from utils.ffmpeg import get_audio, add_subtitles_to_mp4
|
from utils.ffmpeg import get_audio, add_subtitles_to_mp4, check_for_subtitles
|
||||||
from utils.bazarr import get_wanted_episodes, get_episode_details, sync_series
|
from utils.bazarr import get_wanted_episodes, get_episode_details, sync_series
|
||||||
from utils.sonarr import update_show_in_sonarr
|
from utils.sonarr import update_show_in_sonarr
|
||||||
from utils.faster_whisper import WhisperAI as fasterWhisperAI
|
from utils.faster_whisper import WhisperAI as fasterWhisperAI
|
||||||
@ -50,7 +50,8 @@ def folder_flow(folder: str, model_args: Dict[str, Any], args: Dict[str, Any], b
|
|||||||
for file in files:
|
for file in files:
|
||||||
path = os.path.join(folder, file)
|
path = os.path.join(folder, file)
|
||||||
print(f"Processing file {path}")
|
print(f"Processing file {path}")
|
||||||
process_audio_and_subtitles(path, model_args, args, backend)
|
if not check_for_subtitles(path):
|
||||||
|
process_audio_and_subtitles(path, model_args, args, backend)
|
||||||
|
|
||||||
|
|
||||||
def file_flow(file_path: str, model_args: Dict[str, Any], args: Dict[str, Any], backend: str) -> None:
|
def file_flow(file_path: str, model_args: Dict[str, Any], args: Dict[str, Any], backend: str) -> None:
|
||||||
@ -66,7 +67,8 @@ def file_flow(file_path: str, model_args: Dict[str, Any], args: Dict[str, Any],
|
|||||||
None
|
None
|
||||||
"""
|
"""
|
||||||
print(f"Processing file {file_path}")
|
print(f"Processing file {file_path}")
|
||||||
process_audio_and_subtitles(file_path, model_args, args, backend)
|
if not check_for_subtitles(file_path):
|
||||||
|
process_audio_and_subtitles(file_path, model_args, args, backend)
|
||||||
|
|
||||||
|
|
||||||
def bazzar_flow(show: str, model_args: Dict[str, Any], args: Dict[str, Any], backend: str) -> None:
|
def bazzar_flow(show: str, model_args: Dict[str, Any], args: Dict[str, Any], backend: str) -> None:
|
||||||
|
@ -4,6 +4,18 @@ import ffmpeg
|
|||||||
from .files import filename
|
from .files import filename
|
||||||
|
|
||||||
|
|
||||||
|
def check_for_subtitles(video_path:str):
|
||||||
|
# Probe the video file to get information about its streams
|
||||||
|
probe = ffmpeg.probe(video_path)
|
||||||
|
|
||||||
|
# Check if there are any subtitle streams
|
||||||
|
for stream in probe['streams']:
|
||||||
|
if stream['codec_type'] == 'subtitle':
|
||||||
|
print("File has subtitles")
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def get_audio(paths: list, audio_channel_index: int, sample_interval: list):
|
def get_audio(paths: list, audio_channel_index: int, sample_interval: list):
|
||||||
temp_dir = tempfile.gettempdir()
|
temp_dir = tempfile.gettempdir()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user