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; } } }
public Lyrics007(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit/2; timer = new Timer(); artist = LyricUtil.RemoveFeatComment(artist); artist = artist.Replace("#", ""); title = LyricUtil.TrimForParenthesis(title); title = title.Replace("#", ""); // Cannot find lyrics contaning non-English letters! string urlString = "http://www.lyrics007.com/" + artist + " Lyrics/" + title + " Lyrics.html"; timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); LyricsWebClient client = new LyricsWebClient(); client.OpenReadCompleted += new OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(500, true)) { complete = true; } } }
public Lyrics007(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit / 2; timer = new Timer(); artist = LyricUtil.RemoveFeatComment(artist); artist = artist.Replace("#", ""); title = LyricUtil.TrimForParenthesis(title); title = title.Replace("#", ""); // Cannot find lyrics contaning non-English letters! string urlString = "http://www.lyrics007.com/" + artist + " Lyrics/" + title + " Lyrics.html"; timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); LyricsWebClient client = new LyricsWebClient(); client.OpenReadCompleted += new OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(500, true)) { complete = true; } } }
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); } } }
public LyricWiki(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit / 2; timer = new Timer(); artist = LyricUtil.RemoveFeatComment(artist); artist = LyricUtil.CapatalizeString(artist); artist = artist.Replace(" ", "_"); title = LyricUtil.TrimForParenthesis(title); title = LyricUtil.CapatalizeString(title); title = title.Replace(" ", "_"); title = title.Replace("?", "%3F"); if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(title)) { return; } string urlString = "http://lyricwiki.org/" + artist + ":" + title; LyricsWebClient client = new LyricsWebClient(); timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); client.OpenReadCompleted += new OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(300); } } }
public Actionext(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit; timer = new Timer(); artist = LyricUtil.RemoveFeatComment(artist); artist = artist.Replace(" ", "_"); title = LyricUtil.TrimForParenthesis(title); title = title.Replace(" ", "_"); if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(title)) { return; } string urlString = "http://www.actionext.com/names_" + artist[0] + "/" + artist + "_lyrics/" + title + ".html"; urlString = urlString.ToLower(); LyricsWebClient client = new LyricsWebClient(); timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); client.OpenReadCompleted += new OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(300); } } }
public LyricWiki(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit/2; timer = new Timer(); artist = LyricUtil.RemoveFeatComment(artist); artist = LyricUtil.CapatalizeString(artist); artist = artist.Replace(" ", "_"); title = LyricUtil.TrimForParenthesis(title); title = LyricUtil.CapatalizeString(title); title = title.Replace(" ", "_"); title = title.Replace("?", "%3F"); if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(title)) { return; } string urlString = "http://lyricwiki.org/" + artist + ":" + title; LyricsWebClient client = new LyricsWebClient(); timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); client.OpenReadCompleted += new OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(300); } } }
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); } } }
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); } } }
public LyrDB(string artist, string title, ManualResetEvent eventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit; timer = new Timer(); m_EventStop_SiteSearches = eventStop_SiteSearches; artist = LyricUtil.RemoveFeatComment(artist); title = LyricUtil.TrimForParenthesis(title); //string urlString = string.Format("http://www.lyrdb.com/lookup.php?q={0}|{1}&for=match", artist, title); string urlString = string.Format("http://webservices.lyrdb.com/lookup.php?q={0}%7c{1}&for=match", artist, title); LyricsWebClient client = new LyricsWebClient(); timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); client.OpenReadCompleted += new OpenReadCompletedEventHandler(CallbackMethodSearch); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(300); } } }
protected override void FindLyricsWithTimer() { var artist = LyricUtil.RemoveFeatComment(Artist); var title = LyricUtil.TrimForParenthesis(Title); var urlString = string.Format(SiteBaseUrl + "/lookup.php?q={0}%7c{1}&for=match&agant={2}", artist, title, Agent); var client = new LyricsWebClient(); var uri = new Uri(urlString); client.OpenReadCompleted += CallbackMethodSearch; client.OpenReadAsync(uri); while (Complete == false) { if (MEventStopSiteSearches.WaitOne(1, true)) { Complete = true; } else { Thread.Sleep(300); } } }
private void CallbackMethodSearch(object sender, OpenReadCompletedEventArgs e) { Stream reply = null; StreamReader reader = null; try { reply = e.Result; reader = new StreamReader(reply, Encoding.Default); var result = reader.ReadToEnd(); if (result.Equals("")) { LyricText = NotFound; return; } var id = result.Substring(0, result.IndexOf(@"\", StringComparison.Ordinal)); var urlString = string.Format(BaseUrl + "/getlyr.php?q={0}", id); var client2 = new LyricsWebClient(); var uri = new Uri(urlString); client2.OpenReadCompleted += CallbackMethodGetLyric; client2.OpenReadAsync(uri); while (Complete == false) { if (MEventStopSiteSearches.WaitOne(1, true)) { Complete = true; } else { Thread.Sleep(300); } } } catch { LyricText = NotFound; } finally { if (reader != null) { reader.Close(); } if (reply != null) { reply.Close(); } } }
public HotLyrics(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit / 2; timer = new Timer(); artist = LyricUtil.RemoveFeatComment(artist); artist = LyricUtil.CapatalizeString(artist); artist = artist.Replace(" ", "_"); artist = artist.Replace(",", "_"); artist = artist.Replace(".", "_"); artist = artist.Replace("'", "_"); artist = artist.Replace("(", "%28"); artist = artist.Replace(")", "%29"); artist = artist.Replace(",", ""); artist = artist.Replace("#", ""); artist = artist.Replace("%", ""); artist = artist.Replace("+", "%2B"); artist = artist.Replace("=", "%3D"); artist = artist.Replace("-", "_"); // French letters artist = artist.Replace("é", "%E9"); title = LyricUtil.TrimForParenthesis(title); title = LyricUtil.CapatalizeString(title); title = title.Replace(" ", "_"); title = title.Replace(",", "_"); title = title.Replace(".", "_"); title = title.Replace("'", "_"); title = title.Replace("(", "%28"); title = title.Replace(")", "%29"); title = title.Replace(",", "_"); title = title.Replace("#", "_"); title = title.Replace("%", "_"); title = title.Replace("?", "_"); title = title.Replace("+", "%2B"); title = title.Replace("=", "%3D"); title = title.Replace("-", "_"); title = title.Replace(":", "_"); // German letters artist = artist.Replace("ü", "%FC"); artist = artist.Replace("Ü", "%DC"); artist = artist.Replace("ä", "%E4"); artist = artist.Replace("Ä", "%C4"); artist = artist.Replace("ö", "%F6"); artist = artist.Replace("Ö", "%D6"); artist = artist.Replace("ß", "%DF"); // Danish letters title = title.Replace("å", "%E5"); title = title.Replace("Å", "%C5"); title = title.Replace("æ", "%E6"); title = title.Replace("ø", "%F8"); // French letters title = title.Replace("é", "%E9"); if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(title)) { return; } string firstLetter = artist[0].ToString(); string urlString = "http://www.hotlyrics.net/lyrics/" + firstLetter + "/" + artist + "/" + title + ".html"; LyricsWebClient client = new LyricsWebClient(); timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); client.OpenReadCompleted += new OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(300); } } }
public LyricsOnDemand(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit; timer = new Timer(); 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 contaning non-English letters! 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(); if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(title)) { return; } string firstLetter = artist[0].ToString(); int firstNumber = 0; if (int.TryParse(firstLetter, out firstNumber)) { firstLetter = "0"; } string urlString = "http://www.lyricsondemand.com/" + firstLetter + "/" + artist + "lyrics/" + title + "lyrics.html"; LyricsWebClient client = new LyricsWebClient(); timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); client.OpenReadCompleted += new OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(100); } } }
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 contaning 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); } } }
protected override void FindLyricsWithTimer() { var artist = LyricUtil.RemoveFeatComment(Artist); artist = LyricUtil.CapatalizeString(artist); artist = artist.Replace(" ", "_"); artist = artist.Replace(",", "_"); artist = artist.Replace(".", "_"); artist = artist.Replace("'", "_"); artist = artist.Replace("(", "%28"); artist = artist.Replace(")", "%29"); artist = artist.Replace(",", ""); artist = artist.Replace("#", ""); artist = artist.Replace("%", ""); artist = artist.Replace("+", "%2B"); artist = artist.Replace("=", "%3D"); artist = artist.Replace("-", "_"); // French letters artist = artist.Replace("é", "%E9"); var title = LyricUtil.TrimForParenthesis(Title); title = LyricUtil.CapatalizeString(title); title = title.Replace(" ", "_"); title = title.Replace(",", "_"); title = title.Replace(".", "_"); title = title.Replace("'", "_"); title = title.Replace("(", "%28"); title = title.Replace(")", "%29"); title = title.Replace(",", "_"); title = title.Replace("#", "_"); title = title.Replace("%", "_"); title = title.Replace("?", "_"); title = title.Replace("+", "%2B"); title = title.Replace("=", "%3D"); title = title.Replace("-", "_"); title = title.Replace(":", "_"); // German letters artist = artist.Replace("ü", "%FC"); artist = artist.Replace("Ü", "%DC"); artist = artist.Replace("ä", "%E4"); artist = artist.Replace("Ä", "%C4"); artist = artist.Replace("ö", "%F6"); artist = artist.Replace("Ö", "%D6"); artist = artist.Replace("ß", "%DF"); // Danish letters title = title.Replace("å", "%E5"); title = title.Replace("Å", "%C5"); title = title.Replace("æ", "%E6"); title = title.Replace("ø", "%F8"); // French letters title = title.Replace("é", "%E9"); // 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); } } }
private void CallbackMethodSearch(object sender, OpenReadCompletedEventArgs e) { StringBuilder lyricTemp = new StringBuilder(); LyricsWebClient client = (LyricsWebClient)sender; Stream reply = null; StreamReader sr = null; string id = string.Empty; try { reply = (Stream)e.Result; sr = new StreamReader(reply, Encoding.Default); string result = sr.ReadToEnd(); if (result.Equals("")) { lyric = "Not found"; return; } id = result.Substring(0, result.IndexOf(@"\")); string urlString = string.Format("http://www.lyrdb.com/getlyr.php?q={0}", id); LyricsWebClient client2 = new LyricsWebClient(); Uri uri = new Uri(urlString); client2.OpenReadCompleted += new OpenReadCompletedEventHandler(CallbackMethodGetLyric); client2.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(300); } } } catch { lyric = "Not found"; } finally { if (sr != null) { sr.Close(); } if (reply != null) { reply.Close(); } } }
protected override void FindLyricsWithTimer() { var fixHebrewArtist = FixHebrewName(Artist); var fixedHebrewTitle = FixHebrewName(Title); // Check there's at least one Hebrew letter in either artist or title. We skip test if not if (!IsHebrew(fixHebrewArtist) && !IsHebrew(fixedHebrewTitle)) { LyricText = NotFound; return; } // 1st step - find lyrics page var firstUrlString = BaseUrl + SearchPathQuery + fixHebrewArtist + Space + fixedHebrewTitle; 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 (_prfid == null || _wrkid == null) { LyricText = NotFound; return; } // 2nd step - find lyrics var secondUrlString = BaseUrl + LyricsPath + Prfid + _prfid + Wrkid + _wrkid; 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); } } }
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); } } }
public LyricsPluginSite(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit; timer = new Timer(); artist = LyricUtil.RemoveFeatComment(artist); title = LyricUtil.TrimForParenthesis(title); // Escape characters artist = fixEscapeCharacters(artist); title = fixEscapeCharacters(title); // Hebrew letters artist = fixHebrew(artist); title = fixHebrew(title); // timer timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); // LyricsPlugin.com changed their API to need 2 calls. The first is to get a timer & code // 1st step string firstUrlString = "http://www.lyricsplugin.com/winamp03/plugin/?" + "artist=" + artist + "&title=" + title; Uri uri1 = new Uri(firstUrlString); LyricsWebClient client1 = new LyricsWebClient(); client1.OpenReadCompleted += new OpenReadCompletedEventHandler(firstCallbackMethod); client1.OpenReadAsync(uri1); while (firstStepComplete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { firstStepComplete = true; } else { Thread.Sleep(100); } } // assertion: !timestamp.Equals("") & !checkCode.Equals(""); // 2nd step string secondUrlString = "http://www.lyricsplugin.com/winamp03/plugin/content.php?" + "artist=" + artist + "&title=" + title + "&time=" + timestamp + "&check=" + checkCode; Uri uri2 = new Uri(secondUrlString); LyricsWebClient client2 = new LyricsWebClient(firstUrlString); client2.OpenReadCompleted += new OpenReadCompletedEventHandler(secondCallbackMethod); client2.OpenReadAsync(uri2); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(100); } } }
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)) { LyricText = NotFound; return; } var urlString = SiteBaseUrl + "/lyrics/" + title + "-lyrics-" + artist + ".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); } } }
public SeekLyrics(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit; timer = new System.Timers.Timer(); artist = LyricUtil.RemoveFeatComment(artist); artist = artist.Replace(" ", "-"); artist = artist.Replace("'", "-"); artist = artist.Replace("(", ""); artist = artist.Replace(")", ""); artist = artist.Replace(",", ""); artist = artist.Replace("#", ""); // German letters artist = artist.Replace("ü", "%FC"); artist = artist.Replace("Ü", ""); artist = artist.Replace("ä", "%E4"); artist = artist.Replace("Ä", ""); artist = artist.Replace("ö", "%E4"); // Not correct!!! artist = artist.Replace("Ö", ""); artist = artist.Replace("ß", "%DF"); // French letters artist = artist.Replace("é", "%E9"); title = LyricUtil.TrimForParenthesis(title); title = title.Replace(" ", "-"); title = title.Replace("'", "-"); title = title.Replace("(", ""); title = title.Replace(")", ""); title = title.Replace(",", ""); title = title.Replace("#", ""); title = title.Replace("?", ""); // German letters title = title.Replace("ü", "%FC"); title = title.Replace("Ü", "%FC"); title = title.Replace("ä", "%E4"); title = title.Replace("Ä", "%C4"); title = title.Replace("ö", "%F6"); title = title.Replace("Ö", "%D6"); title = title.Replace("ß", "%DF"); // French letters title = title.Replace("é", "%E9"); string urlString = "http://www.seeklyrics.com/lyrics/" + artist + "/" + title + ".html"; timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); LyricsWebClient client = new LyricsWebClient(); client.OpenReadCompleted += new System.Net.OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { System.Threading.Thread.Sleep(100); } } }
public HotLyrics(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit/2; timer = new Timer(); artist = LyricUtil.RemoveFeatComment(artist); artist = LyricUtil.CapatalizeString(artist); artist = artist.Replace(" ", "_"); artist = artist.Replace(",", "_"); artist = artist.Replace(".", "_"); artist = artist.Replace("'", "_"); artist = artist.Replace("(", "%28"); artist = artist.Replace(")", "%29"); artist = artist.Replace(",", ""); artist = artist.Replace("#", ""); artist = artist.Replace("%", ""); artist = artist.Replace("+", "%2B"); artist = artist.Replace("=", "%3D"); artist = artist.Replace("-", "_"); // French letters artist = artist.Replace("é", "%E9"); title = LyricUtil.TrimForParenthesis(title); title = LyricUtil.CapatalizeString(title); title = title.Replace(" ", "_"); title = title.Replace(",", "_"); title = title.Replace(".", "_"); title = title.Replace("'", "_"); title = title.Replace("(", "%28"); title = title.Replace(")", "%29"); title = title.Replace(",", "_"); title = title.Replace("#", "_"); title = title.Replace("%", "_"); title = title.Replace("?", "_"); title = title.Replace("+", "%2B"); title = title.Replace("=", "%3D"); title = title.Replace("-", "_"); title = title.Replace(":", "_"); // German letters artist = artist.Replace("ü", "%FC"); artist = artist.Replace("Ü", "%DC"); artist = artist.Replace("ä", "%E4"); artist = artist.Replace("Ä", "%C4"); artist = artist.Replace("ö", "%F6"); artist = artist.Replace("Ö", "%D6"); artist = artist.Replace("ß", "%DF"); // Danish letters title = title.Replace("å", "%E5"); title = title.Replace("Å", "%C5"); title = title.Replace("æ", "%E6"); title = title.Replace("ø", "%F8"); // French letters title = title.Replace("é", "%E9"); if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(title)) { return; } string firstLetter = artist[0].ToString(); string urlString = "http://www.hotlyrics.net/lyrics/" + firstLetter + "/" + artist + "/" + title + ".html"; LyricsWebClient client = new LyricsWebClient(); timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); client.OpenReadCompleted += new OpenReadCompletedEventHandler(callbackMethod); client.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(300); } } }
private void CallbackMethodSearch(object sender, OpenReadCompletedEventArgs e) { StringBuilder lyricTemp = new StringBuilder(); LyricsWebClient client = (LyricsWebClient) sender; Stream reply = null; StreamReader sr = null; string id = string.Empty; try { reply = (Stream) e.Result; sr = new StreamReader(reply, Encoding.Default); string result = sr.ReadToEnd(); if (result.Equals("")) { lyric = "Not found"; return; } id = result.Substring(0, result.IndexOf(@"\")); string urlString = string.Format("http://www.lyrdb.com/getlyr.php?q={0}", id); LyricsWebClient client2 = new LyricsWebClient(); Uri uri = new Uri(urlString); client2.OpenReadCompleted += new OpenReadCompletedEventHandler(CallbackMethodGetLyric); client2.OpenReadAsync(uri); while (complete == false) { if (m_EventStop_SiteSearches.WaitOne(1, true)) { complete = true; } else { Thread.Sleep(300); } } } catch { lyric = "Not found"; } finally { if (sr != null) { sr.Close(); } if (reply != null) { reply.Close(); } } }
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 + LyricsPath + _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); } } }