mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 10:04:44 +01:00
update active recordings
This commit is contained in:
@@ -4,7 +4,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
@@ -134,7 +133,14 @@ namespace MediaBrowser.Controller.Library
|
||||
// Not officially supported but in some cases we can handle it.
|
||||
if (item == null)
|
||||
{
|
||||
item = parent.GetParents().OfType<T>().FirstOrDefault();
|
||||
var parents = parent.GetParents();
|
||||
foreach (var currentParent in parents)
|
||||
{
|
||||
if (currentParent is T)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return item != null;
|
||||
@@ -167,12 +173,12 @@ namespace MediaBrowser.Controller.Library
|
||||
/// Gets the physical locations.
|
||||
/// </summary>
|
||||
/// <value>The physical locations.</value>
|
||||
public IEnumerable<string> PhysicalLocations
|
||||
public string[] PhysicalLocations
|
||||
{
|
||||
get
|
||||
{
|
||||
var paths = string.IsNullOrWhiteSpace(Path) ? new string[] { } : new[] { Path };
|
||||
return AdditionalLocations == null ? paths : paths.Concat(AdditionalLocations);
|
||||
return AdditionalLocations == null ? paths : paths.Concat(AdditionalLocations).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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