denormalize series fields
This commit is contained in:
parent
46dc02705a
commit
26036837dd
|
@ -273,7 +273,9 @@ namespace MediaBrowser.Api.Images
|
|||
{
|
||||
var list = new List<ImageInfo>();
|
||||
|
||||
foreach (var image in item.ImageInfos.Where(i => !item.AllowsMultipleImages(i.Type)))
|
||||
var itemImages = item.ImageInfos;
|
||||
|
||||
foreach (var image in itemImages.Where(i => !item.AllowsMultipleImages(i.Type)))
|
||||
{
|
||||
var info = GetImageInfo(item, image, null);
|
||||
|
||||
|
@ -283,14 +285,14 @@ namespace MediaBrowser.Api.Images
|
|||
}
|
||||
}
|
||||
|
||||
foreach (var imageType in item.ImageInfos.Select(i => i.Type).Distinct().Where(item.AllowsMultipleImages))
|
||||
foreach (var imageType in itemImages.Select(i => i.Type).Distinct().Where(item.AllowsMultipleImages))
|
||||
{
|
||||
var index = 0;
|
||||
|
||||
// Prevent implicitly captured closure
|
||||
var currentImageType = imageType;
|
||||
|
||||
foreach (var image in item.ImageInfos.Where(i => i.Type == currentImageType))
|
||||
foreach (var image in itemImages.Where(i => i.Type == currentImageType))
|
||||
{
|
||||
var info = GetImageInfo(item, image, index);
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace MediaBrowser.Api
|
|||
config.EnableStandaloneMusicKeys = true;
|
||||
config.EnableCaseSensitiveItemIds = true;
|
||||
//config.EnableFolderView = true;
|
||||
config.SchemaVersion = 97;
|
||||
config.SchemaVersion = 99;
|
||||
}
|
||||
|
||||
public void Post(UpdateStartupConfiguration request)
|
||||
|
|
|
@ -17,8 +17,14 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string SeriesName { get; set; }
|
||||
|
||||
public string FindSeriesName()
|
||||
{
|
||||
return SeriesName;
|
||||
}
|
||||
|
||||
public override bool CanDownload()
|
||||
{
|
||||
var locationType = LocationType;
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets the name of the series.
|
||||
/// </summary>
|
||||
/// <value>The name of the series.</value>
|
||||
string SeriesName { get; }
|
||||
string SeriesName { get; set; }
|
||||
|
||||
string FindSeriesName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
public List<Guid> RemoteTrailerIds { get; set; }
|
||||
public List<MediaUrl> RemoteTrailers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the season in which it aired.
|
||||
/// </summary>
|
||||
/// <value>The aired season.</value>
|
||||
public int? AirsBeforeSeasonNumber { get; set; }
|
||||
/// <summary>
|
||||
/// Gets the season in which it aired.
|
||||
/// </summary>
|
||||
/// <value>The aired season.</value>
|
||||
public int? AirsBeforeSeasonNumber { get; set; }
|
||||
public int? AirsAfterSeasonNumber { get; set; }
|
||||
public int? AirsBeforeEpisodeNumber { get; set; }
|
||||
|
||||
|
@ -166,13 +166,21 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string SeriesName
|
||||
public string SeriesName { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string SeasonName { get; set; }
|
||||
|
||||
public string FindSeasonName()
|
||||
{
|
||||
get
|
||||
{
|
||||
var series = Series;
|
||||
return series == null ? null : series.Name;
|
||||
}
|
||||
var season = Season;
|
||||
return season == null ? SeasonName : season.Name;
|
||||
}
|
||||
|
||||
public string FindSeriesName()
|
||||
{
|
||||
var series = Series;
|
||||
return series == null ? SeriesName : series.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -235,13 +235,12 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string SeriesName
|
||||
public string SeriesName { get; set; }
|
||||
|
||||
public string FindSeriesName()
|
||||
{
|
||||
get
|
||||
{
|
||||
var series = Series;
|
||||
return series == null ? null : series.Name;
|
||||
}
|
||||
var series = Series;
|
||||
return series == null ? SeriesName : series.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1076,15 +1076,11 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
dto.PreferredMetadataCountryCode = item.PreferredMetadataCountryCode;
|
||||
dto.PreferredMetadataLanguage = item.PreferredMetadataLanguage;
|
||||
|
||||
var hasCriticRating = item as IHasCriticRating;
|
||||
if (hasCriticRating != null)
|
||||
{
|
||||
dto.CriticRating = hasCriticRating.CriticRating;
|
||||
dto.CriticRating = item.CriticRating;
|
||||
|
||||
if (fields.Contains(ItemFields.CriticRatingSummary))
|
||||
{
|
||||
dto.CriticRatingSummary = hasCriticRating.CriticRatingSummary;
|
||||
}
|
||||
if (fields.Contains(ItemFields.CriticRatingSummary))
|
||||
{
|
||||
dto.CriticRatingSummary = item.CriticRatingSummary;
|
||||
}
|
||||
|
||||
var hasTrailers = item as IHasTrailers;
|
||||
|
@ -1127,11 +1123,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
|
||||
if (fields.Contains(ItemFields.ShortOverview))
|
||||
{
|
||||
var hasShortOverview = item as IHasShortOverview;
|
||||
if (hasShortOverview != null)
|
||||
{
|
||||
dto.ShortOverview = hasShortOverview.ShortOverview;
|
||||
}
|
||||
dto.ShortOverview = item.ShortOverview;
|
||||
}
|
||||
|
||||
// If there are no backdrops, indicate what parent has them in case the Ui wants to allow inheritance
|
||||
|
@ -1426,14 +1418,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
dto.SeasonId = seasonId.Value.ToString("N");
|
||||
}
|
||||
|
||||
var episodeSeason = episode.Season;
|
||||
if (episodeSeason != null)
|
||||
{
|
||||
if (fields.Contains(ItemFields.SeasonName))
|
||||
{
|
||||
dto.SeasonName = episodeSeason.Name;
|
||||
}
|
||||
}
|
||||
dto.SeasonName = episode.SeasonName;
|
||||
|
||||
var episodeSeries = episode.Series;
|
||||
|
||||
|
@ -1483,14 +1468,19 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
var season = item as Season;
|
||||
if (season != null)
|
||||
{
|
||||
dto.SeriesName = season.SeriesName;
|
||||
|
||||
series = season.Series;
|
||||
|
||||
if (series != null)
|
||||
{
|
||||
dto.SeriesId = GetDtoId(series);
|
||||
dto.SeriesName = series.Name;
|
||||
dto.AirTime = series.AirTime;
|
||||
dto.SeriesStudio = series.Studios.FirstOrDefault();
|
||||
|
||||
if (fields.Contains(ItemFields.SeriesStudio))
|
||||
{
|
||||
dto.SeriesStudio = series.Studios.FirstOrDefault();
|
||||
}
|
||||
|
||||
if (options.GetImageLimit(ImageType.Primary) > 0)
|
||||
{
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
private IDbCommand _updateInheritedRatingCommand;
|
||||
private IDbCommand _updateInheritedTagsCommand;
|
||||
|
||||
public const int LatestSchemaVersion = 97;
|
||||
public const int LatestSchemaVersion = 99;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||
|
@ -271,6 +271,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_connection.AddColumn(Logger, "TypedBaseItems", "IsVirtualItem", "BIT");
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "SeriesName", "Text");
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "UserDataKey", "Text");
|
||||
_connection.AddColumn(Logger, "TypedBaseItems", "SeasonName", "Text");
|
||||
|
||||
_connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT");
|
||||
_connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text");
|
||||
|
@ -402,7 +403,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"Album",
|
||||
"CriticRating",
|
||||
"CriticRatingSummary",
|
||||
"IsVirtualItem"
|
||||
"IsVirtualItem",
|
||||
"SeriesName",
|
||||
"SeasonName"
|
||||
};
|
||||
|
||||
private readonly string[] _mediaStreamSaveColumns =
|
||||
|
@ -522,7 +525,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"Album",
|
||||
"IsVirtualItem",
|
||||
"SeriesName",
|
||||
"UserDataKey"
|
||||
"UserDataKey",
|
||||
"SeasonName"
|
||||
};
|
||||
_saveItemCommand = _connection.CreateCommand();
|
||||
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
|
||||
|
@ -944,7 +948,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
var hasSeries = item as IHasSeries;
|
||||
if (hasSeries != null)
|
||||
{
|
||||
_saveItemCommand.GetParameter(index++).Value = hasSeries.SeriesName;
|
||||
_saveItemCommand.GetParameter(index++).Value = hasSeries.FindSeriesName();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -953,6 +957,16 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
_saveItemCommand.GetParameter(index++).Value = item.GetUserDataKeys().FirstOrDefault();
|
||||
|
||||
var episode = item as Episode;
|
||||
if (episode != null)
|
||||
{
|
||||
_saveItemCommand.GetParameter(index++).Value = episode.FindSeasonName();
|
||||
}
|
||||
else
|
||||
{
|
||||
_saveItemCommand.GetParameter(index++).Value = null;
|
||||
}
|
||||
|
||||
_saveItemCommand.Transaction = transaction;
|
||||
|
||||
_saveItemCommand.ExecuteNonQuery();
|
||||
|
@ -1375,6 +1389,24 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
item.IsVirtualItem = reader.GetBoolean(58);
|
||||
}
|
||||
|
||||
var hasSeries = item as IHasSeries;
|
||||
if (hasSeries != null)
|
||||
{
|
||||
if (!reader.IsDBNull(59))
|
||||
{
|
||||
hasSeries.SeriesName = reader.GetString(59);
|
||||
}
|
||||
}
|
||||
|
||||
var episode = item as Episode;
|
||||
if (episode != null)
|
||||
{
|
||||
if (!reader.IsDBNull(60))
|
||||
{
|
||||
episode.SeasonName = reader.GetString(60);
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user