mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-28 04:51:54 +00:00
denormalize seriesid
This commit is contained in:
@@ -1316,6 +1316,12 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
|
||||
dto.SeasonName = episode.SeasonName;
|
||||
|
||||
var seriesId = episode.SeriesId;
|
||||
if (seriesId.HasValue)
|
||||
{
|
||||
dto.SeriesId = seriesId.Value.ToString("N");
|
||||
}
|
||||
|
||||
Series episodeSeries = null;
|
||||
|
||||
if (fields.Contains(ItemFields.SeriesGenres))
|
||||
@@ -1327,13 +1333,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
}
|
||||
|
||||
episodeSeries = episodeSeries ?? episode.Series;
|
||||
if (episodeSeries != null)
|
||||
{
|
||||
dto.SeriesId = GetDtoId(episodeSeries);
|
||||
}
|
||||
|
||||
if (options.GetImageLimit(ImageType.Primary) > 0)
|
||||
if (fields.Contains(ItemFields.SeriesPrimaryImage))
|
||||
{
|
||||
episodeSeries = episodeSeries ?? episode.Series;
|
||||
if (episodeSeries != null)
|
||||
@@ -1369,18 +1369,27 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
{
|
||||
dto.SeriesName = season.SeriesName;
|
||||
|
||||
series = season.Series;
|
||||
|
||||
if (series != null)
|
||||
var seriesId = season.SeriesId;
|
||||
if (seriesId.HasValue)
|
||||
{
|
||||
dto.SeriesId = GetDtoId(series);
|
||||
dto.SeriesId = seriesId.Value.ToString("N");
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.SeriesStudio))
|
||||
series = null;
|
||||
|
||||
if (fields.Contains(ItemFields.SeriesStudio))
|
||||
{
|
||||
series = series ?? season.Series;
|
||||
if (series != null)
|
||||
{
|
||||
dto.SeriesStudio = series.Studios.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
if (options.GetImageLimit(ImageType.Primary) > 0)
|
||||
if (fields.Contains(ItemFields.SeriesPrimaryImage))
|
||||
{
|
||||
series = series ?? season.Series;
|
||||
if (series != null)
|
||||
{
|
||||
dto.SeriesPrimaryImageTag = GetImageCacheTag(series, ImageType.Primary);
|
||||
}
|
||||
|
||||
@@ -30,23 +30,32 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||
return null;
|
||||
}
|
||||
|
||||
var season = parent as Season;
|
||||
|
||||
// Just in case the user decided to nest episodes.
|
||||
// Not officially supported but in some cases we can handle it.
|
||||
if (season == null)
|
||||
{
|
||||
season = parent.GetParents().OfType<Season>().FirstOrDefault();
|
||||
}
|
||||
|
||||
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
||||
// Also handle flat tv folders
|
||||
if (season != null || args.HasParent<Series>() || string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var episode = ResolveVideo<Episode>(args, false);
|
||||
|
||||
if (episode != null)
|
||||
{
|
||||
var season = parent as Season;
|
||||
// Just in case the user decided to nest episodes.
|
||||
// Not officially supported but in some cases we can handle it.
|
||||
if (season == null)
|
||||
{
|
||||
season = parent.GetParents().OfType<Season>().FirstOrDefault();
|
||||
}
|
||||
|
||||
var series = parent as Series;
|
||||
if (series == null)
|
||||
{
|
||||
series = parent.GetParents().OfType<Series>().FirstOrDefault();
|
||||
}
|
||||
|
||||
if (series != null)
|
||||
{
|
||||
episode.SeriesId = series.Id;
|
||||
}
|
||||
if (season != null)
|
||||
{
|
||||
episode.SeasonId = season.Id;
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
private IDbCommand _updateInheritedRatingCommand;
|
||||
private IDbCommand _updateInheritedTagsCommand;
|
||||
|
||||
public const int LatestSchemaVersion = 100;
|
||||
public const int LatestSchemaVersion = 101;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||
@@ -273,6 +273,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "UserDataKey", "Text");
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "SeasonName", "Text");
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "SeasonId", "GUID");
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "SeriesId", "GUID");
|
||||
|
||||
_connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT");
|
||||
_connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text");
|
||||
@@ -407,7 +408,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
"IsVirtualItem",
|
||||
"SeriesName",
|
||||
"SeasonName",
|
||||
"SeasonId"
|
||||
"SeasonId",
|
||||
"SeriesId"
|
||||
};
|
||||
|
||||
private readonly string[] _mediaStreamSaveColumns =
|
||||
@@ -529,7 +531,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
"SeriesName",
|
||||
"UserDataKey",
|
||||
"SeasonName",
|
||||
"SeasonId"
|
||||
"SeasonId",
|
||||
"SeriesId"
|
||||
};
|
||||
_saveItemCommand = _connection.CreateCommand();
|
||||
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
|
||||
@@ -972,6 +975,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
_saveItemCommand.GetParameter(index++).Value = null;
|
||||
}
|
||||
|
||||
if (hasSeries != null)
|
||||
{
|
||||
_saveItemCommand.GetParameter(index++).Value = hasSeries.FindSeriesId();
|
||||
}
|
||||
else
|
||||
{
|
||||
_saveItemCommand.GetParameter(index++).Value = null;
|
||||
}
|
||||
|
||||
_saveItemCommand.Transaction = transaction;
|
||||
|
||||
_saveItemCommand.ExecuteNonQuery();
|
||||
@@ -1416,6 +1428,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSeries != null)
|
||||
{
|
||||
if (!reader.IsDBNull(62))
|
||||
{
|
||||
hasSeries.SeriesId = reader.GetGuid(62);
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user