Fix caption baseurl (#2268)

* fix caption

* remove duplicate auto-translation from english
This commit is contained in:
bob1520 2022-05-27 11:46:49 +09:00 committed by GitHub
parent fdd7e94a1d
commit c098014a4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -422,8 +422,9 @@ export default Vue.extend({
)
if (!standardLocale.startsWith('en') && noLocaleCaption) {
const baseUrl = result.player_response.captions.playerCaptionsRenderer.baseUrl
this.tryAddingTranslatedLocaleCaption(captionTracks, standardLocale, baseUrl)
captionTracks.forEach((caption) => {
this.tryAddingTranslatedLocaleCaption(captionTracks, standardLocale, caption.baseUrl)
})
}
}
@ -1156,6 +1157,13 @@ export default Vue.extend({
label = `${this.$t('Locale Name')} (translated from English)`
}
const indexTranslated = captionTracks.findIndex((item) => {
return item.name.simpleText === label
})
if (indexTranslated !== -1) {
return
}
if (enCaptionExists) {
url = new URL(captionTracks[enCaptionIdx].baseUrl)
} else {