Quellcode durchsuchen

Merge pull request #2986 from MediaBrowser/beta

Beta
Luke vor 7 Jahren
Ursprung
Commit
84c96a9cc4

+ 15 - 35
Emby.Dlna/Didl/DidlBuilder.cs

@@ -860,55 +860,35 @@ namespace Emby.Dlna.Didl
         {
         {
             AddCommonFields(item, itemStubType, context, writer, filter);
             AddCommonFields(item, itemStubType, context, writer, filter);
 
 
-            var audio = item as Audio;
+            var hasArtists = item as IHasArtist;
+            var hasAlbumArtists = item as IHasAlbumArtist;
 
 
-            if (audio != null)
+            if (hasArtists != null)
             {
             {
-                foreach (var artist in audio.Artists)
+                foreach (var artist in hasArtists.Artists)
                 {
                 {
                     AddValue(writer, "upnp", "artist", artist, NS_UPNP);
                     AddValue(writer, "upnp", "artist", artist, NS_UPNP);
-                }
+                    AddValue(writer, "dc", "creator", artist, NS_DC);
 
 
-                if (!string.IsNullOrEmpty(audio.Album))
-                {
-                    AddValue(writer, "upnp", "album", audio.Album, NS_UPNP);
-                }
-
-                foreach (var artist in audio.AlbumArtists)
-                {
-                    AddAlbumArtist(writer, artist);
+                    // If it doesn't support album artists (musicvideo), then tag as both
+                    if (hasAlbumArtists == null)
+                    {
+                        AddAlbumArtist(writer, artist);
+                    }
                 }
                 }
             }
             }
 
 
-            var album = item as MusicAlbum;
-
-            if (album != null)
+            if (hasAlbumArtists != null)
             {
             {
-                foreach (var artist in album.AlbumArtists)
+                foreach (var albumArtist in hasAlbumArtists.AlbumArtists)
                 {
                 {
-                    AddAlbumArtist(writer, artist);
-                    AddValue(writer, "upnp", "artist", artist, NS_UPNP);
-                }
-                foreach (var artist in album.Artists)
-                {
-                    AddValue(writer, "upnp", "artist", artist, NS_UPNP);
+                    AddAlbumArtist(writer, albumArtist);
                 }
                 }
             }
             }
 
 
-            var musicVideo = item as MusicVideo;
-
-            if (musicVideo != null)
+            if (!string.IsNullOrWhiteSpace(item.Album))
             {
             {
-                foreach (var artist in musicVideo.Artists)
-                {
-                    AddValue(writer, "upnp", "artist", artist, NS_UPNP);
-                    AddAlbumArtist(writer, artist);
-                }
-
-                if (!string.IsNullOrEmpty(musicVideo.Album))
-                {
-                    AddValue(writer, "upnp", "album", musicVideo.Album, NS_UPNP);
-                }
+                AddValue(writer, "upnp", "album", item.Album, NS_UPNP);
             }
             }
 
 
             if (item.IndexNumber.HasValue)
             if (item.IndexNumber.HasValue)

+ 16 - 11
Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs

@@ -9,7 +9,7 @@ using MediaBrowser.Model.Tasks;
 
 
 namespace Emby.Server.Implementations.Channels
 namespace Emby.Server.Implementations.Channels
 {
 {
-    class RefreshChannelsScheduledTask : IScheduledTask
+    class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask
     {
     {
         private readonly IChannelManager _channelManager;
         private readonly IChannelManager _channelManager;
         private readonly IUserManager _userManager;
         private readonly IUserManager _userManager;
@@ -39,6 +39,21 @@ namespace Emby.Server.Implementations.Channels
             get { return "Internet 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<double> progress)
         public async Task Execute(System.Threading.CancellationToken cancellationToken, IProgress<double> progress)
         {
         {
             var manager = (ChannelManager)_channelManager;
             var manager = (ChannelManager)_channelManager;
@@ -65,15 +80,5 @@ namespace Emby.Server.Implementations.Channels
         {
         {
             get { return "RefreshInternetChannels"; }
             get { return "RefreshInternetChannels"; }
         }
         }
-
-        public bool IsHidden
-        {
-            get { return false; }
-        }
-
-        public bool IsEnabled
-        {
-            get { return true; }
-        }
     }
     }
 }
 }

+ 0 - 17
Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs

@@ -124,18 +124,6 @@ namespace Emby.Server.Implementations.HttpClientManager
             }
             }
         }
         }
 
 
-        private void AddIpv4Option(HttpWebRequest request, HttpRequestOptions options)
-        {
-            request.ServicePoint.BindIPEndPointDelegate = (servicePount, remoteEndPoint, retryCount) =>
-            {
-                if (remoteEndPoint.AddressFamily == AddressFamily.InterNetwork)
-                {
-                    return new IPEndPoint(IPAddress.Any, 0);
-                }
-                throw new InvalidOperationException("no IPv4 address");
-            };
-        }
-
         private WebRequest GetRequest(HttpRequestOptions options, string method)
         private WebRequest GetRequest(HttpRequestOptions options, string method)
         {
         {
             var url = options.Url;
             var url = options.Url;
@@ -153,11 +141,6 @@ namespace Emby.Server.Implementations.HttpClientManager
 
 
             if (httpWebRequest != null)
             if (httpWebRequest != null)
             {
             {
-                if (options.PreferIpv4)
-                {
-                    AddIpv4Option(httpWebRequest, options);
-                }
-
                 AddRequestHeaders(httpWebRequest, options);
                 AddRequestHeaders(httpWebRequest, options);
 
 
                 if (options.EnableHttpCompression)
                 if (options.EnableHttpCompression)

+ 1 - 1
Emby.Server.Implementations/Library/LibraryManager.cs

@@ -506,7 +506,7 @@ namespace Emby.Server.Implementations.Library
                 throw new ArgumentNullException("type");
                 throw new ArgumentNullException("type");
             }
             }
 
 
-            if (ConfigurationManager.Configuration.EnableLocalizedGuids && key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
+            if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
             {
             {
                 // Try to normalize paths located underneath program-data in an attempt to make them more portable
                 // Try to normalize paths located underneath program-data in an attempt to make them more portable
                 key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)
                 key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)

+ 16 - 0
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
             // Schedules direct requires that the client support compression and will return a 400 response without it
             options.EnableHttpCompression = true;
             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
             try
             {
             {
                 return await _httpClient.Post(options).ConfigureAwait(false);
                 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
             // Schedules direct requires that the client support compression and will return a 400 response without it
             options.EnableHttpCompression = true;
             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
             try
             {
             {
                 return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false);
                 return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false);

+ 37 - 33
Emby.Server.Implementations/Networking/NetworkManager.cs

@@ -103,7 +103,10 @@ namespace Emby.Server.Implementations.Networking
             }
             }
 
 
             return endpoint.StartsWith("localhost", StringComparison.OrdinalIgnoreCase) ||
             return endpoint.StartsWith("localhost", StringComparison.OrdinalIgnoreCase) ||
-                endpoint.StartsWith("127.0.0.1", StringComparison.OrdinalIgnoreCase) ||
+                endpoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) ||
+                endpoint.StartsWith("192.168", StringComparison.OrdinalIgnoreCase) ||
+                endpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase) ||
+                endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) ||
                 IsInPrivateAddressSpaceAndLocalSubnet(endpoint);
                 IsInPrivateAddressSpaceAndLocalSubnet(endpoint);
         }
         }
 
 
@@ -111,46 +114,42 @@ namespace Emby.Server.Implementations.Networking
         {
         {
             var endpointFirstPart = endpoint.Split('.')[0];
             var endpointFirstPart = endpoint.Split('.')[0];
 
 
-            string subnet_Match = "";
-            if (
-                endpoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) ||
-                endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) ||
-                endpoint.StartsWith("192.168", StringComparison.OrdinalIgnoreCase) ||
-                endpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase)
-                )
+            if (endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase))
             {
             {
-                foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
-                    foreach (UnicastIPAddressInformation unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
-                        if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0])
-                        {
-                            int subnet_Test = 0;
-                            foreach (string part in unicastIPAddressInformation.IPv4Mask.ToString().Split('.'))
-                            {
-                                if (part.Equals("0")) break;
-                                subnet_Test++;
-                            }
+                var subnets = GetSubnets(endpointFirstPart);
 
 
-                            subnet_Match = String.Join(".", unicastIPAddressInformation.Address.ToString().Split('.').Take(subnet_Test).ToArray());
-                        }
+                foreach (var subnet_Match in subnets)
+                {
+                    //Logger.Debug("subnet_Match:" + subnet_Match);
+
+                    if (endpoint.StartsWith(subnet_Match + ".", StringComparison.OrdinalIgnoreCase))
+                    {
+                        return true;
+                    }
+                }
             }
             }
 
 
-            return endpoint.StartsWith(subnet_Match + ".", StringComparison.OrdinalIgnoreCase);
+            return false;
         }
         }
 
 
-        private Dictionary<string, string> _subnetLookup = new Dictionary<string, string>(StringComparer.Ordinal);
-        private string GetSubnet(string endpointFirstPart)
+        private Dictionary<string, List<string>> _subnetLookup = new Dictionary<string, List<string>>(StringComparer.Ordinal);
+        private List<string> GetSubnets(string endpointFirstPart)
         {
         {
-            string subnet_Match = "";
+            List<string> subnets;
 
 
             lock (_subnetLookup)
             lock (_subnetLookup)
             {
             {
-                if (_subnetLookup.TryGetValue(endpointFirstPart, out subnet_Match))
+                if (_subnetLookup.TryGetValue(endpointFirstPart, out subnets))
                 {
                 {
-                    return subnet_Match;
+                    return subnets;
                 }
                 }
 
 
+                subnets = new List<string>();
+
                 foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
                 foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
+                {
                     foreach (UnicastIPAddressInformation unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
                     foreach (UnicastIPAddressInformation unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
+                    {
                         if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0])
                         if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0])
                         {
                         {
                             int subnet_Test = 0;
                             int subnet_Test = 0;
@@ -160,16 +159,21 @@ namespace Emby.Server.Implementations.Networking
                                 subnet_Test++;
                                 subnet_Test++;
                             }
                             }
 
 
-                            subnet_Match = String.Join(".", unicastIPAddressInformation.Address.ToString().Split('.').Take(subnet_Test).ToArray());
-                        }
+                            var subnet_Match = String.Join(".", unicastIPAddressInformation.Address.ToString().Split('.').Take(subnet_Test).ToArray());
 
 
-                if (!string.IsNullOrWhiteSpace(subnet_Match))
-                {
-                    _subnetLookup[endpointFirstPart] = subnet_Match;
+                            // TODO: Is this check necessary?
+                            if (adapter.OperationalStatus == OperationalStatus.Up)
+                            {
+                                subnets.Add(subnet_Match);
+                            }
+                        }
+                    }
                 }
                 }
-            }
 
 
-            return subnet_Match;
+                _subnetLookup[endpointFirstPart] = subnets;
+
+                return subnets;
+            }
         }
         }
 
 
         private bool Is172AddressPrivate(string endpoint)
         private bool Is172AddressPrivate(string endpoint)

+ 0 - 1
MediaBrowser.Api/StartupWizardService.cs

@@ -91,7 +91,6 @@ namespace MediaBrowser.Api
         {
         {
             config.EnableCaseSensitiveItemIds = true;
             config.EnableCaseSensitiveItemIds = true;
             config.SkipDeserializationForBasicTypes = true;
             config.SkipDeserializationForBasicTypes = true;
-            config.EnableLocalizedGuids = true;
             config.EnableSimpleArtistDetection = true;
             config.EnableSimpleArtistDetection = true;
             config.EnableNormalizedItemByNameIds = true;
             config.EnableNormalizedItemByNameIds = true;
             config.DisableLiveTvChannelUserDataName = true;
             config.DisableLiveTvChannelUserDataName = true;

+ 0 - 1
MediaBrowser.Common/Net/HttpRequestOptions.cs

@@ -101,7 +101,6 @@ namespace MediaBrowser.Common.Net
         public TimeSpan CacheLength { get; set; }
         public TimeSpan CacheLength { get; set; }
 
 
         public int TimeoutMs { get; set; }
         public int TimeoutMs { get; set; }
-        public bool PreferIpv4 { get; set; }
         public bool EnableDefaultUserAgent { get; set; }
         public bool EnableDefaultUserAgent { get; set; }
 
 
         public bool AppendCharsetToMimeType { get; set; }
         public bool AppendCharsetToMimeType { get; set; }

+ 1 - 1
MediaBrowser.Controller/Entities/Folder.cs

@@ -1266,7 +1266,7 @@ namespace MediaBrowser.Controller.Entities
 
 
                 var childOwner = child.IsOwnedItem ? (child.GetOwner() ?? child) : child;
                 var childOwner = child.IsOwnedItem ? (child.GetOwner() ?? child) : child;
 
 
-                if (childOwner != null)
+                if (childOwner != null && !(child is IItemByName))
                 {
                 {
                     var childLocationType = childOwner.LocationType;
                     var childLocationType = childOwner.LocationType;
                     if (childLocationType == LocationType.Remote || childLocationType == LocationType.Virtual)
                     if (childLocationType == LocationType.Remote || childLocationType == LocationType.Virtual)

+ 0 - 2
MediaBrowser.Model/Configuration/ServerConfiguration.cs

@@ -46,7 +46,6 @@ namespace MediaBrowser.Model.Configuration
         /// </summary>
         /// </summary>
         /// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>
         /// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>
         public bool EnableHttps { get; set; }
         public bool EnableHttps { get; set; }
-        public bool EnableLocalizedGuids { get; set; }
         public bool EnableNormalizedItemByNameIds { get; set; }
         public bool EnableNormalizedItemByNameIds { get; set; }
 
 
         /// <summary>
         /// <summary>
@@ -198,7 +197,6 @@ namespace MediaBrowser.Model.Configuration
             LocalNetworkAddresses = new string[] { };
             LocalNetworkAddresses = new string[] { };
             CodecsUsed = new string[] { };
             CodecsUsed = new string[] { };
             ImageExtractionTimeoutMs = 0;
             ImageExtractionTimeoutMs = 0;
-            EnableLocalizedGuids = true;
             PathSubstitutions = new PathSubstitution[] { };
             PathSubstitutions = new PathSubstitution[] { };
             EnableSimpleArtistDetection = true;
             EnableSimpleArtistDetection = true;
 
 

+ 0 - 9
MediaBrowser.Model/Dlna/StreamBuilder.cs

@@ -1099,15 +1099,6 @@ namespace MediaBrowser.Model.Dlna
             {
             {
                 string audioCodec = audioStream.Codec;
                 string audioCodec = audioStream.Codec;
 
 
-                if (string.IsNullOrEmpty(audioCodec))
-                {
-                    _logger.Info("Profile: {0}, DirectPlay=false. Reason=Unknown audio codec. Path: {1}",
-                        profile.Name ?? "Unknown Profile",
-                        mediaSource.Path ?? "Unknown path");
-
-                    return new Tuple<PlayMethod?, List<TranscodeReason>>(null, new List<TranscodeReason> { TranscodeReason.UnknownAudioStreamInfo });
-                }
-
                 conditions = new List<ProfileCondition>();
                 conditions = new List<ProfileCondition>();
                 bool? isSecondaryAudio = audioStream == null ? null : mediaSource.IsSecondaryAudio(audioStream);
                 bool? isSecondaryAudio = audioStream == null ? null : mediaSource.IsSecondaryAudio(audioStream);
 
 

+ 2 - 0
MediaBrowser.Model/Providers/RemoteSearchResult.cs

@@ -34,6 +34,8 @@ namespace MediaBrowser.Model.Providers
         public string GameSystem { get; set; }
         public string GameSystem { get; set; }
         public string Overview { get; set; }
         public string Overview { get; set; }
 
 
+        public RemoteSearchResult AlbumArtist { get; set; }
+
         public RemoteSearchResult()
         public RemoteSearchResult()
         {
         {
             ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
             ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

+ 2 - 1
MediaBrowser.Providers/Manager/ProviderManager.cs

@@ -948,7 +948,8 @@ namespace MediaBrowser.Providers.Manager
                 }
                 }
                 else
                 else
                 {
                 {
-                    throw new Exception(string.Format("Refresh for item {0} {1} is not in progress", item.GetType().Name, item.Id.ToString("N")));
+                    // TODO: Need to hunt down the conditions for this happening
+                    //throw new Exception(string.Format("Refresh for item {0} {1} is not in progress", item.GetType().Name, item.Id.ToString("N")));
                 }
                 }
             }
             }
         }
         }

+ 163 - 0
MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs

@@ -117,6 +117,17 @@ namespace MediaBrowser.Providers.Music
                             ProductionYear = i.Year
                             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))
                         if (!string.IsNullOrWhiteSpace(i.ReleaseId))
                         {
                         {
                             result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseId);
                             result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseId);
@@ -285,6 +296,8 @@ namespace MediaBrowser.Providers.Music
             public string Overview;
             public string Overview;
             public int? Year;
             public int? Year;
 
 
+            public List<Tuple<string, string>> Artists = new List<Tuple<string, string>>();
+
             public static List<ReleaseResult> Parse(XmlReader reader)
             public static List<ReleaseResult> Parse(XmlReader reader)
             {
             {
                 reader.MoveToContent();
                 reader.MoveToContent();
@@ -417,6 +430,32 @@ namespace MediaBrowser.Providers.Music
                                 {
                                 {
                                     result.ReleaseGroupId = reader.GetAttribute("id");
                                     result.ReleaseGroupId = reader.GetAttribute("id");
                                     reader.Skip();
                                     reader.Skip();
+                                    break;
+                                }
+                            case "artist-credit":
+                                {
+                                    // TODO
+
+                                    /*
+                                     * <artist-credit>
+<name-credit>
+<artist id="e225cda5-882d-4b80-b8a3-b36d7175b1ea">
+<name>SARCASTIC+ZOOKEEPER</name>
+<sort-name>SARCASTIC+ZOOKEEPER</sort-name>
+</artist>
+</name-credit>
+</artist-credit>
+                                     */
+                                    using (var subReader = reader.ReadSubtree())
+                                    {
+                                        var artist = ParseArtistCredit(subReader);
+
+                                        if (artist != null)
+                                        {
+                                            result.Artists.Add(artist);
+                                        }
+                                    }
+
                                     break;
                                     break;
                                 }
                                 }
                             default:
                             default:
@@ -436,6 +475,130 @@ namespace MediaBrowser.Providers.Music
             }
             }
         }
         }
 
 
+        private static Tuple<string, string> 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<string, string> 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<string, string>(name, null);
+        }
+
+        private static Tuple<string, string> 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<string, string>(name, artistId);
+        }
+
         private async Task<string> GetReleaseIdFromReleaseGroupId(string releaseGroupId, CancellationToken cancellationToken)
         private async Task<string> GetReleaseIdFromReleaseGroupId(string releaseGroupId, CancellationToken cancellationToken)
         {
         {
             var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId);
             var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId);