mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 17:14:42 +01:00
update naming methods
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
@@ -16,26 +15,5 @@ namespace MediaBrowser.Controller.Entities
|
||||
Taglines = new List<string>();
|
||||
ProductionLocations = new List<string>();
|
||||
}
|
||||
|
||||
public override bool BeforeMetadataRefresh()
|
||||
{
|
||||
var hasChanges = base.BeforeMetadataRefresh();
|
||||
|
||||
if (!ProductionYear.HasValue)
|
||||
{
|
||||
int? yearInName = null;
|
||||
string name;
|
||||
|
||||
NameParser.ParseName(Name, out name, out yearInName);
|
||||
|
||||
if (yearInName.HasValue)
|
||||
{
|
||||
ProductionYear = yearInName;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,10 +149,9 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
|
||||
if (!ProductionYear.HasValue)
|
||||
{
|
||||
int? yearInName = null;
|
||||
string name;
|
||||
var info = LibraryManager.ParseName(Name);
|
||||
|
||||
NameParser.ParseName(Name, out name, out yearInName);
|
||||
var yearInName = info.Year;
|
||||
|
||||
if (yearInName.HasValue)
|
||||
{
|
||||
|
||||
@@ -255,10 +255,9 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
|
||||
if (!ProductionYear.HasValue)
|
||||
{
|
||||
int? yearInName = null;
|
||||
string name;
|
||||
var info = LibraryManager.ParseName(Name);
|
||||
|
||||
NameParser.ParseName(Name, out name, out yearInName);
|
||||
var yearInName = info.Year;
|
||||
|
||||
if (yearInName.HasValue)
|
||||
{
|
||||
|
||||
@@ -740,7 +740,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var user = query.User;
|
||||
|
||||
items = items.Where(i => Filter(i, user, query, userDataManager));
|
||||
items = items.Where(i => Filter(i, user, query, userDataManager, libraryManager));
|
||||
|
||||
items = FilterVirtualEpisodes(items,
|
||||
query.IsMissing,
|
||||
@@ -1140,7 +1140,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
};
|
||||
}
|
||||
|
||||
private static bool Filter(BaseItem item, User user, InternalItemsQuery query, IUserDataManager userDataManager)
|
||||
private static bool Filter(BaseItem item, User user, InternalItemsQuery query, IUserDataManager userDataManager, ILibraryManager libraryManager)
|
||||
{
|
||||
if (query.MediaTypes.Length > 0 && !query.MediaTypes.Contains(item.MediaType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -1321,7 +1321,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var filterValue = query.IsYearMismatched.Value;
|
||||
|
||||
if (IsYearMismatched(item) != filterValue)
|
||||
if (IsYearMismatched(item, libraryManager) != filterValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1551,8 +1551,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Apply tag filter
|
||||
var tags = query.Tags;
|
||||
if (tags.Length > 0)
|
||||
@@ -1641,7 +1641,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return view;
|
||||
}
|
||||
|
||||
public static bool IsYearMismatched(BaseItem item)
|
||||
public static bool IsYearMismatched(BaseItem item, ILibraryManager libraryManager)
|
||||
{
|
||||
if (item.ProductionYear.HasValue)
|
||||
{
|
||||
@@ -1649,14 +1649,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
int? yearInName;
|
||||
string name;
|
||||
NameParser.ParseName(Path.GetFileName(path), out name, out yearInName);
|
||||
var info = libraryManager.ParseName(Path.GetFileName(path));
|
||||
var yearInName = info.Year;
|
||||
|
||||
// Go up a level if we didn't get a year
|
||||
if (!yearInName.HasValue)
|
||||
{
|
||||
NameParser.ParseName(Path.GetFileName(Path.GetDirectoryName(path)), out name, out yearInName);
|
||||
info = libraryManager.ParseName(Path.GetFileName(Path.GetDirectoryName(path)));
|
||||
yearInName = info.Year;
|
||||
}
|
||||
|
||||
if (yearInName.HasValue)
|
||||
|
||||
Reference in New Issue
Block a user