diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index f639d0869..54b2c0ea7 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -225,6 +225,7 @@ namespace MediaBrowser.Api item.EndDate = request.EndDate.HasValue ? request.EndDate.Value.ToUniversalTime() : (DateTime?)null; item.PremiereDate = request.PremiereDate.HasValue ? request.PremiereDate.Value.ToUniversalTime() : (DateTime?)null; item.ProductionYear = request.ProductionYear; + item.ProductionLocations = request.ProductionLocations; item.AspectRatio = request.AspectRatio; item.Language = request.Language; item.OfficialRating = request.OfficialRating; diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index c0d681de2..35639925d 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1279,11 +1279,6 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentNullException("location"); } - if (ProductionLocations == null) - { - ProductionLocations = new List(); - } - if (!ProductionLocations.Contains(location, StringComparer.OrdinalIgnoreCase)) { ProductionLocations.Add(location); diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index fde44eee9..e3cef0d16 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -211,6 +211,18 @@ namespace MediaBrowser.Controller.Providers break; } + case "PlaceOfBirth": + { + var val = reader.ReadElementContentAsString(); + + if (!string.IsNullOrWhiteSpace(val)) + { + item.ProductionLocations = new List { val }; + } + + break; + } + case "Website": { var val = reader.ReadElementContentAsString(); @@ -465,6 +477,24 @@ namespace MediaBrowser.Controller.Providers break; } + case "DeathDate": + case "EndDate": + { + var firstAired = reader.ReadElementContentAsString(); + + if (!string.IsNullOrWhiteSpace(firstAired)) + { + DateTime airDate; + + if (DateTime.TryParse(firstAired, out airDate) && airDate.Year > 1850) + { + item.EndDate = airDate.ToUniversalTime(); + } + } + + break; + } + case "TvDbId": var tvdbId = reader.ReadElementContentAsString(); if (!string.IsNullOrWhiteSpace(tvdbId)) diff --git a/MediaBrowser.Providers/Movies/TmdbPersonProvider.cs b/MediaBrowser.Providers/Movies/TmdbPersonProvider.cs index 894a896cd..25f39d32f 100644 --- a/MediaBrowser.Providers/Movies/TmdbPersonProvider.cs +++ b/MediaBrowser.Providers/Movies/TmdbPersonProvider.cs @@ -23,7 +23,7 @@ namespace MediaBrowser.Providers.Movies public class TmdbPersonProvider : BaseMetadataProvider { protected readonly IProviderManager ProviderManager; - + public TmdbPersonProvider(IJsonSerializer jsonSerializer, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager) : base(logManager, configurationManager) { @@ -74,12 +74,12 @@ namespace MediaBrowser.Providers.Movies return ItemUpdateType.ImageUpdate | ItemUpdateType.MetadataDownload; } } - + protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo) { if (HasAltMeta(item)) return false; - + return base.NeedsRefreshInternal(item, providerInfo); } @@ -87,7 +87,7 @@ namespace MediaBrowser.Providers.Movies { return item.LocationType == LocationType.FileSystem && item.ResolveArgs.ContainsMetaFileByName("person.xml"); } - + /// /// Fetches metadata and returns true or false indicating if any work that requires persistence was done /// @@ -146,7 +146,7 @@ namespace MediaBrowser.Providers.Movies } protected readonly CultureInfo UsCulture = new CultureInfo("en-US"); - + /// /// Gets the TMDB id. /// @@ -233,11 +233,14 @@ namespace MediaBrowser.Providers.Movies person.HomePageUrl = searchResult.homepage; } - if (!string.IsNullOrEmpty(searchResult.place_of_birth)) + if (!person.LockedFields.Contains(MetadataFields.ProductionLocations)) { - person.AddProductionLocation(searchResult.place_of_birth); + if (!string.IsNullOrEmpty(searchResult.place_of_birth)) + { + person.ProductionLocations = new List { searchResult.place_of_birth }; + } } - + person.SetProviderId(MetadataProviders.Tmdb, searchResult.id.ToString(UsCulture)); } diff --git a/MediaBrowser.Providers/Savers/PersonXmlSaver.cs b/MediaBrowser.Providers/Savers/PersonXmlSaver.cs index f0be42be3..1b1377ac8 100644 --- a/MediaBrowser.Providers/Savers/PersonXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/PersonXmlSaver.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using System.Security; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Providers.Movies; using System; @@ -23,7 +24,7 @@ namespace MediaBrowser.Providers.Savers { var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - + // If new metadata has been downloaded or metadata was manually edited, proceed if ((wasMetadataEdited || wasMetadataDownloaded)) { @@ -47,11 +48,19 @@ namespace MediaBrowser.Providers.Savers XmlSaverHelpers.AddCommonNodes(item, builder); + if (item.ProductionLocations.Count > 0) + { + builder.Append("" + SecurityElement.Escape(item.ProductionLocations[0]) + ""); + } + builder.Append(""); var xmlFilePath = GetSavePath(item); - XmlSaverHelpers.Save(builder, xmlFilePath, new string[] { }); + XmlSaverHelpers.Save(builder, xmlFilePath, new[] + { + "PlaceOfBirth" + }); // Set last refreshed so that the provider doesn't trigger after the file save PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow); diff --git a/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs b/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs index 7617181c2..3e03a31cb 100644 --- a/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs +++ b/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs @@ -47,6 +47,7 @@ namespace MediaBrowser.Providers.Savers "LocalTitle", "SortTitle", "PremiereDate", + "EndDate", "Budget", "Revenue", "Rating", @@ -74,7 +75,9 @@ namespace MediaBrowser.Providers.Savers "Trailer", "CriticRating", "CriticRatingSummary", - "GamesDbId" + "GamesDbId", + "BirthDate", + "DeathDate" }); var position = xml.ToString().LastIndexOf("" + SecurityElement.Escape(item.EndDate.Value.ToString("yyyy-MM-dd")) + ""); + } + else if (!(item is Episode)) + { + builder.Append("" + SecurityElement.Escape(item.EndDate.Value.ToString("yyyy-MM-dd")) + ""); + } + } + if (item.RemoteTrailers.Count > 0) { builder.Append("" + SecurityElement.Escape(item.RemoteTrailers[0].Url) + "");