From c0491fb56348c63d78b1f694f574e963f9526a9a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 15 Nov 2016 14:42:43 -0500 Subject: [PATCH] rework genre views --- Emby.Dlna/Main/DlnaEntryPoint.cs | 2 +- .../TV/SeriesPostScanTask.cs | 8 +- MediaBrowser.Providers/Omdb/OmdbProvider.cs | 78 +++++++++---------- .../TV/MissingEpisodeProvider.cs | 2 +- .../Native/RegisterServer.bat | 3 + 5 files changed, 46 insertions(+), 47 deletions(-) diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs index 49bb9a74f2..170b4cee0e 100644 --- a/Emby.Dlna/Main/DlnaEntryPoint.cs +++ b/Emby.Dlna/Main/DlnaEntryPoint.cs @@ -285,7 +285,7 @@ namespace Emby.Dlna.Main { "urn:schemas-upnp-org:service:ContentDirectory:1", "urn:schemas-upnp-org:service:ConnectionManager:1", - "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1" + //"urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1" }; foreach (var subDevice in embeddedDevices) diff --git a/Emby.Server.Implementations/TV/SeriesPostScanTask.cs b/Emby.Server.Implementations/TV/SeriesPostScanTask.cs index 2e04c883fa..3d93561f17 100644 --- a/Emby.Server.Implementations/TV/SeriesPostScanTask.cs +++ b/Emby.Server.Implementations/TV/SeriesPostScanTask.cs @@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.TV var group = new SeriesGroup(); FindAllLinked(series, visited, links, group); - group.Key = group.Select(s => s.GetProviderId(MetadataProviders.Tvdb)).FirstOrDefault(id => !string.IsNullOrEmpty(id)); + group.Key = group.Select(s => s.PresentationUniqueKey).FirstOrDefault(id => !string.IsNullOrEmpty(id)); yield return group; } @@ -105,11 +105,7 @@ namespace Emby.Server.Implementations.TV private static bool ShareProviderId(Series a, Series b) { - return a.ProviderIds.Any(id => - { - string value; - return b.ProviderIds.TryGetValue(id.Key, out value) && id.Value == value; - }); + return string.Equals(a.PresentationUniqueKey, b.PresentationUniqueKey, StringComparison.Ordinal); } public int Order diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs index d838de1395..721e31b07e 100644 --- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs @@ -37,7 +37,7 @@ namespace MediaBrowser.Providers.Omdb } public async Task Fetch(MetadataResult itemResult, string imdbId, string language, string country, CancellationToken cancellationToken) - where T :BaseItem + where T : BaseItem { if (string.IsNullOrWhiteSpace(imdbId)) { @@ -48,25 +48,25 @@ namespace MediaBrowser.Providers.Omdb var result = await GetRootObject(imdbId, cancellationToken); - // Only take the name and rating if the user's language is set to english, since Omdb has no localization - if (string.Equals(language, "en", StringComparison.OrdinalIgnoreCase)) + // Only take the name and rating if the user's language is set to english, since Omdb has no localization + if (string.Equals(language, "en", StringComparison.OrdinalIgnoreCase)) + { + item.Name = result.Title; + + if (string.Equals(country, "us", StringComparison.OrdinalIgnoreCase)) { - item.Name = result.Title; - - if (string.Equals(country, "us", StringComparison.OrdinalIgnoreCase)) - { - item.OfficialRating = result.Rated; - } + item.OfficialRating = result.Rated; } + } - int year; + int year; - if (!string.IsNullOrEmpty(result.Year) && result.Year.Length >= 4 - && int.TryParse(result.Year.Substring(0, 4), NumberStyles.Number, _usCulture, out year) - && year >= 0) - { - item.ProductionYear = year; - } + if (!string.IsNullOrEmpty(result.Year) && result.Year.Length >= 4 + && int.TryParse(result.Year.Substring(0, 4), NumberStyles.Number, _usCulture, out year) + && year >= 0) + { + item.ProductionYear = year; + } // Seeing some bogus RT data on omdb for series, so filter it out here // RT doesn't even have tv series @@ -87,33 +87,33 @@ namespace MediaBrowser.Providers.Omdb int voteCount; - if (!string.IsNullOrEmpty(result.imdbVotes) - && int.TryParse(result.imdbVotes, NumberStyles.Number, _usCulture, out voteCount) - && voteCount >= 0) - { - item.VoteCount = voteCount; - } + if (!string.IsNullOrEmpty(result.imdbVotes) + && int.TryParse(result.imdbVotes, NumberStyles.Number, _usCulture, out voteCount) + && voteCount >= 0) + { + item.VoteCount = voteCount; + } - float imdbRating; + float imdbRating; - if (!string.IsNullOrEmpty(result.imdbRating) - && float.TryParse(result.imdbRating, NumberStyles.Any, _usCulture, out imdbRating) - && imdbRating >= 0) - { - item.CommunityRating = imdbRating; - } + if (!string.IsNullOrEmpty(result.imdbRating) + && float.TryParse(result.imdbRating, NumberStyles.Any, _usCulture, out imdbRating) + && imdbRating >= 0) + { + item.CommunityRating = imdbRating; + } - if (!string.IsNullOrEmpty(result.Website)) - { - item.HomePageUrl = result.Website; - } + if (!string.IsNullOrEmpty(result.Website)) + { + item.HomePageUrl = result.Website; + } - if (!string.IsNullOrWhiteSpace(result.imdbID)) - { - item.SetProviderId(MetadataProviders.Imdb, result.imdbID); - } + if (!string.IsNullOrWhiteSpace(result.imdbID)) + { + item.SetProviderId(MetadataProviders.Imdb, result.imdbID); + } - ParseAdditionalMetadata(itemResult, result); + ParseAdditionalMetadata(itemResult, result); } public async Task FetchEpisodeData(MetadataResult itemResult, int episodeNumber, int seasonNumber, string imdbId, string language, string country, CancellationToken cancellationToken) @@ -135,7 +135,7 @@ namespace MediaBrowser.Providers.Omdb RootObject result = null; - foreach (var episode in seasonResult.Episodes) + foreach (var episode in (seasonResult.Episodes ?? new RootObject[] { })) { if (episode.Episode == episodeNumber) { diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index 3c1bc21183..c93b6c2fd6 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -368,7 +368,7 @@ namespace MediaBrowser.Providers.TV var seasonNumber = i.Season.IndexNumber.Value + i.SeasonOffset; // If there's a physical season with the same number, delete it - if (physicalSeasons.Any(p => p.Season.IndexNumber.HasValue && (p.Season.IndexNumber.Value + p.SeasonOffset) == seasonNumber)) + if (physicalSeasons.Any(p => p.Season.IndexNumber.HasValue && (p.Season.IndexNumber.Value + p.SeasonOffset) == seasonNumber && string.Equals(p.Season.Series.PresentationUniqueKey, i.Season.Series.PresentationUniqueKey, StringComparison.Ordinal))) { return true; } diff --git a/MediaBrowser.ServerApplication/Native/RegisterServer.bat b/MediaBrowser.ServerApplication/Native/RegisterServer.bat index 85baa0d03a..504df21995 100644 --- a/MediaBrowser.ServerApplication/Native/RegisterServer.bat +++ b/MediaBrowser.ServerApplication/Native/RegisterServer.bat @@ -26,6 +26,9 @@ netsh advfirewall firewall delete rule name="Emby Server" netsh advfirewall firewall add rule name="Emby Server" dir=in action=allow protocol=TCP program=%4 enable=yes netsh advfirewall firewall add rule name="Emby Server" dir=in action=allow protocol=UDP program=%4 enable=yes +netsh advfirewall firewall add rule name="mediabrowser.serverapplication.exe" dir=in action=allow protocol=TCP program=%4 enable=yes +netsh advfirewall firewall add rule name="mediabrowser.serverapplication.exe" dir=in action=allow protocol=UDP program=%4 enable=yes + :DONE Exit \ No newline at end of file