mirror of
https://github.com/metatube-community/jellyfin-plugin-metatube.git
synced 2026-02-02 18:21:48 +08:00
Feature: add DeepLX translation support (#435)
Co-authored-by: Jason Lyu <xjasonlyu@gmail.com>
This commit is contained in:
@@ -168,6 +168,12 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
#endif
|
||||
public string DeepLApiKey { get; set; } = string.Empty;
|
||||
|
||||
#if __EMBY__
|
||||
[DisplayName("DeepL alt url (optional)")]
|
||||
[VisibleCondition(nameof(TranslationEngine), ValueCondition.IsEqual, TranslationEngine.DeepL)]
|
||||
#endif
|
||||
public string DeepLAltUrl { get; set; } = string.Empty;
|
||||
|
||||
#if __EMBY__
|
||||
[DisplayName("OpenAI api key")]
|
||||
[VisibleCondition(nameof(TranslationEngine), ValueCondition.IsEqual, TranslationEngine.OpenAi)]
|
||||
@@ -245,4 +251,4 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
}
|
||||
|
||||
private SubstitutionTable _genreSubstitutionTable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,11 @@
|
||||
<input id="txtDeepLApiKey" is="emby-input" name="txtDeepLApiKey" type="text"/>
|
||||
<div class="fieldDescription"></div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="txtDeepLAltUrl">DeepL alt url (optional):</label>
|
||||
<input id="txtDeepLAltUrl" is="emby-input" name="txtDeepLAltUrl" type="text" />
|
||||
<div class="fieldDescription"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="selectTranslationEngineOpenAi">
|
||||
@@ -343,6 +348,7 @@
|
||||
$('#txtBaiduAppKey', page).val(config.BaiduAppKey).change();
|
||||
$('#txtGoogleApiKey', page).val(config.GoogleApiKey).change();
|
||||
$('#txtDeepLApiKey', page).val(config.DeepLApiKey).change();
|
||||
$('#txtDeepLAltUrl', page).val(config.DeepLAltUrl).change();
|
||||
$('#txtOpenAiApiKey', page).val(config.OpenAiApiKey).change();
|
||||
page.querySelector('#chkEnableTitleSubstitution').checked = config.EnableTitleSubstitution;
|
||||
$('#txtTitleRawSubstitutionTable', page).val(config.TitleRawSubstitutionTable).change();
|
||||
@@ -380,6 +386,7 @@
|
||||
config.BaiduAppKey = $('#txtBaiduAppKey', form).val();
|
||||
config.GoogleApiKey = $('#txtGoogleApiKey', form).val();
|
||||
config.DeepLApiKey = $('#txtDeepLApiKey', form).val();
|
||||
config.DeepLXAltUrl = $('#txtDeepLAltUrl', form).val();
|
||||
config.OpenAiApiKey = $('#txtOpenAiApiKey', form).val();
|
||||
config.EnableTitleSubstitution = $('#chkEnableTitleSubstitution', form).prop('checked');
|
||||
config.TitleRawSubstitutionTable = $('#txtTitleRawSubstitutionTable', form).val();
|
||||
@@ -395,4 +402,4 @@
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -43,7 +43,8 @@ public static class TranslationHelper
|
||||
millisecondsDelay = 100;
|
||||
nv.Add(new NameValueCollection
|
||||
{
|
||||
{ "deepl-api-key", Configuration.DeepLApiKey }
|
||||
{ "deepl-api-key", Configuration.DeepLApiKey },
|
||||
{ "deepl-alt-url", Configuration.DeepLAltUrl }
|
||||
});
|
||||
break;
|
||||
case TranslationEngine.OpenAi:
|
||||
@@ -102,4 +103,4 @@ public static class TranslationHelper
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user