From f6d095d5332335f165d4f823cc64f4086d6fd897 Mon Sep 17 00:00:00 2001 From: Gabe Date: Sun, 12 Oct 2025 12:02:41 +0800 Subject: [PATCH] fix: subtitle --- src/subtitle/YouTubeCaptionProvider.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/subtitle/YouTubeCaptionProvider.js b/src/subtitle/YouTubeCaptionProvider.js index aea0f4d..add6af6 100644 --- a/src/subtitle/YouTubeCaptionProvider.js +++ b/src/subtitle/YouTubeCaptionProvider.js @@ -274,8 +274,6 @@ class YouTubeCaptionProvider { return; } - this.#showNotification(this.#i18n("starting_to_process_subtitle")); - const captionTracks = await this.#getCaptionTracks(videoId); const captionTrack = this.#findCaptionTrack(captionTracks); if (!captionTrack) { @@ -294,9 +292,6 @@ class YouTubeCaptionProvider { return; } - const flatEvents = this.#flatEvents(events); - if (!flatEvents.length) return; - const { segApiSetting, toLang } = this.#setting; const lang = potUrl.searchParams.get("lang"); const fromLang = @@ -304,6 +299,16 @@ class YouTubeCaptionProvider { OPT_LANGS_TO_CODE[OPT_TRANS_MICROSOFT].get(lang.slice(0, 2)) || "auto"; + if (this.#isSameLang(fromLang, toLang)) { + logger.info("Youtube Provider: skip same lang", fromLang, toLang); + return; + } + + this.#showNotification(this.#i18n("starting_to_process_subtitle")); + + const flatEvents = this.#flatEvents(events); + if (!flatEvents.length) return; + if (potUrl.searchParams.get("kind") === "asr" && segApiSetting) { logger.info("Youtube Provider: Starting AI ...");