mirror of
https://github.com/metatube-community/jellyfin-plugin-metatube.git
synced 2026-02-02 18:21:48 +08:00
Feature: custom google translate url support (#495)
This commit is contained in:
@@ -162,6 +162,13 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
#endif
|
||||
public string GoogleApiKey { get; set; } = string.Empty;
|
||||
|
||||
#if __EMBY__
|
||||
[DisplayName("Google api url")]
|
||||
[Description("Custom Google translate api url. (optional)")]
|
||||
[VisibleCondition(nameof(TranslationEngine), ValueCondition.IsEqual, TranslationEngine.Google)]
|
||||
#endif
|
||||
public string GoogleApiUrl { get; set; } = string.Empty;
|
||||
|
||||
#if __EMBY__
|
||||
[DisplayName("DeepL api key")]
|
||||
[VisibleCondition(nameof(TranslationEngine), ValueCondition.IsEqual, TranslationEngine.DeepL)]
|
||||
|
||||
@@ -196,6 +196,11 @@
|
||||
<input id="txtGoogleApiKey" is="emby-input" name="txtGoogleApiKey" type="text"/>
|
||||
<div class="fieldDescription"></div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="txtGoogleApiUrl">Google api url:</label>
|
||||
<input id="txtGoogleApiUrl" is="emby-input" name="txtGoogleApiUrl" type="text"/>
|
||||
<div class="fieldDescription">Custom Google translate api url. (optional)</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="selectTranslationEngineDeepL">
|
||||
@@ -357,6 +362,7 @@
|
||||
$('#txtBaiduAppId', page).val(config.BaiduAppId).change();
|
||||
$('#txtBaiduAppKey', page).val(config.BaiduAppKey).change();
|
||||
$('#txtGoogleApiKey', page).val(config.GoogleApiKey).change();
|
||||
$('#txtGoogleApiUrl', page).val(config.GoogleApiUrl).change();
|
||||
$('#txtDeepLApiKey', page).val(config.DeepLApiKey).change();
|
||||
$('#txtDeepLApiUrl', page).val(config.DeepLApiUrl).change();
|
||||
$('#txtOpenAiApiKey', page).val(config.OpenAiApiKey).change();
|
||||
@@ -397,6 +403,7 @@
|
||||
config.BaiduAppId = $('#txtBaiduAppId', form).val();
|
||||
config.BaiduAppKey = $('#txtBaiduAppKey', form).val();
|
||||
config.GoogleApiKey = $('#txtGoogleApiKey', form).val();
|
||||
config.GoogleApiUrl = $('#txtGoogleApiUrl', form).val();
|
||||
config.DeepLApiKey = $('#txtDeepLApiKey', form).val();
|
||||
config.DeepLXAltUrl = $('#txtDeepLApiUrl', form).val();
|
||||
config.OpenAiApiKey = $('#txtOpenAiApiKey', form).val();
|
||||
|
||||
@@ -32,7 +32,8 @@ public static class TranslationHelper
|
||||
millisecondsDelay = 100; // Limit Google API request rate to 10 rps.
|
||||
nv.Add(new NameValueCollection
|
||||
{
|
||||
{ "google-api-key", Configuration.GoogleApiKey }
|
||||
{ "google-api-key", Configuration.GoogleApiKey },
|
||||
{ "google-api-url", Configuration.GoogleApiUrl }
|
||||
});
|
||||
break;
|
||||
case TranslationEngine.GoogleFree:
|
||||
|
||||
Reference in New Issue
Block a user