add faster access to series sort name

pull/702/head
Luke Pulverenti 8 years ago
parent efebac4d6b
commit de635fe22c

@ -117,7 +117,7 @@ namespace MediaBrowser.Api
config.EnableStandaloneMusicKeys = true; config.EnableStandaloneMusicKeys = true;
config.EnableCaseSensitiveItemIds = true; config.EnableCaseSensitiveItemIds = true;
//config.EnableFolderView = true; //config.EnableFolderView = true;
config.SchemaVersion = 107; config.SchemaVersion = 108;
} }
public void Post(UpdateStartupConfiguration request) public void Post(UpdateStartupConfiguration request)

@ -54,7 +54,9 @@ namespace MediaBrowser.Common.Implementations.Updates
{ {
if (updateLevel == PackageVersionClass.Release) if (updateLevel == PackageVersionClass.Release)
{ {
obj = obj.Where(i => !i.prerelease).ToArray(); // Technically all we need to do is check that it's not pre-release
// But let's addititional checks for -beta and -dev to handle builds that might be temporarily tagged incorrectly.
obj = obj.Where(i => !i.prerelease && !i.name.EndsWith("-beta", StringComparison.OrdinalIgnoreCase) && !i.name.EndsWith("-dev", StringComparison.OrdinalIgnoreCase)).ToArray();
} }
else if (updateLevel == PackageVersionClass.Beta) else if (updateLevel == PackageVersionClass.Beta)
{ {
@ -70,7 +72,7 @@ namespace MediaBrowser.Common.Implementations.Updates
.Where(i => i != null) .Where(i => i != null)
.OrderByDescending(i => Version.Parse(i.AvailableVersion)) .OrderByDescending(i => Version.Parse(i.AvailableVersion))
.FirstOrDefault(); .FirstOrDefault();
return availableUpdate ?? new CheckForUpdateResult return availableUpdate ?? new CheckForUpdateResult
{ {
IsUpdateAvailable = false IsUpdateAvailable = false

@ -22,7 +22,13 @@ namespace MediaBrowser.Controller.Entities
public string SeriesName { get; set; } public string SeriesName { get; set; }
[IgnoreDataMember] [IgnoreDataMember]
public Guid? SeriesId { get; set; } public Guid? SeriesId { get; set; }
[IgnoreDataMember]
public string SeriesSortName { get; set; }
public string FindSeriesSortName()
{
return SeriesSortName;
}
public string FindSeriesName() public string FindSeriesName()
{ {
return SeriesName; return SeriesName;

@ -760,11 +760,6 @@ namespace MediaBrowser.Controller.Entities
Logger.Debug("Query requires post-filtering due to ItemSortBy.Revenue"); Logger.Debug("Query requires post-filtering due to ItemSortBy.Revenue");
return true; return true;
} }
if (query.SortBy.Contains(ItemSortBy.SeriesSortName, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Query requires post-filtering due to ItemSortBy.SeriesSortName");
return true;
}
if (query.SortBy.Contains(ItemSortBy.VideoBitRate, StringComparer.OrdinalIgnoreCase)) if (query.SortBy.Contains(ItemSortBy.VideoBitRate, StringComparer.OrdinalIgnoreCase))
{ {
Logger.Debug("Query requires post-filtering due to ItemSortBy.VideoBitRate"); Logger.Debug("Query requires post-filtering due to ItemSortBy.VideoBitRate");
@ -859,24 +854,6 @@ namespace MediaBrowser.Controller.Entities
return true; return true;
} }
if (query.IsMissing.HasValue)
{
Logger.Debug("Query requires post-filtering due to IsMissing");
return true;
}
if (query.IsUnaired.HasValue)
{
Logger.Debug("Query requires post-filtering due to IsUnaired");
return true;
}
if (query.IsVirtualUnaired.HasValue)
{
Logger.Debug("Query requires post-filtering due to IsVirtualUnaired");
return true;
}
if (UserViewBuilder.CollapseBoxSetItems(query, this, query.User, ConfigurationManager)) if (UserViewBuilder.CollapseBoxSetItems(query, this, query.User, ConfigurationManager))
{ {
Logger.Debug("Query requires post-filtering due to CollapseBoxSetItems"); Logger.Debug("Query requires post-filtering due to CollapseBoxSetItems");

@ -11,6 +11,8 @@ namespace MediaBrowser.Controller.Entities
/// <value>The name of the series.</value> /// <value>The name of the series.</value>
string SeriesName { get; set; } string SeriesName { get; set; }
string FindSeriesName(); string FindSeriesName();
string SeriesSortName { get; set; }
string FindSeriesSortName();
Guid? SeriesId { get; set; } Guid? SeriesId { get; set; }
Guid? FindSeriesId(); Guid? FindSeriesId();
} }

@ -53,7 +53,16 @@ namespace MediaBrowser.Controller.Entities.TV
/// This is the ending episode number for double episodes. /// This is the ending episode number for double episodes.
/// </summary> /// </summary>
/// <value>The index number.</value> /// <value>The index number.</value>
public int? IndexNumberEnd { get; set; } public int? IndexNumberEnd { get; set; }
[IgnoreDataMember]
public string SeriesSortName { get; set; }
public string FindSeriesSortName()
{
var series = Series;
return series == null ? SeriesSortName : series.SortName;
}
[IgnoreDataMember] [IgnoreDataMember]
protected override bool SupportsOwnedItems protected override bool SupportsOwnedItems

@ -51,6 +51,15 @@ namespace MediaBrowser.Controller.Entities.TV
} }
} }
[IgnoreDataMember]
public string SeriesSortName { get; set; }
public string FindSeriesSortName()
{
var series = Series;
return series == null ? SeriesSortName : series.SortName;
}
// Genre, Rating and Stuido will all be the same // Genre, Rating and Stuido will all be the same
protected override IEnumerable<string> GetIndexByOptions() protected override IEnumerable<string> GetIndexByOptions()
{ {

@ -449,13 +449,8 @@ namespace MediaBrowser.Controller.Entities.TV
return true; return true;
} }
if (!episode.ParentIndexNumber.HasValue) var season = episode.Season;
{ return season != null && string.Equals(GetUniqueSeriesKey(season), seasonPresentationKey, StringComparison.OrdinalIgnoreCase);
var season = episode.Season;
return season != null && string.Equals(GetUniqueSeriesKey(season), seasonPresentationKey, StringComparison.OrdinalIgnoreCase);
}
return false;
}); });
} }

@ -1932,7 +1932,7 @@ namespace MediaBrowser.Server.Implementations.Library
private string GetContentTypeOverride(string path, bool inherit) 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) if (nameValuePair != null)
{ {
return nameValuePair.Value; return nameValuePair.Value;
@ -2813,6 +2813,11 @@ namespace MediaBrowser.Server.Implementations.Library
private void RemoveContentTypeOverrides(string path) private void RemoveContentTypeOverrides(string path)
{ {
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
var removeList = new List<NameValuePair>(); var removeList = new List<NameValuePair>();
foreach (var contentType in ConfigurationManager.Configuration.ContentTypes) foreach (var contentType in ConfigurationManager.Configuration.ContentTypes)

@ -95,7 +95,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
private IDbCommand _updateInheritedRatingCommand; private IDbCommand _updateInheritedRatingCommand;
private IDbCommand _updateInheritedTagsCommand; private IDbCommand _updateInheritedTagsCommand;
public const int LatestSchemaVersion = 107; public const int LatestSchemaVersion = 108;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class. /// 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", "SeasonName", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "SeasonId", "GUID"); _connection.AddColumn(Logger, "TypedBaseItems", "SeasonId", "GUID");
_connection.AddColumn(Logger, "TypedBaseItems", "SeriesId", "GUID"); _connection.AddColumn(Logger, "TypedBaseItems", "SeriesId", "GUID");
_connection.AddColumn(Logger, "TypedBaseItems", "SeriesSortName", "Text");
_connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT"); _connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT");
_connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text"); _connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text");
@ -412,7 +413,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
"SeriesName", "SeriesName",
"SeasonName", "SeasonName",
"SeasonId", "SeasonId",
"SeriesId" "SeriesId",
"SeriesSortName"
}; };
private readonly string[] _mediaStreamSaveColumns = private readonly string[] _mediaStreamSaveColumns =
@ -535,7 +537,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
"UserDataKey", "UserDataKey",
"SeasonName", "SeasonName",
"SeasonId", "SeasonId",
"SeriesId" "SeriesId",
"SeriesSortName"
}; };
_saveItemCommand = _connection.CreateCommand(); _saveItemCommand = _connection.CreateCommand();
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values ("; _saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
@ -982,10 +985,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
if (hasSeries != null) if (hasSeries != null)
{ {
_saveItemCommand.GetParameter(index++).Value = hasSeries.FindSeriesId(); _saveItemCommand.GetParameter(index++).Value = hasSeries.FindSeriesId();
_saveItemCommand.GetParameter(index++).Value = hasSeries.FindSeriesSortName();
} }
else else
{ {
_saveItemCommand.GetParameter(index++).Value = null; _saveItemCommand.GetParameter(index++).Value = null;
_saveItemCommand.GetParameter(index++).Value = null;
} }
_saveItemCommand.Transaction = transaction; _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; return item;
} }
@ -3056,6 +3069,39 @@ namespace MediaBrowser.Server.Implementations.Persistence
whereClauses.Add("LocationType<>'Virtual'"); 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) if (query.MediaTypes.Length == 1)
{ {
whereClauses.Add("MediaType=@MediaTypes"); whereClauses.Add("MediaType=@MediaTypes");

@ -1,5 +1,4 @@
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Sorting; using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using System; using System;
@ -21,28 +20,9 @@ namespace MediaBrowser.Server.Implementations.Sorting
private string GetValue(BaseItem item) private string GetValue(BaseItem item)
{ {
Series series = null; var hasSeries = item as IHasSeries;
var season = item as Season; return hasSeries != null ? hasSeries.SeriesSortName : null;
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;
} }
/// <summary> /// <summary>

@ -349,8 +349,8 @@ namespace MediaBrowser.WebDashboard.Api
} }
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "jquery", "src"), true); _fileSystem.DeleteDirectory(Path.Combine(bowerPath, "jquery", "src"), true);
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "fingerprintjs2", "flash"), true); //_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "fingerprintjs2", "flash"), true);
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "fingerprintjs2", "specs"), true); //_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "fingerprintjs2", "specs"), true);
DeleteCryptoFiles(Path.Combine(bowerPath, "cryptojslib", "components")); DeleteCryptoFiles(Path.Combine(bowerPath, "cryptojslib", "components"));
@ -358,12 +358,7 @@ namespace MediaBrowser.WebDashboard.Api
DeleteFoldersByName(Path.Combine(bowerPath, "jstree"), "src"); DeleteFoldersByName(Path.Combine(bowerPath, "jstree"), "src");
DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor"); DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor");
DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "st"); DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "st");
DeleteFoldersByName(Path.Combine(bowerPath, "Swiper"), "src"); //DeleteFoldersByName(Path.Combine(bowerPath, "Swiper"), "src");
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "marked"), true);
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "marked-element"), true);
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "prism"), true);
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "prism-element"), true);
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase)) if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{ {

Loading…
Cancel
Save