mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-18 08:06:35 +00:00
add faster access to series sort name
This commit is contained in:
@@ -1932,7 +1932,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
private string GetContentTypeOverride(string path, bool inherit)
|
||||
{
|
||||
var nameValuePair = ConfigurationManager.Configuration.ContentTypes.FirstOrDefault(i => string.Equals(i.Name, path, StringComparison.OrdinalIgnoreCase) || (inherit && _fileSystem.ContainsSubPath(i.Name, path)));
|
||||
var nameValuePair = ConfigurationManager.Configuration.ContentTypes.FirstOrDefault(i => string.Equals(i.Name, path, StringComparison.OrdinalIgnoreCase) || (inherit && !string.IsNullOrWhiteSpace(i.Name) && _fileSystem.ContainsSubPath(i.Name, path)));
|
||||
if (nameValuePair != null)
|
||||
{
|
||||
return nameValuePair.Value;
|
||||
@@ -2813,6 +2813,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
private void RemoveContentTypeOverrides(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
|
||||
var removeList = new List<NameValuePair>();
|
||||
|
||||
foreach (var contentType in ConfigurationManager.Configuration.ContentTypes)
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
private IDbCommand _updateInheritedRatingCommand;
|
||||
private IDbCommand _updateInheritedTagsCommand;
|
||||
|
||||
public const int LatestSchemaVersion = 107;
|
||||
public const int LatestSchemaVersion = 108;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||
@@ -272,6 +272,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "SeasonName", "Text");
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "SeasonId", "GUID");
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "SeriesId", "GUID");
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "SeriesSortName", "Text");
|
||||
|
||||
_connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT");
|
||||
_connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text");
|
||||
@@ -412,7 +413,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
"SeriesName",
|
||||
"SeasonName",
|
||||
"SeasonId",
|
||||
"SeriesId"
|
||||
"SeriesId",
|
||||
"SeriesSortName"
|
||||
};
|
||||
|
||||
private readonly string[] _mediaStreamSaveColumns =
|
||||
@@ -535,7 +537,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
"UserDataKey",
|
||||
"SeasonName",
|
||||
"SeasonId",
|
||||
"SeriesId"
|
||||
"SeriesId",
|
||||
"SeriesSortName"
|
||||
};
|
||||
_saveItemCommand = _connection.CreateCommand();
|
||||
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
|
||||
@@ -982,10 +985,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
if (hasSeries != null)
|
||||
{
|
||||
_saveItemCommand.GetParameter(index++).Value = hasSeries.FindSeriesId();
|
||||
_saveItemCommand.GetParameter(index++).Value = hasSeries.FindSeriesSortName();
|
||||
}
|
||||
else
|
||||
{
|
||||
_saveItemCommand.GetParameter(index++).Value = null;
|
||||
_saveItemCommand.GetParameter(index++).Value = null;
|
||||
}
|
||||
|
||||
_saveItemCommand.Transaction = transaction;
|
||||
@@ -1440,6 +1445,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSeries != null)
|
||||
{
|
||||
if (!reader.IsDBNull(63))
|
||||
{
|
||||
hasSeries.SeriesSortName = reader.GetString(63);
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -3056,6 +3069,39 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
whereClauses.Add("LocationType<>'Virtual'");
|
||||
}
|
||||
}
|
||||
if (query.IsUnaired.HasValue)
|
||||
{
|
||||
if (query.IsUnaired.Value)
|
||||
{
|
||||
whereClauses.Add("PremiereDate >= DATETIME('now')");
|
||||
}
|
||||
else
|
||||
{
|
||||
whereClauses.Add("PremiereDate < DATETIME('now')");
|
||||
}
|
||||
}
|
||||
if (query.IsMissing.HasValue && _config.Configuration.SchemaVersion >= 90)
|
||||
{
|
||||
if (query.IsMissing.Value)
|
||||
{
|
||||
whereClauses.Add("(IsVirtualItem=1 AND PremiereDate < DATETIME('now'))");
|
||||
}
|
||||
else
|
||||
{
|
||||
whereClauses.Add("(IsVirtualItem=0 OR PremiereDate >= DATETIME('now'))");
|
||||
}
|
||||
}
|
||||
if (query.IsVirtualUnaired.HasValue && _config.Configuration.SchemaVersion >= 90)
|
||||
{
|
||||
if (query.IsVirtualUnaired.Value)
|
||||
{
|
||||
whereClauses.Add("(IsVirtualItem=1 AND PremiereDate >= DATETIME('now'))");
|
||||
}
|
||||
else
|
||||
{
|
||||
whereClauses.Add("(IsVirtualItem=0 OR PremiereDate < DATETIME('now'))");
|
||||
}
|
||||
}
|
||||
if (query.MediaTypes.Length == 1)
|
||||
{
|
||||
whereClauses.Add("MediaType=@MediaTypes");
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
@@ -21,28 +20,9 @@ namespace MediaBrowser.Server.Implementations.Sorting
|
||||
|
||||
private string GetValue(BaseItem item)
|
||||
{
|
||||
Series series = null;
|
||||
var hasSeries = item as IHasSeries;
|
||||
|
||||
var season = item as Season;
|
||||
|
||||
if (season != null)
|
||||
{
|
||||
series = season.Series;
|
||||
}
|
||||
|
||||
var episode = item as Episode;
|
||||
|
||||
if (episode != null)
|
||||
{
|
||||
series = episode.Series;
|
||||
}
|
||||
|
||||
if (series == null)
|
||||
{
|
||||
series = item as Series;
|
||||
}
|
||||
|
||||
return series != null ? series.SortName : null;
|
||||
return hasSeries != null ? hasSeries.SeriesSortName : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user