Esempio n. 1
0
        private void IncompleteTagButton_Click(object sender, EventArgs e)
        {
            var         test = ListBoxFiles.Items;
            List <Song> InvalidSongMetaData = new List <Song>();
            Double      totalSongs          = test.Count;
            Double      count = 0;

            foreach (object obj in test)
            {
                Song song = (Song)obj;
                try
                {
                    count++;
                    PercentTag.Text = Math.Floor(100 * count / totalSongs).ToString() + "%";
                    Application.DoEvents();
                    var tfile = TagLib.File.Create(song.Filename);

                    String Title  = tfile.Tag.Title;
                    String Album  = tfile.Tag.Album;
                    String Artist = tfile.Tag.FirstPerformer;
                    if (!(IsValidMetadata(Title) && IsValidMetadata(Album) && IsValidMetadata(Artist)))
                    {
                        song.Display = Title + " " + Album + " " + Artist;
                        InvalidSongMetaData.Add(song);
                    }
                }
                catch (Exception ex)
                {
                    song.Display = ex.Message + " " + song.Filename;
                    InvalidSongMetaData.Add(song);
                }
            }
            ListBoxFiles.BeginUpdate();
            ListBoxFiles.Items.Clear();
            foreach (Song song in InvalidSongMetaData)
            {
                ListBoxFiles.Items.Add(song);
            }
            ListBoxFiles.EndUpdate();
        }
Esempio n. 2
0
        private void ButtonLoadSongs_Click(object sender, EventArgs e)
        {
            String dir = Properties.Settings.Default.MusicDirectory;

            if (!Directory.Exists(dir))
            {
                MessageBox.Show("Invalid Directory: " + dir);
                return;
            }
            List <string> songlist      = new List <string>();
            List <Song>   songs         = new List <Song>();
            List <string> extensionList = Properties.Settings.Default.Extensions.Split(',').ToList <string>();

            AddSongs(extensionList, songlist, dir);

            ConvertToSongName(songs, songlist);
            ListBoxFiles.BeginUpdate();
            ListBoxFiles.Items.Clear();
            foreach (Song song in songs)
            {
                ListBoxFiles.Items.Add(song);
            }
            ListBoxFiles.EndUpdate();
        }