From 7cd1416d276cfede3de315cde434b5d78936e011 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 28 Oct 2017 00:19:38 -0400 Subject: [PATCH 1/3] fix music artists not showing in collections --- .../Channels/RefreshChannelsScheduledTask.cs | 27 +++++++++++-------- .../LiveTv/Listings/SchedulesDirect.cs | 16 +++++++++++ MediaBrowser.Controller/Entities/Folder.cs | 2 +- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs index 4a3301252..020818361 100644 --- a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs +++ b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs @@ -9,7 +9,7 @@ using MediaBrowser.Model.Tasks; namespace Emby.Server.Implementations.Channels { - class RefreshChannelsScheduledTask : IScheduledTask + class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask { private readonly IChannelManager _channelManager; private readonly IUserManager _userManager; @@ -39,6 +39,21 @@ namespace Emby.Server.Implementations.Channels get { return "Internet Channels"; } } + public bool IsHidden + { + get { return ((ChannelManager)_channelManager).Channels.Length == 0; } + } + + public bool IsEnabled + { + get { return true; } + } + + public bool IsLogged + { + get { return true; } + } + public async Task Execute(System.Threading.CancellationToken cancellationToken, IProgress progress) { var manager = (ChannelManager)_channelManager; @@ -65,15 +80,5 @@ namespace Emby.Server.Implementations.Channels { get { return "RefreshInternetChannels"; } } - - public bool IsHidden - { - get { return false; } - } - - public bool IsEnabled - { - get { return true; } - } } } diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index b3c7ecc9f..e210e2224 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -653,6 +653,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings // Schedules direct requires that the client support compression and will return a 400 response without it options.EnableHttpCompression = true; + // On windows 7 under .net core, this header is not getting added +#if NETSTANDARD2_0 + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + { + options.RequestHeaders["Accept-Encoding"] = "deflate"; + } +#endif + try { return await _httpClient.Post(options).ConfigureAwait(false); @@ -684,6 +692,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings // Schedules direct requires that the client support compression and will return a 400 response without it options.EnableHttpCompression = true; + // On windows 7 under .net core, this header is not getting added +#if NETSTANDARD2_0 + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + { + options.RequestHeaders["Accept-Encoding"] = "deflate"; + } +#endif + try { return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false); diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index ce7145a79..12183aec2 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1266,7 +1266,7 @@ namespace MediaBrowser.Controller.Entities var childOwner = child.IsOwnedItem ? (child.GetOwner() ?? child) : child; - if (childOwner != null) + if (childOwner != null && !(child is IItemByName)) { var childLocationType = childOwner.LocationType; if (childLocationType == LocationType.Remote || childLocationType == LocationType.Virtual) From 5106819a4b9bdcc12535f47cbdc447970140f479 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 28 Oct 2017 00:20:18 -0400 Subject: [PATCH 2/3] show album artist in album identify wizard --- .../Providers/RemoteSearchResult.cs | 2 + .../Music/MusicBrainzAlbumProvider.cs | 163 ++++++++++++++++++ 2 files changed, 165 insertions(+) diff --git a/MediaBrowser.Model/Providers/RemoteSearchResult.cs b/MediaBrowser.Model/Providers/RemoteSearchResult.cs index 72b6632e4..fdff7ba46 100644 --- a/MediaBrowser.Model/Providers/RemoteSearchResult.cs +++ b/MediaBrowser.Model/Providers/RemoteSearchResult.cs @@ -34,6 +34,8 @@ namespace MediaBrowser.Model.Providers public string GameSystem { get; set; } public string Overview { get; set; } + public RemoteSearchResult AlbumArtist { get; set; } + public RemoteSearchResult() { ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); diff --git a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs index b54d14935..3befca428 100644 --- a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs @@ -117,6 +117,17 @@ namespace MediaBrowser.Providers.Music ProductionYear = i.Year }; + if (i.Artists.Count > 0) + { + result.AlbumArtist = new RemoteSearchResult + { + SearchProviderName = Name, + Name = i.Artists[0].Item1 + }; + + result.AlbumArtist.SetProviderId(MetadataProviders.MusicBrainzArtist, i.Artists[0].Item2); + } + if (!string.IsNullOrWhiteSpace(i.ReleaseId)) { result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseId); @@ -285,6 +296,8 @@ namespace MediaBrowser.Providers.Music public string Overview; public int? Year; + public List> Artists = new List>(); + public static List Parse(XmlReader reader) { reader.MoveToContent(); @@ -417,6 +430,32 @@ namespace MediaBrowser.Providers.Music { result.ReleaseGroupId = reader.GetAttribute("id"); reader.Skip(); + break; + } + case "artist-credit": + { + // TODO + + /* + * + + +SARCASTIC+ZOOKEEPER +SARCASTIC+ZOOKEEPER + + + + */ + using (var subReader = reader.ReadSubtree()) + { + var artist = ParseArtistCredit(subReader); + + if (artist != null) + { + result.Artists.Add(artist); + } + } + break; } default: @@ -436,6 +475,130 @@ namespace MediaBrowser.Providers.Music } } + private static Tuple ParseArtistCredit(XmlReader reader) + { + reader.MoveToContent(); + reader.Read(); + + // http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator + + // Loop through each element + while (!reader.EOF && reader.ReadState == ReadState.Interactive) + { + if (reader.NodeType == XmlNodeType.Element) + { + switch (reader.Name) + { + case "name-credit": + { + using (var subReader = reader.ReadSubtree()) + { + return ParseArtistNameCredit(subReader); + } + } + default: + { + reader.Skip(); + break; + } + } + } + else + { + reader.Read(); + } + } + + return null; + } + + private static Tuple ParseArtistNameCredit(XmlReader reader) + { + reader.MoveToContent(); + reader.Read(); + + string name = null; + + // http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator + + // Loop through each element + while (!reader.EOF && reader.ReadState == ReadState.Interactive) + { + if (reader.NodeType == XmlNodeType.Element) + { + switch (reader.Name) + { + case "artist": + { + var id = reader.GetAttribute("id"); + using (var subReader = reader.ReadSubtree()) + { + return ParseArtistArtistCredit(subReader, id); + } + } + default: + { + reader.Skip(); + break; + } + } + } + else + { + reader.Read(); + } + } + + if (string.IsNullOrWhiteSpace(name)) + { + return null; + } + + return new Tuple(name, null); + } + + private static Tuple ParseArtistArtistCredit(XmlReader reader, string artistId) + { + reader.MoveToContent(); + reader.Read(); + + string name = null; + + // http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator + + // Loop through each element + while (!reader.EOF && reader.ReadState == ReadState.Interactive) + { + if (reader.NodeType == XmlNodeType.Element) + { + switch (reader.Name) + { + case "name": + { + name = reader.ReadElementContentAsString(); + break; + } + default: + { + reader.Skip(); + break; + } + } + } + else + { + reader.Read(); + } + } + + if (string.IsNullOrWhiteSpace(name)) + { + return null; + } + + return new Tuple(name, artistId); + } + private async Task GetReleaseIdFromReleaseGroupId(string releaseGroupId, CancellationToken cancellationToken) { var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId); From 17d33c0fb8aa19e6afab77bd6ecdd66a9c69e050 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 28 Oct 2017 00:20:45 -0400 Subject: [PATCH 3/3] 3.2.34.2 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index b574a6135..1a5c5dde2 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.34.1")] +[assembly: AssemblyVersion("3.2.34.2")]