private void btSave_Click(object sender, EventArgs e) { CurrentDB[DatabaseUtil.CorrectKeyFormat(LyricUtil.CapatalizeString(m_CurrentArtist), LyricUtil.CapatalizeString(m_CurrentTitle))].Lyrics = tbLyrics.Text; DatabaseUtil.SerializeDB(CurrentDB); btSave.Enabled = false; treeView.Focus(); }
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; } } }
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { lbSongsToSearch2.Text = "0"; if (_tags.Count > 0) { var dlgResult = MessageBox.Show( string.Format( "{0} lyric were found in the search.{1}Do you want to import these into your lyrics database?", _tags.Count, Environment.NewLine), "Import tags", MessageBoxButtons.YesNo); if (dlgResult.Equals(DialogResult.Yes)) { foreach (var tag in _tags) { var capArtist = LyricUtil.CapatalizeString(tag.Artist); var capTitle = LyricUtil.CapatalizeString(tag.Title); DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsUtils.LyricsDB, capArtist, capTitle, tag.Lyrics, "music tag"); } DatabaseUtil.SerializeLyricDB(); } } lbInfo.Text = "The search has ended."; lbCurrentArtist.Text = string.Empty; btStart.Enabled = true; btCancel.Enabled = false; btClose.Enabled = true; }
private void btSave_Click(object sender, EventArgs e) { var capArtist = LyricUtil.CapatalizeString(_mCurrentArtist); var capTitle = LyricUtil.CapatalizeString(_mCurrentTitle); var lyrics = LyricUtil.FixLyrics(tbLyrics.Text); CurrentLyricsDatabase[DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)].Lyrics = lyrics; DatabaseUtil.SerializeDB(CurrentLyricsDatabase); if (SettingManager.GetParamAsBool(SettingManager.AutomaticWriteToMusicTag, true)) { TagReaderUtil.WriteLyrics(capArtist, capTitle, lyrics); } if (CurrentLyricsDatabase.Equals(MyLyricsUtils.LyricsMarkedDB)) { if (SettingManager.GetParamAsBool(SettingManager.MoveLyricFromMarkedDatabase, true)) { MoveLyricToOtherDatabase(); } } var lrc = new SimpleLRC(capArtist, capTitle, lyrics); if (lrc.IsValid && _parentMyLyricsSetup.cbUploadLrcAutomatically.Checked) { LrcFinder.SaveLrcWithGuid(lyrics, _parentMyLyricsSetup.MGuid); } btSave.Enabled = false; treeView.Focus(); }
private bool isSelectedLyricALRC() { if (treeView.SelectedNode != null && treeView.SelectedNode.Parent != null) { string artist = treeView.SelectedNode.Parent.Text; string title = treeView.SelectedNode.Text; if (artist.Length != 0 && title.Length != 0) { m_CurrentArtist = artist; m_CurrentTitle = LyricUtil.CapatalizeString(title); string lyricsText = (string)CurrentDB[DatabaseUtil.CorrectKeyFormat(artist, title)].Lyrics; SimpleLRC lrc = new SimpleLRC(artist, title, lyricsText); if (lrc.IsValid) { return(true); } else { return(false); } } } return(false); }
private void LyricNotFoundMethod(String artist, String title, String message, String site, int row) { _mLyricsNotFound += 1; --_mSongsToSearch; lbSongsToSearch2.Text = _mSongsToSearch.ToString(CultureInfo.InvariantCulture); lbLyricsNotFound2.Text = _mLyricsNotFound.ToString(CultureInfo.InvariantCulture); var capArtist = LyricUtil.CapatalizeString(artist); var capTitle = LyricUtil.CapatalizeString(title); if (_mMarkSongsWhenNoLyricFound && DatabaseUtil.IsSongInLyricsMarkedDatabase(MyLyricsUtils.LyricsMarkedDB, capArtist, capTitle).Equals( DatabaseUtil.LyricNotFound)) { MyLyricsUtils.LyricsMarkedDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, "", "")); } _mSongsWithMark += 1; lbSongsWithMark2.Text = _mSongsWithMark.ToString(CultureInfo.InvariantCulture); var logText = "No match found to " + capArtist + " - " + capTitle; lbLastActivity2.Text = logText; BatchLogger.Info("Miss: {0}", logText); progressBar.PerformStep(); Update(); }
private void LyricNotFoundMethod(String artist, String title, String message, String site, int row) { foreach (ListViewItem lvi in lvSelectedSongs.Items) { if (lvi.Text.Equals(artist) && lvi.SubItems[1].Text.Equals(title) && !lvi.SubItems[3].Text.Equals("OK")) { lvi.SubItems[2].Text = "MarkedDB"; lvi.SubItems[3].Text = "miss"; lvi.EnsureVisible(); var capArtist = LyricUtil.CapatalizeString(artist); var capTitle = LyricUtil.CapatalizeString(title); if ( DatabaseUtil.IsSongInLyricsMarkedDatabase(MyLyricsUtils.LyricsMarkedDB, capArtist, capTitle).Equals(DatabaseUtil.LyricNotFound)) { MyLyricsUtils.LyricsMarkedDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, "", "")); } DatabaseUtil.SerializeLyricMarkedDB(); _mNoOfCurrentlySearches -= 1; ++_mNoOfSearchesCompleted; break; } } //lvSelectedSongs.Update(); }
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; } } }
private void UpdateSong() { if (lvSearchResults.SelectedItems.Count > 0) { if (parent.GetType() == typeof(TagEditControl)) { (parent as TagEditControl).LyricsText = LyricUtil.ReturnEnvironmentNewLine(lvSearchResults.SelectedItems[0].SubItems[2].Text); } } }
public void UpdateInfo() { _mCurrentArtist = ""; _mCurrentTitle = ""; tbLyrics.Text = ""; lbTitle.Text = ""; lbLRCTest.Text = ""; tbLyrics.Enabled = false; // Selected a title if (treeView.SelectedNode != null && treeView.SelectedNode.Parent != null) { var artist = treeView.SelectedNode.Parent.Text; var title = treeView.SelectedNode.Text; if (artist.Length != 0 && title.Length != 0) { _mCurrentArtist = LyricUtil.CapatalizeString(artist); _mCurrentTitle = LyricUtil.CapatalizeString(title); if ( DatabaseUtil.IsSongInLyricsDatabase(CurrentLyricsDatabase, _mCurrentArtist, _mCurrentTitle).Equals(DatabaseUtil.LyricFound)) { var item = CurrentLyricsDatabase[DatabaseUtil.CorrectKeyFormat(_mCurrentArtist, _mCurrentTitle)]; var lyricsText = item.Lyrics; lyricsText = LyricUtil.ReturnEnvironmentNewLine(lyricsText); _mOriginalLyric = lyricsText; tbLyrics.Text = _mOriginalLyric; tbLyrics.Enabled = true; lbTitle.Text = "\"" + _mCurrentArtist + " - " + _mCurrentTitle + "\"" + (!item.Source.Equals("") ? " found at " + item.Source : ""); btSearchSingle.Enabled = true; } } } // Selected an artist else if (treeView.SelectedNode != null) { var artist = treeView.SelectedNode.Text; _mCurrentArtist = LyricUtil.CapatalizeString(artist); btSearchSingle.Enabled = false; } else { btSearchSingle.Enabled = false; } }
internal void AddNewSongToDatabase(string artist, string title, string lyrics) { _mCurrentArtist = LyricUtil.CapatalizeString(artist); _mCurrentTitle = LyricUtil.CapatalizeString(title); if (AddSong(_mCurrentArtist, _mCurrentTitle, lyrics, "Manual added")) { HighlightSong(_mCurrentArtist, _mCurrentTitle, false); UpdateLyricDatabaseStats(); } else { MessageBox.Show("The title \"" + artist + " - " + title + "\" is already in the database"); } }
internal static int IsSongInLyricsDatabaseAsLRC(LyricsDatabase lyricDB, string artist, string title) { var capatalizedArtist = LyricUtil.CapatalizeString(artist); var capatalizedTitle = LyricUtil.CapatalizeString(title); var key = CorrectKeyFormat(capatalizedArtist, capatalizedTitle); if (lyricDB.ContainsKey(key)) { var lyricText = lyricDB[key].Lyrics; return(new SimpleLRC(capatalizedArtist, capatalizedTitle, lyricText).IsValid ? LRCFound : LyricFound); } return(LRCNotFound); }
internal static int IsSongInLyricsDatabase(LyricsDatabase lyricDB, string artist, string title) { var capatalizedArtist = LyricUtil.CapatalizeString(artist); var capatalizedTitle = LyricUtil.CapatalizeString(title); var key = CorrectKeyFormat(capatalizedArtist, capatalizedTitle); if (lyricDB.ContainsKey(key)) { var lyricText = lyricDB[key].Lyrics; return(lyricText.Equals(Mark) ? LyricMarked : LyricFound); } return(LyricNotFound); }
private void bw_DoWork(object sender, DoWorkEventArgs e) { var mDB = MusicDatabase.Instance; var counter = 0; for (var i = 0; i < _artists.Count; i++) { if (bw.CancellationPending) { return; } var artist = (string)_artists[i]; bw.ReportProgress(counter, artist); mDB.GetSongsByArtist(artist, ref _songs); foreach (var song in _songs) { var tag = TagReader.ReadTag(song.FileName); if (tag != null && tag.Lyrics != string.Empty) { var capArtist = LyricUtil.CapatalizeString(tag.Artist); var capTitle = LyricUtil.CapatalizeString(tag.Title); if ( DatabaseUtil.IsSongInLyricsDatabase(MyLyricsUtils.LyricsDB, capArtist, capTitle).Equals( DatabaseUtil.LyricFound)) { // If lyric exists in LyricsDb then only import (and overwrite) if it isn't an LRC-file var lyricsText = MyLyricsUtils.LyricsDB[DatabaseUtil.CorrectKeyFormat(capArtist, capTitle)].Lyrics; var lrc = new SimpleLRC(capArtist, capTitle, lyricsText); if (!lrc.IsValid) { _tags.Add(tag); ++counter; } } else { _tags.Add(tag); ++counter; } } } } }
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 void updateInfo() { m_CurrentArtist = ""; m_CurrentTitle = ""; tbLyrics.Text = ""; lbTitle.Text = ""; lbSource.Text = ""; lbLRCTest.Text = ""; tbLyrics.Enabled = false; // Selected a title if (treeView.SelectedNode != null && treeView.SelectedNode.Parent != null) { string artist = treeView.SelectedNode.Parent.Text; string title = treeView.SelectedNode.Text; if (artist.Length != 0 && title.Length != 0) { m_CurrentArtist = LyricUtil.CapatalizeString(artist); m_CurrentTitle = LyricUtil.CapatalizeString(title); if (DatabaseUtil.IsTrackInLyricsDatabase(CurrentDB, m_CurrentArtist, m_CurrentTitle).Equals(DatabaseUtil.LYRIC_FOUND)) { LyricsItem item = CurrentDB[DatabaseUtil.CorrectKeyFormat(m_CurrentArtist, m_CurrentTitle)]; string lyricsText = item.Lyrics; lyricsText = LyricsEngine.LyricUtil.ReturnEnvironmentNewLine(lyricsText); m_OriginalLyric = lyricsText; tbLyrics.Text = m_OriginalLyric; tbLyrics.Enabled = true; lbTitle.Text = "\"" + m_CurrentArtist + " - " + m_CurrentTitle + "\""; lbSource.Text = "(" + item.Source + ")"; } } } // Selected an artist else if (treeView.SelectedNode != null) { string artist = treeView.SelectedNode.Text; m_CurrentArtist = LyricUtil.CapatalizeString(artist); } }
// Returns latests settings from the MediaPortal.xml file. Reload on access to ensure any changes made while the program runs are honored. public static string[] GetStrippedPrefixStringArray() { string strippedPrefixes; using (var xmlreader = SettingManager.MediaPortalSettings) { strippedPrefixes = (xmlreader.GetValueAsString("musicfiles", "artistprefixes", "the,les,die")); } var strippedPrefixesArray = strippedPrefixes.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < strippedPrefixesArray.Length; i++) { var temp = strippedPrefixesArray[i]; strippedPrefixesArray[i] = LyricUtil.CapatalizeString(", " + temp.Trim()); } return(strippedPrefixesArray); }
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); } } }
private void lvSearchResults_SelectedIndexChanged(object sender, EventArgs e) { if (lvSearchResults.SelectedItems.Count > 0) { tbLyrics.Text = LyricUtil.ReturnEnvironmentNewLine(lvSearchResults.SelectedItems[0].SubItems[2].Text); if (tbLyrics.Text.Length != 0) { btUpdate.Enabled = true; } else { btUpdate.Enabled = false; } } else { btUpdate.Enabled = false; } }
public EvilLabs(string artist, string title, ManualResetEvent m_EventStop_SiteSearches, int timeLimit) { this.timeLimit = timeLimit; timer = new System.Timers.Timer(); if (LyricDiagnostics.TraceSource != null) { LyricDiagnostics.TraceSource.TraceEvent(TraceEventType.Information, 0, LyricDiagnostics.ElapsedTimeString() + "EvilLabs(" + artist + ", " + title + ")"); } artist = LyricUtil.RemoveFeatComment(artist); artist = LyricUtil.TrimForParenthesis(artist); artist = artist.Replace(" ", "+"); title = LyricUtil.RemoveFeatComment(title); title = LyricUtil.TrimForParenthesis(title); title = title.Replace(" ", "+"); string urlString = "http://www.evillabs.sk/lyrics/" + artist + "+-+" + title; WebClient client = new WebClient(); timer.Enabled = true; timer.Interval = timeLimit; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); Uri uri = new Uri(urlString); 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); } } }
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); } } }
private int InspectFileNameAndAddToDatabaseIfValidLyrics(string filePath) { var fileInfo = new FileInfo(filePath); if (fileInfo.Extension.Equals(".txt")) { var fileName = fileInfo.Name; var index = fileName.IndexOf("-", StringComparison.Ordinal); var fileStringArtist = fileName.Substring(0, index); var fileStringTitle = fileName.Substring(index + 1); fileStringArtist = fileStringArtist.Trim(); fileStringTitle = fileStringTitle.Trim(); index = fileStringTitle.LastIndexOf('.'); fileStringTitle = fileStringTitle.Substring(0, index); var textReader = new StreamReader(filePath); string line; var lyrics = ""; while ((line = textReader.ReadLine()) != null) { lyrics += line + Environment.NewLine; } lyrics = lyrics.Trim(); textReader.Close(); var capArtist = LyricUtil.CapatalizeString(fileStringArtist); var capTitle = LyricUtil.CapatalizeString(fileStringTitle); return(AddSong(capArtist, capTitle, lyrics, "Text file") ? (int)TypeOfLyrics.Normal : (int)TypeOfLyrics.None); } _lrc = new SimpleLRC(filePath); if (_lrc.IsValid && _lrc.Artist.Length != 0 && _lrc.Title.Length != 0) { return(AddSong(_lrc.Artist, _lrc.Title, _lrc.LyricAsLRC.Trim(), "LRC-file") ? (int)TypeOfLyrics.LRC : (int)TypeOfLyrics.None); } return((int)TypeOfLyrics.None); }
private void treeView_AfterSelect(object sender, TreeViewEventArgs e) { UpdateInfo(); if (treeView.SelectedNode != null && treeView.SelectedNode.Parent != null) { var title = treeView.SelectedNode.Text; _mCurrentArtist = treeView.SelectedNode.Parent.Text; _mCurrentTitle = LyricUtil.CapatalizeString(title); if (IsSelectedLyricLRC(_mCurrentArtist, title)) { lbLRCTest.Text = "(valid LRC)"; } else { lbLRCTest.Text = ""; } } }
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); } } }
/// <summary> /// AddSong adds a lyric to the treeView and not to the lyric database /// </summary> /// <param name="lyricsItem">lyrics item</param> private void AddSong(LyricsItem lyricsItem) { var artist = LyricUtil.CapatalizeString(lyricsItem.Artist); var title = LyricUtil.CapatalizeString(lyricsItem.Title); // add artist, if it doesn't exists if (!treeView.Nodes.ContainsKey(artist)) { treeView.Nodes.Add(artist, artist); ++_mNoOfArtists; } // add title, if it doesn't exists var artistIndex = treeView.Nodes.IndexOfKey(artist); if (artistIndex >= 0 && !treeView.Nodes[artistIndex].Nodes.ContainsKey(title)) { treeView.Nodes[artistIndex].Nodes.Add(title, title); treeView.Nodes[artistIndex].Nodes[treeView.Nodes[artistIndex].Nodes.Count - 1].Tag = lyricsItem; ++_mNoOfTitles; } }
private void LyricFoundMethod(String lyricStrings, String artist, String title, String site, int row) { foreach (ListViewItem lvi in lvSelectedSongs.Items) { if (lvi.Text.Equals(artist) && lvi.SubItems[1].Text.Equals(title)) { if (lvi.SubItems[3].Text.Equals("miss")) { MessageBox.Show("This is an error and should not be able to happen!"); } lvi.ImageIndex = 0; lvi.SubItems[2].Text = "LyricsDB"; lvi.SubItems[3].Text = "OK"; lvi.EnsureVisible(); var capArtist = LyricUtil.CapatalizeString(artist); var capTitle = LyricUtil.CapatalizeString(title); DatabaseUtil.WriteToLyricsDatabase(MyLyricsUtils.LyricsDB, MyLyricsUtils.LyricsMarkedDB, capArtist, capTitle, lyricStrings, site); DatabaseUtil.SerializeLyricDB(); if (!site.Equals("music tag")) { if (SettingManager.GetParamAsBool(SettingManager.AutomaticWriteToMusicTag, true)) { TagReaderUtil.WriteLyrics(capArtist, capTitle, lyricStrings); } } _mNoOfCurrentlySearches -= 1; ++_mNoOfSearchesCompleted; break; } } //lvSelectedSongs.Update(); }
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(""); } }
private void lyricNotFoundMethod(String artist, String title, String message, String site) { m_LyricsNotFound += 1; --m_SongsToSearch; lbSongsToSearch2.Text = m_SongsToSearch.ToString(); lbLyricsNotFound2.Text = m_LyricsNotFound.ToString(); string capArtist = LyricUtil.CapatalizeString(artist); string capTitle = LyricUtil.CapatalizeString(title); if (m_MarkSongsWhenNoLyricFound && DatabaseUtil.IsTrackInLyricsMarkedDatabase(MyLyricsSettings.LyricsMarkedDB, capArtist, capTitle).Equals(DatabaseUtil.LYRIC_NOT_FOUND)) { MyLyricsSettings.LyricsMarkedDB.Add(DatabaseUtil.CorrectKeyFormat(capArtist, capTitle), new LyricsItem(capArtist, capTitle, "", "")); } m_SongsWithMark += 1; lbSongsWithMark2.Text = m_SongsWithMark.ToString(); StreamReader sr = File.OpenText(logFullFileName); log = sr.ReadToEnd(); sr.Close(); string logText = "No match found to " + capArtist + " - " + capTitle + ".\r\n"; log += DateTime.Now.ToString() + " " + logText; lbLastActivity2.Text = logText; System.IO.StreamWriter writerLog = new System.IO.StreamWriter(logFullFileName); writerLog.Write(log); writerLog.Close(); m_noOfCurrentlySearches -= 1; progressBar.PerformStep(); this.Update(); }
private void lyricFoundMethod(String lyricStrings, String artist, String track, String site) { m_LyricText = lyricStrings; m_artist = artist; m_track = track; --m_SongsToSearch; lbSongsToSearch2.Text = m_SongsToSearch.ToString(); m_SongsWithLyric += 1; m_LyricsFound += 1; lbSongsWithLyric2.Text = m_SongsWithLyric.ToString(); lbLyricsFound2.Text = m_LyricsFound.ToString(); string capArtist = LyricUtil.CapatalizeString(m_artist); string capTitle = LyricUtil.CapatalizeString(m_track); DatabaseUtil.WriteToLyricsDatabase(MyLyricsSettings.LyricsDB, MyLyricsSettings.LyricsMarkedDB, capArtist, capTitle, lyricStrings, site); StreamReader sr = File.OpenText(logFullFileName); log = sr.ReadToEnd(); sr.Close(); string logText = capArtist + " - " + capTitle + " has a match at " + site + ".\r\n"; log += DateTime.Now.ToString() + " " + logText; lbLastActivity2.Text = logText; System.IO.StreamWriter writerLog = new System.IO.StreamWriter(logFullFileName); writerLog.Write(log); writerLog.Close(); m_noOfCurrentlySearches -= 1; progressBar.PerformStep(); this.Update(); }
private void LyricFoundMethod(String lyricStrings, String artist, String track, String site, int row) { _mArtist = artist; _mTrack = track; --_mSongsToSearch; lbSongsToSearch2.Text = _mSongsToSearch.ToString(CultureInfo.InvariantCulture); _mSongsWithLyric += 1; _mLyricsFound += 1; IncrementLyricsFoundBySite(site); lbSongsWithLyric2.Text = _mSongsWithLyric.ToString(CultureInfo.InvariantCulture); lbLyricsFound2.Text = _mLyricsFound.ToString(CultureInfo.InvariantCulture); var capArtist = LyricUtil.CapatalizeString(_mArtist); var capTitle = LyricUtil.CapatalizeString(_mTrack); DatabaseUtil.WriteToLyricsDatabase(MyLyricsUtils.LyricsDB, MyLyricsUtils.LyricsMarkedDB, capArtist, capTitle, lyricStrings, site); lbMessage.Text = GetLyricsFoundBySite(); if (!site.Equals("music tag") && _mAutomaticWriteToMusicTag) { TagReaderUtil.WriteLyrics(capArtist, capTitle, lyricStrings); } var logText = capArtist + " - " + capTitle + " has a match at " + site; lbLastActivity2.Text = logText; BatchLogger.Info("HIT!: {0}", logText); progressBar.PerformStep(); Update(); }