예제 #1
0
        protected override void FindLyricsWithTimer()
        {
            var artist = LyricUtil.RemoveFeatComment(Artist);

            artist = artist.Replace("#", "");
            var title = LyricUtil.TrimForParenthesis(Title);

            title = title.Replace("#", "");

            // Cannot find lyrics contaning non-English letters!

            var urlString = SiteBaseUrl + "/" + artist + " Lyrics/" + title + " Lyrics.html";

            var uri    = new Uri(urlString);
            var client = new LyricsWebClient();

            client.OpenReadCompleted += CallbackMethod;
            client.OpenReadAsync(uri);

            while (Complete == false)
            {
                if (MEventStopSiteSearches.WaitOne(500, true))
                {
                    Complete = true;
                }
            }
        }
예제 #2
0
        protected override void FindLyricsWithTimer()
        {
            var artist = FixEscapeCharacters(Artist);

            // 1st step - find lyrics page
            var firstUrlString = BaseUrl + SearchPathQuery + artist;

            var findLyricsPageWebClient = new LyricsWebClient();

            findLyricsPageWebClient.OpenReadCompleted += FirstCallbackMethod;
            findLyricsPageWebClient.OpenReadAsync(new Uri(firstUrlString));

            while (_firstStepComplete == false)
            {
                if (MEventStopSiteSearches.WaitOne(1, true))
                {
                    _firstStepComplete = true;
                }
                else
                {
                    Thread.Sleep(100);
                }
            }

            if (_lyricsIndex == null)
            {
                LyricText = NotFound;
                return;
            }
            // 2nd step - find lyrics
            var secondUrlString = BaseUrl + _lyricsIndex;

            var findLyricsWebClient = new LyricsWebClient(firstUrlString);

            findLyricsWebClient.OpenReadCompleted += SecondCallbackMethod;
            findLyricsWebClient.OpenReadAsync(new Uri(secondUrlString));

            while (Complete == false)
            {
                if (MEventStopSiteSearches.WaitOne(1, true))
                {
                    Complete = true;
                }
                else
                {
                    Thread.Sleep(100);
                }
            }
        }
예제 #3
0
        protected override void FindLyricsWithTimer()
        {
            // Clean artist name
            var artist = LyricUtil.RemoveFeatComment(Artist);

            artist = LyricUtil.CapatalizeString(artist);
            artist = artist.Replace(" ", "_");

            // Clean title name
            var title = LyricUtil.TrimForParenthesis(Title);

            title = LyricUtil.CapatalizeString(title);
            title = title.Replace(" ", "_");
            title = title.Replace("?", "%3F");

            // Validate not empty
            if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(title))
            {
                return;
            }

            var urlString = SiteBaseUrl + "/" + artist + ":" + title;

            var client = new LyricsWebClient();

            var uri = new Uri(urlString);

            client.OpenReadCompleted += CallbackMethod;
            client.OpenReadAsync(uri);

            while (Complete == false)
            {
                if (MEventStopSiteSearches.WaitOne(1, true))
                {
                    Complete = true;
                }
                else
                {
                    Thread.Sleep(300);
                }
            }
        }
예제 #4
0
        protected override void FindLyricsWithTimer()
        {
            var artist = Artist.ToLower();

            artist = ClearName(artist);

            var title = Title.ToLower();

            title = ClearName(title);

            // Validation
            if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(title))
            {
                return;
            }

            var firstLetter = artist[0].ToString(CultureInfo.InvariantCulture);

            var urlString = SiteBaseUrl + "/lyrics/" + firstLetter + "/" + artist + "/" + title + ".html";

            var client = new LyricsWebClient();

            var uri = new Uri(urlString);

            client.OpenReadCompleted += CallbackMethod;
            client.OpenReadAsync(uri);

            while (Complete == false)
            {
                if (MEventStopSiteSearches.WaitOne(1, true))
                {
                    Complete = true;
                }
                else
                {
                    Thread.Sleep(300);
                }
            }
        }
예제 #5
0
        protected override void FindLyricsWithTimer()
        {
            var artist = LyricUtil.RemoveFeatComment(Artist);

            artist = LyricUtil.DeleteSpecificChars(artist);
            artist = artist.Replace(" ", "");
            artist = artist.Replace("The ", "");
            artist = artist.Replace("the ", "");
            artist = artist.Replace("-", "");

            artist = artist.ToLower();

            // Cannot find lyrics containing non-English letters!

            var title = LyricUtil.TrimForParenthesis(Title);

            title  = LyricUtil.DeleteSpecificChars(title);
            title  = title.Replace(" ", "");
            title  = title.Replace("#", "");
            artist = artist.Replace("-", "");

            // Danish letters
            title = title.Replace("æ", "");
            title = title.Replace("ø", "");
            title = title.Replace("å", "");
            title = title.Replace("Æ", "");
            title = title.Replace("Ø", "");
            title = title.Replace("Å", "");
            title = title.Replace("ö", "");
            title = title.Replace("Ö", "");

            title = title.ToLower();

            // Validation
            if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(title))
            {
                return;
            }

            var firstLetter = artist[0].ToString(CultureInfo.InvariantCulture);

            int firstNumber;

            if (int.TryParse(firstLetter, out firstNumber))
            {
                firstLetter = "0";
            }

            var urlString = SiteBaseUrl + "/" + firstLetter + "/" + artist + "lyrics/" + title + "lyrics.html";

            var client = new LyricsWebClient();

            var uri = new Uri(urlString);

            client.OpenReadCompleted += CallbackMethod;
            client.OpenReadAsync(uri);

            while (Complete == false)
            {
                if (MEventStopSiteSearches.WaitOne(1, true))
                {
                    Complete = true;
                }
                else
                {
                    Thread.Sleep(100);
                }
            }
        }