mirror of
https://github.com/karl0ss/bazarr-ai-sub-generator.git
synced 2025-04-26 06:49:22 +01:00
more cleanup
This commit is contained in:
parent
7e83e4ef1e
commit
281b3cabc1
7
.vscode/launch.json
vendored
7
.vscode/launch.json
vendored
@ -11,12 +11,15 @@
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": false,
|
||||
"env": {
|
||||
"CUDA_VISIBLE_DEVICES": "1"
|
||||
},
|
||||
"args": [
|
||||
"--model",
|
||||
"base",
|
||||
"--show",
|
||||
"Gary Neville's Soccerbox"
|
||||
],
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ def main():
|
||||
"--show",
|
||||
type=str,
|
||||
default=None,
|
||||
#choices=["transcribe", "translate"],
|
||||
help="whether to perform X->X speech recognition ('transcribe') \
|
||||
or X->English translation ('translate')",
|
||||
)
|
||||
|
@ -7,27 +7,14 @@ from utils.ffmpeg import get_audio, add_subtitles_to_mp4
|
||||
from utils.bazarr import get_wanted_episodes, get_episode_details, sync_series
|
||||
from utils.sonarr import update_show_in_sonarr
|
||||
from utils.whisper import WhisperAI
|
||||
|
||||
def measure_time(func):
|
||||
def wrapper(*args, **kwargs):
|
||||
start_time = time.time()
|
||||
result = func(*args, **kwargs)
|
||||
end_time = time.time()
|
||||
duration = end_time - start_time
|
||||
print(f"Function '{func.__name__}' executed in: {duration:.6f} seconds")
|
||||
return result
|
||||
return wrapper
|
||||
|
||||
|
||||
from utils.decorator import measure_time
|
||||
|
||||
def process(args: dict):
|
||||
|
||||
model_name: str = args.pop("model")
|
||||
language: str = args.pop("language")
|
||||
show: str = args.pop("show")
|
||||
# sample_interval: str = args.pop("sample_interval")
|
||||
# audio_channel: str = args.pop("audio_channel")
|
||||
|
||||
|
||||
if model_name.endswith(".en"):
|
||||
warnings.warn(
|
||||
f"{model_name} is an English-only model, forcing English detection."
|
||||
@ -38,10 +25,8 @@ def process(args: dict):
|
||||
args["language"] = language
|
||||
|
||||
model_args = {}
|
||||
# model_args["model_size_or_path"] = model_name
|
||||
model_args["device"] = args.pop("device")
|
||||
# model_args["compute_type"] = args.pop("compute_type")
|
||||
|
||||
|
||||
list_of_episodes_needing_subtitles = get_wanted_episodes(show)
|
||||
print(
|
||||
f"Found {list_of_episodes_needing_subtitles['total']} episodes needing subtitles."
|
||||
|
13
bazarr-ai-sub-generator/utils/decorator.py
Normal file
13
bazarr-ai-sub-generator/utils/decorator.py
Normal file
@ -0,0 +1,13 @@
|
||||
import time
|
||||
from datetime import timedelta
|
||||
|
||||
def measure_time(func):
|
||||
def wrapper(*args, **kwargs):
|
||||
start_time = time.time()
|
||||
result = func(*args, **kwargs)
|
||||
end_time = time.time()
|
||||
duration = end_time - start_time
|
||||
human_readable_duration = str(timedelta(seconds=duration))
|
||||
print(f"Function '{func.__name__}' executed in: {human_readable_duration}")
|
||||
return result
|
||||
return wrapper
|
@ -1,4 +1,3 @@
|
||||
faster-whisper==0.10.0
|
||||
tqdm==4.56.0
|
||||
ffmpeg-python==0.2.0
|
||||
git+https://github.com/openai/whisper.git
|
||||
|
Loading…
x
Reference in New Issue
Block a user