private void btUpdate_Click(object sender, EventArgs e)
        {
            if (lvSearchResults.SelectedItems.Count > 0)
            {
                stopSearch();
                ListViewItem item  = lvSearchResults.Items[0];
                string       site  = lvSearchResults.SelectedItems[0].Text;
                string       lyric = tbLyrics.Text;

                if (markedDatabase && moveLyricFromMarkedDatabase)
                {
                    parent.RemoveSong(originalArtist, originalTitle);
                    string key = DatabaseUtil.CorrectKeyFormat(originalArtist, originalTitle);
                    MyLyricsSettings.LyricsDB[key] = new LyricsItem(originalArtist, originalTitle, lyric, site);
                    DatabaseUtil.SerializeLyricDB();
                    parent.updateInfo();
                }
                else if (markedDatabase)
                {
                    DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsMarkedDB, originalArtist, originalTitle, lyric, site);
                    DatabaseUtil.SerializeDBs();
                    parent.updateInfo();
                    parent.highlightSong(originalArtist, originalTitle, false);
                }
                else
                {
                    DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsDB, originalArtist, originalTitle, lyric, site);
                    DatabaseUtil.SerializeDBs();
                    parent.updateInfo();
                    parent.highlightSong(originalArtist, originalTitle, false);
                }
                this.Close();
            }
        }
Beispiel #2
0
        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 UpdateSong()
        {
            if (lvSearchResults.SelectedItems.Count > 0)
            {
                StopSearch();
                var site  = lvSearchResults.SelectedItems[0].Text;
                var lyric = tbLyrics.Text;

                if (_markedDatabase && _mMoveLyricFromMarkedDatabase)
                {
                    _parent.RemoveSong(_originalArtist, _originalTitle, true);
                    var key = DatabaseUtil.CorrectKeyFormat(_originalArtist, _originalTitle);
                    MyLyricsUtils.LyricsDB[key] = new LyricsItem(_originalArtist, _originalTitle, lyric, site);
                    DatabaseUtil.SerializeLyricDB();
                    _parent.UpdateInfo();
                }
                else if (_markedDatabase)
                {
                    DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsUtils.LyricsMarkedDB, _originalArtist, _originalTitle,
                                                         lyric, site);
                    DatabaseUtil.SerializeDBs();
                    _parent.UpdateInfo();
                    _parent.HighlightSong(_originalArtist, _originalTitle, false);
                }
                else
                {
                    DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsUtils.LyricsDB, _originalArtist, _originalTitle, lyric,
                                                         site);
                    DatabaseUtil.SerializeDBs();
                    _parent.UpdateInfo();
                    _parent.HighlightNextSong(_treeArtistIndex, _treeTitleIndex);
                }

                if (_mAutomaticWriteToMusicTag)
                {
                    TagReaderUtil.WriteLyrics(_originalArtist, _originalTitle, lyric);
                }

                _parent.UpdateLyricDatabaseStats();
            }
        }
Beispiel #4
0
        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();
        }