Пример #1
0
        public bool GetArtistArt(DBArtistInfo mvArtistObject)
        {
            if (mvArtistObject == null)
            {
                return(false);
            }

            int artistartAdded = 0;
            int count          = 0;
            // grab artistart loading settings
            int maxArtistArts = mvCentralCore.Settings.MaxArtistArts;

            lock (mvArtistObject)
            {
                if (mvArtistObject.ArtUrls != null)
                {
                    foreach (string a2 in mvArtistObject.ArtUrls)
                    {
                        if (mvArtistObject.AlternateArts.Count >= maxArtistArts)
                        {
                            break;
                        }

                        if (mvArtistObject.AddArtFromURL(a2) == ImageLoadResults.SUCCESS)
                        {
                            artistartAdded++;
                        }

                        count++;
                    }
                }
                if (artistartAdded > 0)
                {
                    return(true);
                }
            }

            // if we get here we didn't manage to find a proper backdrop
            // so return false
            return(false);
        }
Пример #2
0
        /// <summary>
        /// Get Artist Artwork
        /// </summary>
        /// <param name="mvArtistObject"></param>
        /// <returns></returns>
        public bool GetArtistArt(DBArtistInfo mvArtistObject)
        {
            XmlNodeList xml;

            // Get the images
            // If we have a MBID for this Artist use this to retrive the image otherwise fall back to keyword search
            if (string.IsNullOrEmpty(mvArtistObject.MdID.Trim()))
            {
                xml = getXML(SearchArtistImage, APIKey, mvArtistObject.Artist);
            }
            else
            {
                xml = getXML(SearchArtistImageMBID, APIKey, mvArtistObject.MdID);
            }

            // If we reveived nothing back, bail out
            if (xml == null)
            {
                return(false);
            }

            XmlNode root = xml.Item(0).ParentNode;
            // Get image nodes
            XmlNodeList images         = root.SelectNodes(@"/search/images/image");
            int         artistartAdded = 0;

            // Loop though each nodce and add it
            foreach (XmlNode imageNode in images)
            {
                XmlNode imageIDNode = imageNode.SelectSingleNode("id");
                if (mvArtistObject.AddArtFromURL(string.Format(DownloadImage, APIKey, imageIDNode.InnerText)) == ImageLoadResults.SUCCESS)
                {
                    artistartAdded++;
                }
            }
            return(artistartAdded > 0);
        }
Пример #3
0
        /// <summary>
        /// Get Artist Artwork
        /// </summary>
        /// <param name="mvArtistObject"></param>
        /// <returns></returns>
        public bool GetArtistArt(DBArtistInfo mvArtistObject)
        {
            if (string.IsNullOrEmpty(mvArtistObject.MdID.Trim()))
            {
                return(false);
            }
            logger.Debug("In Method: GetArtistArt(DBArtistInfo mvArtistObject)");

            // Get the images
            // If we have a MBID for this Artist use this to retrive the image otherwise fall back to keyword search
            var html = getJSON(SearchArtistImage, APIKey, mvArtistObject.MdID.Trim());

            // If we reveived nothing back, bail out
            if (string.IsNullOrEmpty(html))
            {
                return(false);
            }

            int artistartAdded = 0;
            var URLList        = new List <string>();

            URLList = ExtractURL("artistthumb", html);
            if (URLList != null)
            {
                foreach (string _url in URLList)
                {
                    var _fileURL = _url.Substring(checked (_url.IndexOf("|") + 1));
                    if (mvArtistObject.AddArtFromURL(_fileURL) == ImageLoadResults.SUCCESS)
                    {
                        artistartAdded++;
                    }
                }
            }

            return(artistartAdded > 0);
        }