public AddNewLyricSearch ( string artist, string title, string strippedArtistName ) : void | ||
artist | string | |
title | string | |
strippedArtistName | string | |
Résultat | void |
private void fetchLyric(string artist, string title, bool automaticUpdate) { log.Trace(">>>"); lockGUI(); tbLyrics.Text = ""; lvSearchResults.Items.Clear(); counter = 0; sitesToSearch = new List<string>(); if (Options.MainSettings.SearchLyricWiki) sitesToSearch.Add("LyricWiki"); if (Options.MainSettings.SearchHotLyrics) sitesToSearch.Add("HotLyrics"); if (Options.MainSettings.SearchLyrics007) sitesToSearch.Add("Lyrics007"); if (Options.MainSettings.SearchLyricsOnDemand) sitesToSearch.Add("LyricsOnDemand"); if (Options.MainSettings.SearchLyricsPlugin) sitesToSearch.Add("LyricsPluginSite"); // If automaticUpdate is set then return after the first positive search lc = new LyricsController(this, m_EventStopThread, sitesToSearch.ToArray(), true, automaticUpdate, "", ""); ThreadStart job = delegate { lc.Run(); }; m_LyricControllerThread = new Thread(job); m_LyricControllerThread.Name = "lyricSearch Thread"; // looks nice in Output window m_LyricControllerThread.Start(); lc.AddNewLyricSearch(artist, title, GetStrippedPrefixArtist(artist, m_strippedPrefixStrings)); log.Trace("<<<"); }
private void bgWorkerLyrics_DoWork(object sender, DoWorkEventArgs e) { if (lyricsQueue.Count > 0) { // start running the lyricController lc = new LyricsController(this, m_EventStopThread, sitesToSearch.ToArray(), false, false, "", ""); lc.NoOfLyricsToSearch = lyricsQueue.Count; ThreadStart runLyricController = delegate { lc.Run(); }; m_LyricControllerThread = new Thread(runLyricController); m_LyricControllerThread.Start(); lc.StopSearches = false; int row = 0; while (lyricsQueue.Count != 0) { if (lc == null) return; if (lc.NoOfCurrentSearches < m_NoOfCurrentSearchesAllowed && lc.StopSearches == false) { string[] lyricID = (string[])lyricsQueue.Dequeue(); if (Options.MainSettings.SwitchArtist) lyricID[0] = SwitchArtist(lyricID[0]); lc.AddNewLyricSearch(lyricID[0], lyricID[1], GetStrippedPrefixArtist(lyricID[0], m_strippedPrefixStrings), row); row++; } Thread.Sleep(100); } } else { ThreadFinished = new[] {"", "", localisation.ToString("lyricssearch", "NothingToSearch"), ""}; } }