mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-13 13:46:24 +00:00
update series queries
This commit is contained in:
@@ -291,6 +291,7 @@ namespace Emby.Server.Implementations.Data
|
||||
AddColumn(db, "TypedBaseItems", "Artists", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "AlbumArtists", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "ExternalId", "Text", existingColumnNames);
|
||||
AddColumn(db, "TypedBaseItems", "SeriesPresentationUniqueKey", "Text", existingColumnNames);
|
||||
|
||||
existingColumnNames = GetColumnNames(db, "ItemValues");
|
||||
AddColumn(db, "ItemValues", "CleanValue", "Text", existingColumnNames);
|
||||
@@ -341,6 +342,7 @@ namespace Emby.Server.Implementations.Data
|
||||
"drop index if exists Idx_ProviderIds1",
|
||||
"drop table if exists Images",
|
||||
"drop index if exists idx_Images",
|
||||
"drop index if exists idx_TypeSeriesPresentationUniqueKey",
|
||||
|
||||
"create index if not exists idx_PathTypedBaseItems on TypedBaseItems(Path)",
|
||||
"create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)",
|
||||
@@ -353,6 +355,9 @@ namespace Emby.Server.Implementations.Data
|
||||
// covering index
|
||||
"create index if not exists idx_TopParentIdGuid on TypedBaseItems(TopParentId,Guid)",
|
||||
|
||||
// series
|
||||
"create index if not exists idx_TypeSeriesPresentationUniqueKey1 on TypedBaseItems(Type,SeriesPresentationUniqueKey,PresentationUniqueKey,SortName)",
|
||||
|
||||
// live tv programs
|
||||
"create index if not exists idx_TypeTopParentIdStartDate on TypedBaseItems(Type,TopParentId,StartDate)",
|
||||
|
||||
@@ -488,7 +493,8 @@ namespace Emby.Server.Implementations.Data
|
||||
"ExtraType",
|
||||
"Artists",
|
||||
"AlbumArtists",
|
||||
"ExternalId"
|
||||
"ExternalId",
|
||||
"SeriesPresentationUniqueKey"
|
||||
};
|
||||
|
||||
private readonly string[] _mediaStreamSaveColumns =
|
||||
@@ -619,7 +625,8 @@ namespace Emby.Server.Implementations.Data
|
||||
"ExtraType",
|
||||
"Artists",
|
||||
"AlbumArtists",
|
||||
"ExternalId"
|
||||
"ExternalId",
|
||||
"SeriesPresentationUniqueKey"
|
||||
};
|
||||
|
||||
var saveItemCommandCommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
|
||||
@@ -1024,11 +1031,13 @@ namespace Emby.Server.Implementations.Data
|
||||
{
|
||||
saveItemStatement.TryBind("@SeriesId", hasSeries.SeriesId);
|
||||
saveItemStatement.TryBind("@SeriesSortName", hasSeries.SeriesSortName);
|
||||
saveItemStatement.TryBind("@SeriesPresentationUniqueKey", hasSeries.SeriesPresentationUniqueKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
saveItemStatement.TryBindNull("@SeriesId");
|
||||
saveItemStatement.TryBindNull("@SeriesSortName");
|
||||
saveItemStatement.TryBindNull("@SeriesPresentationUniqueKey");
|
||||
}
|
||||
|
||||
saveItemStatement.TryBind("@ExternalSeriesId", item.ExternalSeriesId);
|
||||
@@ -1983,6 +1992,15 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
index++;
|
||||
|
||||
if (hasSeries != null)
|
||||
{
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
hasSeries.SeriesPresentationUniqueKey = reader.GetString(index);
|
||||
}
|
||||
}
|
||||
index++;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(item.Tagline))
|
||||
{
|
||||
var movie = item as Movie;
|
||||
@@ -4292,6 +4310,16 @@ namespace Emby.Server.Implementations.Data
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(query.SeriesPresentationUniqueKey))
|
||||
{
|
||||
whereClauses.Add("SeriesPresentationUniqueKey=@SeriesPresentationUniqueKey");
|
||||
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@SeriesPresentationUniqueKey", query.SeriesPresentationUniqueKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (query.BlockUnratedItems.Length == 1)
|
||||
{
|
||||
whereClauses.Add("(InheritedParentalRatingValue > 0 or UnratedType <> @UnratedType)");
|
||||
|
||||
@@ -1057,6 +1057,12 @@ namespace Emby.Server.Implementations.Library
|
||||
try
|
||||
{
|
||||
await PerformLibraryValidation(progress, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (!ConfigurationManager.Configuration.EnableSeriesPresentationUniqueKey)
|
||||
{
|
||||
ConfigurationManager.Configuration.EnableSeriesPresentationUniqueKey = true;
|
||||
ConfigurationManager.SaveConfiguration();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1478,8 +1484,9 @@ namespace Emby.Server.Implementations.Library
|
||||
!query.ParentId.HasValue &&
|
||||
query.ChannelIds.Length == 0 &&
|
||||
query.TopParentIds.Length == 0 &&
|
||||
string.IsNullOrWhiteSpace(query.AncestorWithPresentationUniqueKey)
|
||||
&& query.ItemIds.Length == 0)
|
||||
string.IsNullOrWhiteSpace(query.AncestorWithPresentationUniqueKey) &&
|
||||
string.IsNullOrWhiteSpace(query.SeriesPresentationUniqueKey) &&
|
||||
query.ItemIds.Length == 0)
|
||||
{
|
||||
var userViews = _userviewManager().GetUserViews(new UserViewQuery
|
||||
{
|
||||
|
||||
@@ -158,9 +158,13 @@ namespace Emby.Server.Implementations.TV
|
||||
/// <returns>Task{Episode}.</returns>
|
||||
private Tuple<DateTime, Func<Episode>> GetNextUp(Series series, User user)
|
||||
{
|
||||
var enableSeriesPresentationKey = _config.Configuration.EnableSeriesPresentationUniqueKey;
|
||||
var seriesKey = GetUniqueSeriesKey(series);
|
||||
|
||||
var lastWatchedEpisode = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||
{
|
||||
AncestorWithPresentationUniqueKey = GetUniqueSeriesKey(series),
|
||||
AncestorWithPresentationUniqueKey = enableSeriesPresentationKey ? null : seriesKey,
|
||||
SeriesPresentationUniqueKey = enableSeriesPresentationKey ? seriesKey : null,
|
||||
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||
SortBy = new[] { ItemSortBy.SortName },
|
||||
SortOrder = SortOrder.Descending,
|
||||
@@ -174,7 +178,8 @@ namespace Emby.Server.Implementations.TV
|
||||
{
|
||||
return _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||
{
|
||||
AncestorWithPresentationUniqueKey = GetUniqueSeriesKey(series),
|
||||
AncestorWithPresentationUniqueKey = enableSeriesPresentationKey ? null : seriesKey,
|
||||
SeriesPresentationUniqueKey = enableSeriesPresentationKey ? seriesKey : null,
|
||||
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||
SortBy = new[] { ItemSortBy.SortName },
|
||||
SortOrder = SortOrder.Ascending,
|
||||
|
||||
Reference in New Issue
Block a user