mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-31 21:08:27 +01:00
update active recordings
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
@@ -9,25 +7,6 @@ namespace MediaBrowser.Controller.Library
|
||||
{
|
||||
public static class NameExtensions
|
||||
{
|
||||
public static bool EqualsAny(IEnumerable<string> names, string x)
|
||||
{
|
||||
x = NormalizeForComparison(x);
|
||||
|
||||
return names.Any(y => string.Compare(x, y, StringComparison.OrdinalIgnoreCase) == 0);
|
||||
//return names.Any(y => string.Compare(x, y, CultureInfo.InvariantCulture, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace) == 0);
|
||||
}
|
||||
|
||||
private static string NormalizeForComparison(string name)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return name;
|
||||
//return name.RemoveDiacritics();
|
||||
}
|
||||
|
||||
private static string RemoveDiacritics(string name)
|
||||
{
|
||||
if (name == null)
|
||||
@@ -44,27 +23,4 @@ namespace MediaBrowser.Controller.Library
|
||||
return names.DistinctBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public class DistinctNameComparer : IComparer<string>, IEqualityComparer<string>
|
||||
{
|
||||
public int Compare(string x, string y)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(x) && string.IsNullOrWhiteSpace(y))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return string.Compare(x.RemoveDiacritics(), y.RemoveDiacritics(), StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool Equals(string x, string y)
|
||||
{
|
||||
return Compare(x, y) == 0;
|
||||
}
|
||||
|
||||
public int GetHashCode(string obj)
|
||||
{
|
||||
return (obj ?? string.Empty).GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user