From 86de351e239c24c7ad226f4a0e6c564e0dd160cd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 1 Nov 2016 11:30:15 -0400 Subject: [PATCH 1/4] update BaseXmlSaver --- .../Savers/BaseXmlSaver.cs | 206 +++++++++--------- 1 file changed, 103 insertions(+), 103 deletions(-) diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index 466e50056..162143385 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -407,17 +407,17 @@ namespace MediaBrowser.LocalMetadata.Savers } } - //if (hasProductionLocations.ProductionLocations.Count > 0) - //{ - // builder.Append(""); + if (item.ProductionLocations.Count > 0) + { + writer.WriteStartElement("Countries"); - // foreach (var name in hasProductionLocations.ProductionLocations) - // { - // builder.Append("" + SecurityElement.Escape(name) + ""); - // } + foreach (var name in item.ProductionLocations) + { + writer.WriteElementString("Country", name); + } - // builder.Append(""); - //} + writer.WriteEndElement(); + } var hasDisplayOrder = item as IHasDisplayOrder; if (hasDisplayOrder != null && !string.IsNullOrEmpty(hasDisplayOrder.DisplayOrder)) @@ -425,17 +425,17 @@ namespace MediaBrowser.LocalMetadata.Savers writer.WriteElementString("DisplayOrder", hasDisplayOrder.DisplayOrder); } - //var hasMetascore = item as IHasMetascore; - //if (hasMetascore != null && hasMetascore.Metascore.HasValue) - //{ - // builder.Append("" + SecurityElement.Escape(hasMetascore.Metascore.Value.ToString(UsCulture)) + ""); - //} + var hasMetascore = item as IHasMetascore; + if (hasMetascore != null && hasMetascore.Metascore.HasValue) + { + writer.WriteElementString("Metascore", hasMetascore.Metascore.Value.ToString(UsCulture)); + } - //var hasAwards = item as IHasAwards; - //if (hasAwards != null && !string.IsNullOrEmpty(hasAwards.AwardSummary)) - //{ - // builder.Append("" + SecurityElement.Escape(hasAwards.AwardSummary) + ""); - //} + var hasAwards = item as IHasAwards; + if (hasAwards != null && !string.IsNullOrEmpty(hasAwards.AwardSummary)) + { + writer.WriteElementString("AwardSummary", hasAwards.AwardSummary); + } var hasBudget = item as IHasBudget; if (hasBudget != null) @@ -451,14 +451,14 @@ namespace MediaBrowser.LocalMetadata.Savers } } - //if (item.CommunityRating.HasValue) - //{ - // builder.Append("" + SecurityElement.Escape(item.CommunityRating.Value.ToString(UsCulture)) + ""); - //} - //if (item.VoteCount.HasValue) - //{ - // builder.Append("" + SecurityElement.Escape(item.VoteCount.Value.ToString(UsCulture)) + ""); - //} + if (item.CommunityRating.HasValue) + { + writer.WriteElementString("Rating", item.CommunityRating.Value.ToString(UsCulture)); + } + if (item.VoteCount.HasValue) + { + writer.WriteElementString("VoteCount", item.VoteCount.Value.ToString(UsCulture)); + } if (item.ProductionYear.HasValue && !(item is Person)) { @@ -470,76 +470,76 @@ namespace MediaBrowser.LocalMetadata.Savers writer.WriteElementString("Website", item.HomePageUrl); } - //var hasAspectRatio = item as IHasAspectRatio; - //if (hasAspectRatio != null) - //{ - // if (!string.IsNullOrEmpty(hasAspectRatio.AspectRatio)) - // { - // builder.Append("" + SecurityElement.Escape(hasAspectRatio.AspectRatio) + ""); - // } - //} + var hasAspectRatio = item as IHasAspectRatio; + if (hasAspectRatio != null) + { + if (!string.IsNullOrEmpty(hasAspectRatio.AspectRatio)) + { + writer.WriteElementString("AspectRatio", hasAspectRatio.AspectRatio); + } + } - //if (!string.IsNullOrEmpty(item.PreferredMetadataLanguage)) - //{ - // builder.Append("" + SecurityElement.Escape(item.PreferredMetadataLanguage) + ""); - //} - //if (!string.IsNullOrEmpty(item.PreferredMetadataCountryCode)) - //{ - // builder.Append("" + SecurityElement.Escape(item.PreferredMetadataCountryCode) + ""); - //} + if (!string.IsNullOrEmpty(item.PreferredMetadataLanguage)) + { + writer.WriteElementString("Language", item.PreferredMetadataLanguage); + } + if (!string.IsNullOrEmpty(item.PreferredMetadataCountryCode)) + { + writer.WriteElementString("CountryCode", item.PreferredMetadataCountryCode); + } - //// Use original runtime here, actual file runtime later in MediaInfo - //var runTimeTicks = item.RunTimeTicks; + // Use original runtime here, actual file runtime later in MediaInfo + var runTimeTicks = item.RunTimeTicks; - //if (runTimeTicks.HasValue) - //{ - // var timespan = TimeSpan.FromTicks(runTimeTicks.Value); + if (runTimeTicks.HasValue) + { + var timespan = TimeSpan.FromTicks(runTimeTicks.Value); - // builder.Append("" + Convert.ToInt32(timespan.TotalMinutes).ToString(UsCulture) + ""); - //} + writer.WriteElementString("RunningTime", Convert.ToInt32(timespan.TotalMinutes).ToString(UsCulture)); + } - //if (item.ProviderIds != null) - //{ - // foreach (var providerKey in item.ProviderIds.Keys) - // { - // var providerId = item.ProviderIds[providerKey]; - // if (!string.IsNullOrEmpty(providerId)) - // { - // builder.Append(string.Format("<{0}>{1}", providerKey + "Id", SecurityElement.Escape(providerId))); - // } - // } - //} + if (item.ProviderIds != null) + { + foreach (var providerKey in item.ProviderIds.Keys) + { + var providerId = item.ProviderIds[providerKey]; + if (!string.IsNullOrEmpty(providerId)) + { + writer.WriteElementString(providerKey + "Id", providerId); + } + } + } - //if (!string.IsNullOrWhiteSpace(item.Tagline)) - //{ - // builder.Append(""); - // builder.Append("" + SecurityElement.Escape(item.Tagline) + ""); - // builder.Append(""); - //} + if (!string.IsNullOrWhiteSpace(item.Tagline)) + { + writer.WriteStartElement("Taglines"); + writer.WriteElementString("Tagline", item.Tagline); + writer.WriteEndElement(); + } - //if (item.Genres.Count > 0) - //{ - // builder.Append(""); + if (item.Genres.Count > 0) + { + writer.WriteStartElement("Genres"); - // foreach (var genre in item.Genres) - // { - // builder.Append("" + SecurityElement.Escape(genre) + ""); - // } + foreach (var genre in item.Genres) + { + writer.WriteElementString("Genre", genre); + } - // builder.Append(""); - //} + writer.WriteEndElement(); + } - //if (item.Studios.Count > 0) - //{ - // builder.Append(""); + if (item.Studios.Count > 0) + { + writer.WriteStartElement("Studios"); - // foreach (var studio in item.Studios) - // { - // builder.Append("" + SecurityElement.Escape(studio) + ""); - // } + foreach (var studio in item.Studios) + { + writer.WriteElementString("Studio", studio); + } - // builder.Append(""); - //} + writer.WriteEndElement(); + } if (item.Tags.Count > 0) { @@ -565,29 +565,29 @@ namespace MediaBrowser.LocalMetadata.Savers writer.WriteEndElement(); } - //var people = libraryManager.GetPeople(item); + var people = libraryManager.GetPeople(item); - //if (people.Count > 0) - //{ - // builder.Append(""); + if (people.Count > 0) + { + writer.WriteStartElement("Persons"); - // foreach (var person in people) - // { - // builder.Append(""); - // builder.Append("" + SecurityElement.Escape(person.Name) + ""); - // builder.Append("" + SecurityElement.Escape(person.Type) + ""); - // builder.Append("" + SecurityElement.Escape(person.Role) + ""); + foreach (var person in people) + { + writer.WriteStartElement("Person"); + writer.WriteElementString("Name", person.Name); + writer.WriteElementString("Type", person.Type); + writer.WriteElementString("Role", person.Role); - // if (person.SortOrder.HasValue) - // { - // builder.Append("" + SecurityElement.Escape(person.SortOrder.Value.ToString(UsCulture)) + ""); - // } + if (person.SortOrder.HasValue) + { + writer.WriteElementString("SortOrder", person.SortOrder.Value.ToString(UsCulture)); + } - // builder.Append(""); - // } + writer.WriteEndElement(); + } - // builder.Append(""); - //} + writer.WriteEndElement(); + } var boxset = item as BoxSet; if (boxset != null) From 3952360ce89a3eb512a2a92aa95f837705079c04 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 1 Nov 2016 14:28:36 -0400 Subject: [PATCH 2/4] reduce imported people --- .../Probing/ProbeResultNormalizer.cs | 32 +++++++++---------- .../Movies/GenericMovieDbInfo.cs | 14 ++++++-- .../TV/TheMovieDb/MovieDbEpisodeProvider.cs | 20 ++++++++++-- 3 files changed, 45 insertions(+), 21 deletions(-) diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 96c3bf6a0..8651f2758 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -781,24 +781,24 @@ namespace MediaBrowser.MediaEncoding.Probing } } - var conductor = FFProbeHelpers.GetDictionaryValue(tags, "conductor"); - if (!string.IsNullOrWhiteSpace(conductor)) - { - foreach (var person in Split(conductor, false)) - { - audio.People.Add(new BaseItemPerson { Name = person, Type = PersonType.Conductor }); - } - } + //var conductor = FFProbeHelpers.GetDictionaryValue(tags, "conductor"); + //if (!string.IsNullOrWhiteSpace(conductor)) + //{ + // foreach (var person in Split(conductor, false)) + // { + // audio.People.Add(new BaseItemPerson { Name = person, Type = PersonType.Conductor }); + // } + //} - var lyricist = FFProbeHelpers.GetDictionaryValue(tags, "lyricist"); + //var lyricist = FFProbeHelpers.GetDictionaryValue(tags, "lyricist"); + //if (!string.IsNullOrWhiteSpace(lyricist)) + //{ + // foreach (var person in Split(lyricist, false)) + // { + // audio.People.Add(new BaseItemPerson { Name = person, Type = PersonType.Lyricist }); + // } + //} - if (!string.IsNullOrWhiteSpace(lyricist)) - { - foreach (var person in Split(lyricist, false)) - { - audio.People.Add(new BaseItemPerson { Name = person, Type = PersonType.Lyricist }); - } - } // Check for writer some music is tagged that way as alternative to composer/lyricist var writer = FFProbeHelpers.GetDictionaryValue(tags, "writer"); diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs index 8bff02206..6788bdc9c 100644 --- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs +++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs @@ -26,16 +26,16 @@ namespace MediaBrowser.Providers.Movies private readonly ILogger _logger; private readonly IJsonSerializer _jsonSerializer; private readonly ILibraryManager _libraryManager; - private readonly IFileSystem _fileSystem; + private readonly IFileSystem _fileSystem; private readonly CultureInfo _usCulture = new CultureInfo("en-US"); - public GenericMovieDbInfo(ILogger logger, IJsonSerializer jsonSerializer, ILibraryManager libraryManager, IFileSystem fileSystem) + public GenericMovieDbInfo(ILogger logger, IJsonSerializer jsonSerializer, ILibraryManager libraryManager, IFileSystem fileSystem) { _logger = logger; _jsonSerializer = jsonSerializer; _libraryManager = libraryManager; - _fileSystem = fileSystem; + _fileSystem = fileSystem; } public async Task> GetMetadata(ItemLookupInfo itemId, CancellationToken cancellationToken) @@ -271,6 +271,8 @@ namespace MediaBrowser.Providers.Movies //and the rest from crew if (movieData.casts != null && movieData.casts.crew != null) { + var keepTypes = new[] { PersonType.Director, PersonType.Writer, PersonType.Producer }; + foreach (var person in movieData.casts.crew) { // Normalize this @@ -280,6 +282,12 @@ namespace MediaBrowser.Providers.Movies type = PersonType.Writer; } + if (!keepTypes.Contains(type ?? string.Empty, StringComparer.OrdinalIgnoreCase) && + !keepTypes.Contains(person.job ?? string.Empty, StringComparer.OrdinalIgnoreCase)) + { + continue; + } + var personInfo = new PersonInfo { Name = person.name.Trim(), diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs index 032da1928..fcd753264 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Model.IO; +using System; +using MediaBrowser.Model.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -166,9 +167,24 @@ namespace MediaBrowser.Providers.TV //and the rest from crew if (credits.crew != null) { + var keepTypes = new[] { PersonType.Director, PersonType.Writer, PersonType.Producer }; + foreach (var person in credits.crew) { - result.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = person.department }); + // Normalize this + var type = person.department; + if (string.Equals(type, "writing", StringComparison.OrdinalIgnoreCase)) + { + type = PersonType.Writer; + } + + if (!keepTypes.Contains(type ?? string.Empty, StringComparer.OrdinalIgnoreCase) && + !keepTypes.Contains(person.job ?? string.Empty, StringComparer.OrdinalIgnoreCase)) + { + continue; + } + + result.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = type }); } } } From 445985218f4aa3568eb8b45a512e76e30abba315 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 1 Nov 2016 14:29:18 -0400 Subject: [PATCH 3/4] update components --- .../MediaBrowser.Server.Implementations.csproj | 6 +++--- MediaBrowser.Server.Implementations/packages.config | 2 +- MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj | 6 +++--- MediaBrowser.Server.Mono/packages.config | 2 +- .../MediaBrowser.Server.Startup.Common.csproj | 6 +++--- MediaBrowser.Server.Startup.Common/packages.config | 2 +- .../MediaBrowser.ServerApplication.csproj | 6 +++--- MediaBrowser.ServerApplication/packages.config | 2 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 24fe077c2..dad2998b9 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -64,8 +64,9 @@ ..\ThirdParty\emby\Mono.Nat.dll - - ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + + ..\packages\Patterns.Logging.1.0.0.4\lib\portable-net45+dnxcore50+sl4+wp71+win8+wpa81\Patterns.Logging.dll + True ..\ThirdParty\ServiceStack\ServiceStack.Api.Swagger.dll @@ -89,7 +90,6 @@ - diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.config index 4af018de9..add5b29aa 100644 --- a/MediaBrowser.Server.Implementations/packages.config +++ b/MediaBrowser.Server.Implementations/packages.config @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj index bc968ca56..f3f5176f0 100644 --- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj +++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj @@ -69,9 +69,9 @@ ..\packages\NLog.4.4.0-betaV15\lib\net45\NLog.dll True - - False - ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + + ..\packages\Patterns.Logging.1.0.0.4\lib\portable-net45+dnxcore50+sl4+wp71+win8+wpa81\Patterns.Logging.dll + True diff --git a/MediaBrowser.Server.Mono/packages.config b/MediaBrowser.Server.Mono/packages.config index 06d557648..d67955cb5 100644 --- a/MediaBrowser.Server.Mono/packages.config +++ b/MediaBrowser.Server.Mono/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index 4c627ceff..32d5d5f8e 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -42,9 +42,9 @@ False ..\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll - - False - ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + + ..\packages\Patterns.Logging.1.0.0.4\lib\portable-net45+dnxcore50+sl4+wp71+win8+wpa81\Patterns.Logging.dll + True ..\ThirdParty\emby\RSSDP.dll diff --git a/MediaBrowser.Server.Startup.Common/packages.config b/MediaBrowser.Server.Startup.Common/packages.config index 49eee1536..6ebe8be2d 100644 --- a/MediaBrowser.Server.Startup.Common/packages.config +++ b/MediaBrowser.Server.Startup.Common/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index d8be2411d..f2a53f742 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -75,9 +75,9 @@ ..\packages\NLog.4.4.0-betaV15\lib\net45\NLog.dll True - - False - ..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll + + ..\packages\Patterns.Logging.1.0.0.4\lib\portable-net45+dnxcore50+sl4+wp71+win8+wpa81\Patterns.Logging.dll + True ..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index a8a3442de..ff817d51a 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 111cb0a2a..544a63de9 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.680 + 3.0.681 Emby.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index fec8b7722..dd0af3d3c 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.680 + 3.0.681 Emby.Server.Core Emby Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Emby Server. Copyright © Emby 2013 - + From 8ab5e5aca9f940be2cdff1643f2500f30eb57214 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 1 Nov 2016 14:29:29 -0400 Subject: [PATCH 4/4] update ffmpeg override behavior --- .../Encoder/MediaEncoder.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index d9571f8e5..10fb025e0 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -121,6 +121,11 @@ namespace MediaBrowser.MediaEncoding.Encoder { get { + if (_hasExternalEncoder) + { + return "External"; + } + if (string.IsNullOrWhiteSpace(FFMpegPath)) { return null; @@ -185,6 +190,12 @@ namespace MediaBrowser.MediaEncoding.Encoder { ConfigureEncoderPaths(); + if (_hasExternalEncoder) + { + LogPaths(); + return; + } + // If the path was passed in, save it into config now. var encodingOptions = GetEncodingOptions(); var appPath = encodingOptions.EncoderAppPath; @@ -194,7 +205,7 @@ namespace MediaBrowser.MediaEncoding.Encoder if (!string.IsNullOrWhiteSpace(valueToSave)) { // if using system variable, don't save this. - if (IsSystemInstalledPath(valueToSave)) + if (IsSystemInstalledPath(valueToSave) || _hasExternalEncoder) { valueToSave = null; } @@ -209,6 +220,11 @@ namespace MediaBrowser.MediaEncoding.Encoder public async Task UpdateEncoderPath(string path, string pathType) { + if (_hasExternalEncoder) + { + return; + } + Tuple newPaths; if (string.Equals(pathType, "system", StringComparison.OrdinalIgnoreCase)) @@ -265,6 +281,11 @@ namespace MediaBrowser.MediaEncoding.Encoder private void ConfigureEncoderPaths() { + if (_hasExternalEncoder) + { + return; + } + var appPath = GetEncodingOptions().EncoderAppPath; if (string.IsNullOrWhiteSpace(appPath))