Centralize Multilang field constants
This commit is contained in:
1 parent
2968412374
commit
09a1b6f589
4 files changed
+161
-188
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using Jellyfin.Plugin.Multilang;
|
||||
using Jellyfin.Plugin.Multilang.Services.Refresh;
|
||||
using Jellyfin.Plugin.Multilang.Services.Providers;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
@@ -217,7 +218,7 @@ DELETE FROM assets WHERE item_id = $item_id;";
|
||||
var allowed = allowedLanguages
|
||||
.Where(l => !string.IsNullOrWhiteSpace(l))
|
||||
.Select(l => l.Trim())
|
||||
.Append("Original")
|
||||
.Append(MultilangConstants.OriginalAction)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToArray();
|
||||
|
||||
@@ -895,7 +896,7 @@ ON CONFLICT(user_id) DO UPDATE SET langs_json = excluded.langs_json, updated_at
|
||||
public ImportDatabaseResult ImportTranslationDatabase(string sourcePath, IReadOnlySet<string> liveItemIds, IReadOnlySet<string> allowedLanguages)
|
||||
{
|
||||
var allowed = allowedLanguages.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||
allowed.Add("Original");
|
||||
allowed.Add(MultilangConstants.OriginalAction);
|
||||
|
||||
using var destination = Open();
|
||||
destination.Open();
|
||||
@@ -1134,17 +1135,7 @@ public sealed class UserRulesDocument
|
||||
|
||||
public string[] FallbackLanguages { get; set; } = [];
|
||||
|
||||
public Dictionary<string, string[]> FallbackFieldActions { get; set; } = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["title"] = ["Jellyfin"],
|
||||
["overview"] = ["Jellyfin"],
|
||||
["tagline"] = ["Jellyfin"],
|
||||
["poster"] = ["Jellyfin"],
|
||||
["logo"] = ["Jellyfin"],
|
||||
["banner"] = ["Jellyfin"],
|
||||
["thumb"] = ["Jellyfin"],
|
||||
["backdrop"] = ["Jellyfin"]
|
||||
};
|
||||
public Dictionary<string, string[]> FallbackFieldActions { get; set; } = MultilangConstants.DefaultActionLists();
|
||||
|
||||
public bool TrustTmdbCollections { get; set; } = true;
|
||||
|
||||
@@ -1176,29 +1167,9 @@ public sealed class UserCategoryRule
|
||||
|
||||
public string[] Scopes { get; set; } = ["M", "S", "C"];
|
||||
|
||||
public Dictionary<string, string> FieldActions { get; set; } = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["title"] = "Fallback",
|
||||
["overview"] = "Fallback",
|
||||
["tagline"] = "Fallback",
|
||||
["poster"] = "Fallback",
|
||||
["logo"] = "Fallback",
|
||||
["banner"] = "Fallback",
|
||||
["thumb"] = "Fallback",
|
||||
["backdrop"] = "Fallback"
|
||||
};
|
||||
public Dictionary<string, string> FieldActions { get; set; } = MultilangConstants.DefaultFieldActions();
|
||||
|
||||
public Dictionary<string, string[]> FieldActionLists { get; set; } = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["title"] = ["Jellyfin"],
|
||||
["overview"] = ["Jellyfin"],
|
||||
["tagline"] = ["Jellyfin"],
|
||||
["poster"] = ["Jellyfin"],
|
||||
["logo"] = ["Jellyfin"],
|
||||
["banner"] = ["Jellyfin"],
|
||||
["thumb"] = ["Jellyfin"],
|
||||
["backdrop"] = ["Jellyfin"]
|
||||
};
|
||||
public Dictionary<string, string[]> FieldActionLists { get; set; } = MultilangConstants.DefaultActionLists();
|
||||
}
|
||||
|
||||
public sealed class UserCategoryRequirement
|
||||
|
||||
Reference in new issue
Block a user