Exemplo n.º 1
0
        public string getLyricAsynch(string artist, string title)
        {
            this.artist = artist;
            this.title  = title;
            try
            {
                // Step 1: search title as it is
                if (Abort == false && searchForWiki(this.artist, this.title))
                {
                    return(makeLyricFit(lyricsResult.lyrics));
                }

                // Step 2: search with parentheses and other disturbance removed
                optimizeString(ref this.artist, ref this.title);
                if (searchForWiki(this.artist, this.title))
                {
                    return(lyricsResult.lyrics);
                }

                // Step 3: search with altered and strings if any
                this.artist = LyricUtil.changeAnd_and_and(this.artist);
                this.title  = LyricUtil.changeAnd_and_and(this.title);
                if (searchForWiki(this.artist, this.title))
                {
                    return(lyricsResult.lyrics);
                }

                // final step: return "Not found" if no lyric found
                return("Not found");
            }
            catch (Exception e)
            {
                //System.Windows.Forms.MessageBox.Show(e.ToString());
                //System.Windows.Forms.MessageBox.Show(lyricsResult.);
                Console.Write(e.Message);
                return("");
            }
        }