From 35fc09911443819224fa38f88e9899af02533126 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 29 Sep 2015 13:35:23 -0400 Subject: [PATCH] removed dead db fields --- MediaBrowser.Api/ItemUpdateService.cs | 14 ++-------- .../Reports/Common/HeaderMetadata.cs | 1 - .../Reports/Common/ItemViewType.cs | 1 - .../Reports/Data/ReportBuilder.cs | 19 ------------- MediaBrowser.Api/Reports/Model/ReportRow.cs | 4 --- MediaBrowser.Api/Reports/ReportsService.cs | 1 - .../UserLibrary/BaseItemsRequest.cs | 3 --- MediaBrowser.Api/UserLibrary/ItemsService.cs | 1 - MediaBrowser.Controller/Channels/Channel.cs | 2 -- MediaBrowser.Controller/Entities/BaseItem.cs | 27 +++++-------------- MediaBrowser.Controller/Entities/Book.cs | 10 +------ MediaBrowser.Controller/Entities/Folder.cs | 10 +------ MediaBrowser.Controller/Entities/Game.cs | 10 +------ .../Entities/IHasMetadata.cs | 6 ----- .../Entities/IHasPreferredMetadataLanguage.cs | 21 --------------- .../Entities/InternalItemsQuery.cs | 1 - MediaBrowser.Controller/Entities/TV/Series.cs | 1 - .../Entities/UserViewBuilder.cs | 14 ---------- MediaBrowser.Controller/Entities/Video.cs | 8 ------ .../MediaBrowser.Controller.csproj | 1 - .../Providers/BaseItemXmlParser.cs | 12 ++------- .../Savers/XmlSaverHelpers.cs | 16 +++++------ MediaBrowser.Model/Dto/BaseItemDto.cs | 6 ----- .../Manager/MetadataService.cs | 8 +----- .../Manager/ProviderUtils.cs | 10 ++----- .../TV/SeriesMetadataService.cs | 5 ---- .../TV/SeriesPostScanTask.cs | 6 ----- .../Channels/ChannelManager.cs | 22 +++++++++------ .../Dto/DtoService.cs | 11 ++------ .../Persistence/SqliteItemRepository.cs | 26 +++++++++++++++--- .../Parsers/BaseNfoParser.cs | 12 ++------- .../Savers/BaseNfoSaver.cs | 16 +++++------ 32 files changed, 70 insertions(+), 235 deletions(-) delete mode 100644 MediaBrowser.Controller/Entities/IHasPreferredMetadataLanguage.cs diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index b8ae9392ae..23ff744957 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -211,11 +211,6 @@ namespace MediaBrowser.Api UpdateItem(request, item); - if (isLockedChanged && item.IsLocked) - { - item.IsUnidentified = false; - } - await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); if (request.People != null) @@ -321,13 +316,8 @@ namespace MediaBrowser.Api SetProductionLocations(item, request); - var hasLang = item as IHasPreferredMetadataLanguage; - - if (hasLang != null) - { - hasLang.PreferredMetadataCountryCode = request.PreferredMetadataCountryCode; - hasLang.PreferredMetadataLanguage = request.PreferredMetadataLanguage; - } + item.PreferredMetadataCountryCode = request.PreferredMetadataCountryCode; + item.PreferredMetadataLanguage = request.PreferredMetadataLanguage; var hasDisplayOrder = item as IHasDisplayOrder; if (hasDisplayOrder != null) diff --git a/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs b/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs index af5abf46aa..62f941a7a0 100644 --- a/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs +++ b/MediaBrowser.Api/Reports/Common/HeaderMetadata.cs @@ -43,7 +43,6 @@ namespace MediaBrowser.Api.Reports MusicArtist, AudioAlbum, Locked, - Unidentified, ImagePrimary, ImageBackdrop, ImageLogo, diff --git a/MediaBrowser.Api/Reports/Common/ItemViewType.cs b/MediaBrowser.Api/Reports/Common/ItemViewType.cs index 5126457cf9..0984421153 100644 --- a/MediaBrowser.Api/Reports/Common/ItemViewType.cs +++ b/MediaBrowser.Api/Reports/Common/ItemViewType.cs @@ -17,7 +17,6 @@ namespace MediaBrowser.Api.Reports TrailersImage, SpecialsImage, LockDataImage, - UnidentifiedImage, TagsPrimaryImage, TagsBackdropImage, TagsLogoImage, diff --git a/MediaBrowser.Api/Reports/Data/ReportBuilder.cs b/MediaBrowser.Api/Reports/Data/ReportBuilder.cs index 512441bd7b..5e339dc734 100644 --- a/MediaBrowser.Api/Reports/Data/ReportBuilder.cs +++ b/MediaBrowser.Api/Reports/Data/ReportBuilder.cs @@ -105,7 +105,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -122,7 +121,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -143,7 +141,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -161,7 +158,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -177,7 +173,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -198,7 +193,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -223,7 +217,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -241,7 +234,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -260,7 +252,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -284,7 +275,6 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -315,11 +305,9 @@ namespace MediaBrowser.Api.Reports { HeaderMetadata.Status, HeaderMetadata.Locked, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, - HeaderMetadata.Unidentified, HeaderMetadata.ImagePrimary, HeaderMetadata.ImageBackdrop, HeaderMetadata.ImageLogo, @@ -376,12 +364,6 @@ namespace MediaBrowser.Api.Reports option.Header.CanGroup = false; option.Header.DisplayType = ReportDisplayType.Export; break; - case HeaderMetadata.Unidentified: - option.Column = (i, r) => this.GetBoolString(r.IsUnidentified); - option.Header.ItemViewType = ItemViewType.UnidentifiedImage; - option.Header.CanGroup = false; - option.Header.DisplayType = ReportDisplayType.Export; - break; case HeaderMetadata.ImagePrimary: option.Column = (i, r) => this.GetBoolString(r.HasImageTagsPrimary); option.Header.ItemViewType = ItemViewType.TagsPrimaryImage; @@ -633,7 +615,6 @@ namespace MediaBrowser.Api.Reports { Id = item.Id.ToString("N"), HasLockData = item.IsLocked, - IsUnidentified = item.IsUnidentified, HasLocalTrailer = hasTrailers != null ? hasTrailers.GetTrailerIds().Count() > 0 : false, HasImageTagsPrimary = (item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Primary) > 0), HasImageTagsBackdrop = (item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Backdrop) > 0), diff --git a/MediaBrowser.Api/Reports/Model/ReportRow.cs b/MediaBrowser.Api/Reports/Model/ReportRow.cs index 3f66b8479b..1a46b72b7a 100644 --- a/MediaBrowser.Api/Reports/Model/ReportRow.cs +++ b/MediaBrowser.Api/Reports/Model/ReportRow.cs @@ -56,10 +56,6 @@ namespace MediaBrowser.Api.Reports /// true if this object has specials, false if not. public bool HasSpecials { get; set; } - /// Gets or sets a value indicating whether this object is unidentified. - /// true if this object is unidentified, false if not. - public bool IsUnidentified { get; set; } - /// Gets or sets the columns. /// The columns. public List Columns { get; set; } diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index 82e7264f15..6c2886f5be 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -226,7 +226,6 @@ namespace MediaBrowser.Api.Reports NameStartsWithOrGreater = request.NameStartsWithOrGreater, HasImdbId = request.HasImdbId, IsYearMismatched = request.IsYearMismatched, - IsUnidentified = request.IsUnidentified, IsPlaceHolder = request.IsPlaceHolder, IsLocked = request.IsLocked, IsInBoxSet = request.IsInBoxSet, diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index 7db8e4dcad..4d844e6cbe 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -299,9 +299,6 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "IsLocked", Description = "Optional filter by items that are locked.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public bool? IsLocked { get; set; } - [ApiMember(Name = "IsUnidentified", Description = "Optional filter by items that are unidentified by internet metadata providers.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public bool? IsUnidentified { get; set; } - [ApiMember(Name = "IsPlaceHolder", Description = "Optional filter by items that are placeholders", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public bool? IsPlaceHolder { get; set; } diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 7d3290c2f9..f1168ab7f4 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -192,7 +192,6 @@ namespace MediaBrowser.Api.UserLibrary NameStartsWithOrGreater = request.NameStartsWithOrGreater, HasImdbId = request.HasImdbId, IsYearMismatched = request.IsYearMismatched, - IsUnidentified = request.IsUnidentified, IsPlaceHolder = request.IsPlaceHolder, IsLocked = request.IsLocked, IsInBoxSet = request.IsInBoxSet, diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs index f0328a1d88..839b7d68f5 100644 --- a/MediaBrowser.Controller/Channels/Channel.cs +++ b/MediaBrowser.Controller/Channels/Channel.cs @@ -10,8 +10,6 @@ namespace MediaBrowser.Controller.Channels { public class Channel : Folder { - public string OriginalChannelName { get; set; } - public override bool IsVisible(User user) { if (user.Policy.BlockedChannels != null) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 75dd046a08..5403c16ddf 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -55,6 +55,9 @@ namespace MediaBrowser.Controller.Entities public static string ThemeSongFilename = "theme"; public static string ThemeVideosFolderName = "backdrops"; + public string PreferredMetadataCountryCode { get; set; } + public string PreferredMetadataLanguage { get; set; } + public List ImageInfos { get; set; } /// @@ -333,8 +336,6 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public bool IsLocked { get; set; } - - public bool IsUnidentified { get; set; } /// /// Gets or sets the locked fields. @@ -973,18 +974,11 @@ namespace MediaBrowser.Controller.Entities /// System.String. public string GetPreferredMetadataLanguage() { - string lang = null; - - var hasLang = this as IHasPreferredMetadataLanguage; - - if (hasLang != null) - { - lang = hasLang.PreferredMetadataLanguage; - } + string lang = PreferredMetadataLanguage; if (string.IsNullOrWhiteSpace(lang)) { - lang = Parents.OfType() + lang = Parents .Select(i => i.PreferredMetadataLanguage) .FirstOrDefault(i => !string.IsNullOrWhiteSpace(i)); } @@ -1010,18 +1004,11 @@ namespace MediaBrowser.Controller.Entities /// System.String. public string GetPreferredMetadataCountryCode() { - string lang = null; - - var hasLang = this as IHasPreferredMetadataLanguage; - - if (hasLang != null) - { - lang = hasLang.PreferredMetadataCountryCode; - } + string lang = PreferredMetadataCountryCode; if (string.IsNullOrWhiteSpace(lang)) { - lang = Parents.OfType() + lang = Parents .Select(i => i.PreferredMetadataCountryCode) .FirstOrDefault(i => !string.IsNullOrWhiteSpace(i)); } diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs index e59db67a6a..d31675baf6 100644 --- a/MediaBrowser.Controller/Entities/Book.cs +++ b/MediaBrowser.Controller/Entities/Book.cs @@ -7,7 +7,7 @@ using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities { - public class Book : BaseItem, IHasTags, IHasPreferredMetadataLanguage, IHasLookupInfo, IHasSeries + public class Book : BaseItem, IHasTags, IHasLookupInfo, IHasSeries { public override string MediaType { @@ -25,14 +25,6 @@ namespace MediaBrowser.Controller.Entities public string SeriesName { get; set; } - public string PreferredMetadataLanguage { get; set; } - - /// - /// Gets or sets the preferred metadata country code. - /// - /// The preferred metadata country code. - public string PreferredMetadataCountryCode { get; set; } - public Book() { Tags = new List(); diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 3b00d50be4..401ca66de2 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -19,7 +19,7 @@ namespace MediaBrowser.Controller.Entities /// /// Class Folder /// - public class Folder : BaseItem, IHasThemeMedia, IHasTags, IHasPreferredMetadataLanguage + public class Folder : BaseItem, IHasThemeMedia, IHasTags { public static IUserManager UserManager { get; set; } public static IUserViewManager UserViewManager { get; set; } @@ -28,14 +28,6 @@ namespace MediaBrowser.Controller.Entities public List ThemeVideoIds { get; set; } public List Tags { get; set; } - public string PreferredMetadataLanguage { get; set; } - - /// - /// Gets or sets the preferred metadata country code. - /// - /// The preferred metadata country code. - public string PreferredMetadataCountryCode { get; set; } - public Folder() { LinkedChildren = new List(); diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index 15d2d755a8..ed3e85d586 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -8,19 +8,11 @@ using System.Linq; namespace MediaBrowser.Controller.Entities { - public class Game : BaseItem, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, ISupportsPlaceHolders, IHasPreferredMetadataLanguage, IHasLookupInfo + public class Game : BaseItem, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, ISupportsPlaceHolders, IHasLookupInfo { public List ThemeSongIds { get; set; } public List ThemeVideoIds { get; set; } - public string PreferredMetadataLanguage { get; set; } - - /// - /// Gets or sets the preferred metadata country code. - /// - /// The preferred metadata country code. - public string PreferredMetadataCountryCode { get; set; } - public Game() { MultiPartGameFiles = new List(); diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs index 9d54541f19..b8c3e2823c 100644 --- a/MediaBrowser.Controller/Entities/IHasMetadata.cs +++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs @@ -44,12 +44,6 @@ namespace MediaBrowser.Controller.Entities /// true if XXXX, false otherwise. bool BeforeMetadataRefresh(); - /// - /// Gets or sets a value indicating whether this instance is unidentified. - /// - /// true if this instance is unidentified; otherwise, false. - bool IsUnidentified { get; set; } - /// /// Afters the metadata refresh. /// diff --git a/MediaBrowser.Controller/Entities/IHasPreferredMetadataLanguage.cs b/MediaBrowser.Controller/Entities/IHasPreferredMetadataLanguage.cs deleted file mode 100644 index e3a233e49e..0000000000 --- a/MediaBrowser.Controller/Entities/IHasPreferredMetadataLanguage.cs +++ /dev/null @@ -1,21 +0,0 @@ - -namespace MediaBrowser.Controller.Entities -{ - /// - /// Interface IHasPreferredMetadataLanguage - /// - public interface IHasPreferredMetadataLanguage - { - /// - /// Gets or sets the preferred metadata language. - /// - /// The preferred metadata language. - string PreferredMetadataLanguage { get; set; } - - /// - /// Gets or sets the preferred metadata country code. - /// - /// The preferred metadata country code. - string PreferredMetadataCountryCode { get; set; } - } -} diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index e2d9d9a58f..785e2fd2bb 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -52,7 +52,6 @@ namespace MediaBrowser.Controller.Entities public bool? IsHD { get; set; } public bool? IsInBoxSet { get; set; } public bool? IsLocked { get; set; } - public bool? IsUnidentified { get; set; } public bool? IsPlaceHolder { get; set; } public bool? IsYearMismatched { get; set; } diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 2663d19e8f..b23833845e 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -20,7 +20,6 @@ namespace MediaBrowser.Controller.Entities.TV public List SpecialFeatureIds { get; set; } public string OriginalTitle { get; set; } - public int SeasonCount { get; set; } public int? AnimeSeriesIndex { get; set; } diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index e05b838d06..ce9a8903a3 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -1036,11 +1036,6 @@ namespace MediaBrowser.Controller.Entities return false; } - if (request.IsUnidentified.HasValue) - { - return false; - } - if (!string.IsNullOrWhiteSpace(request.Person)) { return false; @@ -1429,15 +1424,6 @@ namespace MediaBrowser.Controller.Entities } } - if (query.IsUnidentified.HasValue) - { - var val = query.IsUnidentified.Value; - if (item.IsUnidentified != val) - { - return false; - } - } - if (query.HasImdbId.HasValue) { var filterValue = query.HasImdbId.Value; diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index b9159b9f7a..21405faf1b 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -23,7 +23,6 @@ namespace MediaBrowser.Controller.Entities ISupportsPlaceHolders, IHasMediaSources, IHasShortOverview, - IHasPreferredMetadataLanguage, IThemeMedia, IArchivable { @@ -48,13 +47,6 @@ namespace MediaBrowser.Controller.Entities public string ShortOverview { get; set; } public ExtraType? ExtraType { get; set; } - /// - /// Gets or sets the preferred metadata country code. - /// - /// The preferred metadata country code. - public string PreferredMetadataCountryCode { get; set; } - public string PreferredMetadataLanguage { get; set; } - /// /// Gets or sets the timestamp. /// diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index a3e00359f5..b20f155447 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -144,7 +144,6 @@ - diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index 383d0881e9..2efd6e5c61 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -304,11 +304,7 @@ namespace MediaBrowser.Controller.Providers { var val = reader.ReadElementContentAsString(); - var hasLanguage = item as IHasPreferredMetadataLanguage; - if (hasLanguage != null) - { - hasLanguage.PreferredMetadataLanguage = val; - } + item.PreferredMetadataLanguage = val; break; } @@ -317,11 +313,7 @@ namespace MediaBrowser.Controller.Providers { var val = reader.ReadElementContentAsString(); - var hasLanguage = item as IHasPreferredMetadataLanguage; - if (hasLanguage != null) - { - hasLanguage.PreferredMetadataCountryCode = val; - } + item.PreferredMetadataCountryCode = val; break; } diff --git a/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs b/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs index d90d22be3a..b56694a926 100644 --- a/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs +++ b/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs @@ -426,17 +426,13 @@ namespace MediaBrowser.LocalMetadata.Savers } } - var hasLanguage = item as IHasPreferredMetadataLanguage; - if (hasLanguage != null) + if (!string.IsNullOrEmpty(item.PreferredMetadataLanguage)) { - if (!string.IsNullOrEmpty(hasLanguage.PreferredMetadataLanguage)) - { - builder.Append("" + SecurityElement.Escape(hasLanguage.PreferredMetadataLanguage) + ""); - } - if (!string.IsNullOrEmpty(hasLanguage.PreferredMetadataCountryCode)) - { - builder.Append("" + SecurityElement.Escape(hasLanguage.PreferredMetadataCountryCode) + ""); - } + builder.Append("" + SecurityElement.Escape(item.PreferredMetadataLanguage) + ""); + } + if (!string.IsNullOrEmpty(item.PreferredMetadataCountryCode)) + { + builder.Append("" + SecurityElement.Escape(item.PreferredMetadataCountryCode) + ""); } // Use original runtime here, actual file runtime later in MediaInfo diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index 90dd3ad586..57fc711c23 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -275,12 +275,6 @@ namespace MediaBrowser.Model.Dto /// The production year. public int? ProductionYear { get; set; } - /// - /// Gets or sets the season count. - /// - /// The season count. - public int? SeasonCount { get; set; } - /// /// Gets or sets the players supported by a game. /// diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 71cfea2097..daf0a5822e 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -483,13 +483,7 @@ namespace MediaBrowser.Providers.Manager } } - var isUnidentified = failedProviderCount > 0 && successfulProviderCount == 0; - - if (item.IsUnidentified != isUnidentified) - { - item.IsUnidentified = isUnidentified; - refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataImport; - } + //var isUnidentified = failedProviderCount > 0 && successfulProviderCount == 0; foreach (var provider in customProviders.Where(i => !(i is IPreRefreshProvider))) { diff --git a/MediaBrowser.Providers/Manager/ProviderUtils.cs b/MediaBrowser.Providers/Manager/ProviderUtils.cs index fa4840f103..20b2ac6cd2 100644 --- a/MediaBrowser.Providers/Manager/ProviderUtils.cs +++ b/MediaBrowser.Providers/Manager/ProviderUtils.cs @@ -227,14 +227,8 @@ namespace MediaBrowser.Providers.Manager target.DateCreated = source.DateCreated; } - var sourceHasLanguageSettings = source as IHasPreferredMetadataLanguage; - var targetHasLanguageSettings = target as IHasPreferredMetadataLanguage; - - if (sourceHasLanguageSettings != null && targetHasLanguageSettings != null) - { - targetHasLanguageSettings.PreferredMetadataCountryCode = sourceHasLanguageSettings.PreferredMetadataCountryCode; - targetHasLanguageSettings.PreferredMetadataLanguage = sourceHasLanguageSettings.PreferredMetadataLanguage; - } + target.PreferredMetadataCountryCode = source.PreferredMetadataCountryCode; + target.PreferredMetadataLanguage = source.PreferredMetadataLanguage; var sourceHasDisplayOrder = source as IHasDisplayOrder; var targetHasDisplayOrder = target as IHasDisplayOrder; diff --git a/MediaBrowser.Providers/TV/SeriesMetadataService.cs b/MediaBrowser.Providers/TV/SeriesMetadataService.cs index 24da853d3d..6a038b0acd 100644 --- a/MediaBrowser.Providers/TV/SeriesMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeriesMetadataService.cs @@ -62,11 +62,6 @@ namespace MediaBrowser.Providers.TV var sourceItem = source.Item; var targetItem = target.Item; - if (replaceData || targetItem.SeasonCount == 0) - { - targetItem.SeasonCount = sourceItem.SeasonCount; - } - if (replaceData || string.IsNullOrEmpty(targetItem.AirTime)) { targetItem.AirTime = sourceItem.AirTime; diff --git a/MediaBrowser.Providers/TV/SeriesPostScanTask.cs b/MediaBrowser.Providers/TV/SeriesPostScanTask.cs index f7a2dcefe9..991aba6def 100644 --- a/MediaBrowser.Providers/TV/SeriesPostScanTask.cs +++ b/MediaBrowser.Providers/TV/SeriesPostScanTask.cs @@ -68,12 +68,6 @@ namespace MediaBrowser.Providers.TV var physicalEpisodes = episodes.Where(i => i.LocationType != LocationType.Virtual) .ToList(); - series.SeasonCount = episodes - .Select(i => i.ParentIndexNumber ?? 0) - .Where(i => i != 0) - .Distinct() - .Count(); - series.SpecialFeatureIds = physicalEpisodes .Where(i => i.ParentIndexNumber.HasValue && i.ParentIndexNumber.Value == 0) .Select(i => i.Id) diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index d7209fbdf9..9b2f812172 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -303,7 +303,7 @@ namespace MediaBrowser.Server.Implementations.Channels try { - var files = _fileSystem.GetFiles(parentPath); + var files = _fileSystem.GetFiles(parentPath); if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) { @@ -396,7 +396,7 @@ namespace MediaBrowser.Server.Implementations.Channels { _logger.Debug("Creating directory {0}", path); - _fileSystem.CreateDirectory(path); + _fileSystem.CreateDirectory(path); fileInfo = new DirectoryInfo(path); if (!fileInfo.Exists) @@ -417,16 +417,22 @@ namespace MediaBrowser.Server.Implementations.Channels Id = id, DateCreated = _fileSystem.GetCreationTimeUtc(fileInfo), DateModified = _fileSystem.GetLastWriteTimeUtc(fileInfo), - Path = path + Path = path, + ChannelId = channelInfo.Name.GetMD5().ToString("N") }; isNew = true; } + var channelId = channelInfo.Name.GetMD5().ToString("N"); + if (!string.Equals(item.ChannelId, channelId, StringComparison.OrdinalIgnoreCase)) + { + isNew = true; + } + item.OfficialRating = GetOfficialRating(channelInfo.ParentalRating); item.Overview = channelInfo.Description; item.HomePageUrl = channelInfo.HomePageUrl; - item.OriginalChannelName = channelInfo.Name; if (string.IsNullOrEmpty(item.Name)) { @@ -1067,7 +1073,7 @@ namespace MediaBrowser.Server.Implementations.Channels { try { - _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); _jsonSerializer.SerializeToFile(result, path); } @@ -1296,7 +1302,7 @@ namespace MediaBrowser.Server.Implementations.Channels internal IChannel GetChannelProvider(Channel channel) { - return GetAllChannels().First(i => string.Equals(i.Name, channel.OriginalChannelName, StringComparison.OrdinalIgnoreCase)); + return GetAllChannels().First(i => string.Equals(i.Name.GetMD5().ToString("N"), channel.ChannelId, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, channel.Name, StringComparison.OrdinalIgnoreCase)); } private IEnumerable ApplyFilters(IEnumerable items, IEnumerable filters, User user) @@ -1447,7 +1453,7 @@ namespace MediaBrowser.Server.Implementations.Channels options.RequestHeaders[header.Key] = header.Value; } - _fileSystem.CreateDirectory(Path.GetDirectoryName(destination)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(destination)); // Determine output extension var response = await _httpClient.GetTempFileResponse(options).ConfigureAwait(false); @@ -1485,7 +1491,7 @@ namespace MediaBrowser.Server.Implementations.Channels throw new ApplicationException("Unexpected response type encountered: " + response.ContentType); } - _fileSystem.CopyFile(response.TempFilePath, destination, true); + _fileSystem.CopyFile(response.TempFilePath, destination, true); try { diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 2f2ebb349f..07374a6c30 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1042,13 +1042,8 @@ namespace MediaBrowser.Server.Implementations.Dto dto.MediaType = item.MediaType; dto.LocationType = item.LocationType; - var hasLang = item as IHasPreferredMetadataLanguage; - - if (hasLang != null) - { - dto.PreferredMetadataCountryCode = hasLang.PreferredMetadataCountryCode; - dto.PreferredMetadataLanguage = hasLang.PreferredMetadataLanguage; - } + dto.PreferredMetadataCountryCode = item.PreferredMetadataCountryCode; + dto.PreferredMetadataLanguage = item.PreferredMetadataLanguage; var hasCriticRating = item as IHasCriticRating; if (hasCriticRating != null) @@ -1427,8 +1422,6 @@ namespace MediaBrowser.Server.Implementations.Dto dto.AirTime = series.AirTime; dto.SeriesStatus = series.Status; - dto.SeasonCount = series.SeasonCount; - if (fields.Contains(ItemFields.Settings)) { dto.DisplaySpecialsWithSeasons = series.DisplaySpecialsWithSeasons; diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 35ef80b321..8ce121db3f 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -72,7 +72,7 @@ namespace MediaBrowser.Server.Implementations.Persistence private IDbCommand _deletePeopleCommand; private IDbCommand _savePersonCommand; - private const int LatestSchemaVersion = 10; + private const int LatestSchemaVersion = 11; /// /// Initializes a new instance of the class. @@ -184,6 +184,9 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection.AddColumn(_logger, "TypedBaseItems", "EpisodeTitle", "Text"); _connection.AddColumn(_logger, "TypedBaseItems", "IsRepeat", "BIT"); + + _connection.AddColumn(_logger, "TypedBaseItems", "PreferredMetadataLanguage", "Text"); + _connection.AddColumn(_logger, "TypedBaseItems", "PreferredMetadataCountryCode", "Text"); PrepareStatements(); @@ -216,7 +219,9 @@ namespace MediaBrowser.Server.Implementations.Persistence "CommunityRating", "CustomRating", "IndexNumber", - "IsLocked" + "IsLocked", + "PreferredMetadataLanguage", + "PreferredMetadataCountryCode" }; /// @@ -267,7 +272,9 @@ namespace MediaBrowser.Server.Implementations.Persistence "DateModified", "ForcedSortName", "IsOffline", - "LocationType" + "LocationType", + "PreferredMetadataLanguage", + "PreferredMetadataCountryCode" }; _saveItemCommand = _connection.CreateCommand(); _saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values ("; @@ -451,6 +458,9 @@ namespace MediaBrowser.Server.Implementations.Persistence _saveItemCommand.GetParameter(index++).Value = item.IsOffline; _saveItemCommand.GetParameter(index++).Value = item.LocationType.ToString(); + _saveItemCommand.GetParameter(index++).Value = item.PreferredMetadataLanguage; + _saveItemCommand.GetParameter(index++).Value = item.PreferredMetadataCountryCode; + _saveItemCommand.Transaction = transaction; _saveItemCommand.ExecuteNonQuery(); @@ -647,6 +657,16 @@ namespace MediaBrowser.Server.Implementations.Persistence item.IsLocked = reader.GetBoolean(18); } + if (!reader.IsDBNull(19)) + { + item.PreferredMetadataLanguage = reader.GetString(19); + } + + if (!reader.IsDBNull(20)) + { + item.PreferredMetadataCountryCode = reader.GetString(20); + } + return item; } diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index ac39d9d987..c5184ec3d1 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -394,11 +394,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers { var val = reader.ReadElementContentAsString(); - var hasLanguage = item as IHasPreferredMetadataLanguage; - if (hasLanguage != null) - { - hasLanguage.PreferredMetadataLanguage = val; - } + item.PreferredMetadataLanguage = val; break; } @@ -407,11 +403,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers { var val = reader.ReadElementContentAsString(); - var hasLanguage = item as IHasPreferredMetadataLanguage; - if (hasLanguage != null) - { - hasLanguage.PreferredMetadataCountryCode = val; - } + item.PreferredMetadataCountryCode = val; break; } diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index 7d2aa0797b..8876e19560 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -599,17 +599,13 @@ namespace MediaBrowser.XbmcMetadata.Savers writer.WriteElementString("tvcomid", tvcom); } - var hasLanguage = item as IHasPreferredMetadataLanguage; - if (hasLanguage != null) + if (!string.IsNullOrEmpty(item.PreferredMetadataLanguage)) { - if (!string.IsNullOrEmpty(hasLanguage.PreferredMetadataLanguage)) - { - writer.WriteElementString("language", hasLanguage.PreferredMetadataLanguage); - } - if (!string.IsNullOrEmpty(hasLanguage.PreferredMetadataCountryCode)) - { - writer.WriteElementString("countrycode", hasLanguage.PreferredMetadataCountryCode); - } + writer.WriteElementString("language", item.PreferredMetadataLanguage); + } + if (!string.IsNullOrEmpty(item.PreferredMetadataCountryCode)) + { + writer.WriteElementString("countrycode", item.PreferredMetadataCountryCode); } if (item.PremiereDate.HasValue && !(item is Episode))