mirror of
https://github.com/metatube-community/jellyfin-plugin-metatube.git
synced 2026-05-05 19:54:26 +08:00
Style change
This commit is contained in:
@@ -18,6 +18,43 @@ public enum TranslationEngine
|
||||
|
||||
public class PluginConfiguration : BasePluginConfiguration
|
||||
{
|
||||
#region TableSerializer
|
||||
|
||||
private class TableSerializer
|
||||
{
|
||||
public static Dictionary<string, string> Deserialize(string text)
|
||||
{
|
||||
var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var reader = new StringReader(text ?? string.Empty);
|
||||
while (reader.ReadLine() is { } line)
|
||||
{
|
||||
var kvp = line.Split('=', 2).Select(s => s.Trim()).ToList();
|
||||
if (string.IsNullOrWhiteSpace(kvp.First()))
|
||||
continue;
|
||||
dictionary[kvp[0]] = kvp.Count switch
|
||||
{
|
||||
1 => null,
|
||||
2 => kvp[1],
|
||||
_ => dictionary[kvp[0]]
|
||||
};
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public static string Serialize(Dictionary<string, string> table)
|
||||
{
|
||||
return table?.Any() != true
|
||||
? string.Empty
|
||||
: string.Join('\n',
|
||||
table.Where(kvp => !string.IsNullOrWhiteSpace(kvp.Key))
|
||||
.Select(kvp => $"{kvp.Key?.Trim()}={kvp.Value?.Trim()}"));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region General
|
||||
|
||||
public string Server { get; set; } = "https://api.javtube.internal";
|
||||
@@ -87,41 +124,4 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region TableSerializer
|
||||
|
||||
private class TableSerializer
|
||||
{
|
||||
public static Dictionary<string, string> Deserialize(string text)
|
||||
{
|
||||
var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var reader = new StringReader(text ?? string.Empty);
|
||||
while (reader.ReadLine() is { } line)
|
||||
{
|
||||
var kvp = line.Split('=', 2).Select(s => s.Trim()).ToList();
|
||||
if (string.IsNullOrWhiteSpace(kvp.First()))
|
||||
continue;
|
||||
dictionary[kvp[0]] = kvp.Count switch
|
||||
{
|
||||
1 => null,
|
||||
2 => kvp[1],
|
||||
_ => dictionary[kvp[0]]
|
||||
};
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public static string Serialize(Dictionary<string, string> table)
|
||||
{
|
||||
return table?.Any() != true
|
||||
? string.Empty
|
||||
: string.Join('\n',
|
||||
table.Where(kvp => !string.IsNullOrWhiteSpace(kvp.Key))
|
||||
.Select(kvp => $"{kvp.Key?.Trim()}={kvp.Value?.Trim()}"));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -10,9 +10,7 @@ internal static class EnumerableExtensions
|
||||
public static IEnumerable<string> Substitute(this IEnumerable<string> source, Dictionary<string, string> table)
|
||||
{
|
||||
if (table?.Any() != true)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
var target = new List<string>();
|
||||
|
||||
|
||||
@@ -121,13 +121,11 @@ public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieI
|
||||
|
||||
// Add director.
|
||||
if (!string.IsNullOrWhiteSpace(m.Director))
|
||||
{
|
||||
result.AddPerson(new PersonInfo
|
||||
{
|
||||
Name = m.Director,
|
||||
Type = PersonType.Director
|
||||
});
|
||||
}
|
||||
|
||||
// Add actors.
|
||||
foreach (var name in m.Actors)
|
||||
|
||||
Reference in New Issue
Block a user