public bool GetDetails(ArtistItem artistItem)
        {
            if (string.IsNullOrEmpty(artistItem.Name))
            {
                return(false);
            }
            string strArtistHTML;
            string strAlbumHTML;
            string strArtistURL;
            string artist = artistItem.Name;

            if (GetArtistHTML(artist, out strArtistHTML, out strArtistURL))
            {
                var artistInfo = new MusicArtistInfo();
                if (artistInfo.Parse(strArtistHTML))
                {
                    artistInfo.Artist = artist;

                    artistItem.Bio = artistInfo.AMGBiography;
                    if (!string.IsNullOrEmpty(artistInfo.ImageURL))
                    {
                        artistItem.Img_url = artistInfo.ImageURL;
                    }
                    //setMusicVideoArtist(ref mv1, artistInfo, strArtistHTML);
                    //GetArtistArt((DBArtistInfo)mv);
                    return(true);
                }
            }
            return(false);
        }
示例#2
0
        /// <summary>
        /// Get the details of the track
        /// </summary>
        /// <param name="trackObject"></param>
        private void GetDVDDetails(DBTrackInfo trackObject)
        {
            string strArtistHTML;
            string strAlbumHTML;
            string strArtistURL;
            bool   songFound = false;

            List <DBTrackInfo> results = new List <DBTrackInfo>();

            string artist = trackObject.ArtistInfo[0].Artist;

            if (GetArtistHTML(artist, out strArtistHTML, out strArtistURL))
            {
                var artistInfo = new MusicArtistInfo();
                if (artistInfo.Parse(strArtistHTML))
                {
                    artistInfo.Artist = artist;
                    if (GetDVDURLList(strArtistURL))
                    {
                        // we have some albums - now check the tracks in each album
                        foreach (string albumURL in _albumUrlList)
                        {
                            if (GetPageHTMLOnly(albumURL, out strAlbumHTML))
                            {
                                var albumInfo = new MusicAlbumInfo();
                                if (albumInfo.Parse(strAlbumHTML))
                                {
                                    string[] tracksOnAlbum = albumInfo.Tracks.Split('|');
                                    foreach (string track in tracksOnAlbum)
                                    {
                                        if (!string.IsNullOrEmpty(track.Trim()))
                                        {
                                            string[] trackData = track.Split('@');
                                            if (trackObject.Track == trackData[1])
                                            {
                                                songFound = getTrackComposers(trackObject, strAlbumHTML, trackData[3]);
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// Get the details of the track
        /// </summary>
        /// <param name="trackObject"></param>
        private void GetTrackDetails(DBTrackInfo trackObject)
        {
            string    strArtistHTML;
            string    strAlbumHTML;
            string    strArtistURL;
            bool      songFound = false;
            const int trackName = 1;
            const int trackURL  = 3;

            List <DBTrackInfo> results = new List <DBTrackInfo>();

            string strAlbumArtist = trackObject.ArtistInfo[0].Artist;

            if (GetArtistHTML(strAlbumArtist, out strArtistHTML, out strArtistURL))
            {
                var artistInfo = new MusicArtistInfo();
                if (artistInfo.Parse(strArtistHTML))
                {
                    artistInfo.Artist = strAlbumArtist;
                    if (GetAlbumURLList(strArtistURL))
                    {
                        // we have some albums - now check the tracks in each album
                        foreach (string albumURL in _albumUrlList)
                        {
                            // If we found the song then exit...
                            if (songFound)
                            {
                                break;
                            }

                            if (GetPageHTMLOnly(albumURL, out strAlbumHTML))
                            {
                                string strAlbum = Regex.Match(albumURL, "[^/]+-", RegexOptions.Singleline | RegexOptions.IgnoreCase).Value;
                                strAlbum = Regex.Replace(strAlbum, "[-?*]", " ", RegexOptions.Singleline | RegexOptions.IgnoreCase);

                                var albumInfo = AMGHTMLParser.ParseAlbumHTML(strAlbumHTML, strAlbum.Trim(), strAlbumArtist);

                                if (albumInfo != null)
                                {
                                    string[] tracksOnAlbum = albumInfo.Tracks.Split('|');
                                    foreach (string track in tracksOnAlbum)
                                    {
                                        if (!string.IsNullOrEmpty(track.Trim()))
                                        {
                                            string[] trackData = track.Split('@');

                                            if (string.Equals(trackObject.Track, trackData[trackName], StringComparison.CurrentCultureIgnoreCase))
                                            {
                                                Logger.Debug("Get Composers for Track {0} by {1}", trackObject.Track, strAlbumArtist);
                                                songFound = getTrackComposers(trackObject, strAlbumHTML, trackData[trackURL]);
                                                Logger.Debug("Composers for Track {0} by {1} are {2}", trackObject.Track, strAlbumArtist, trackObject.Composers);
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }