Beispiel #1
0
        public void NewPlaylist()
        {
            Songs.Clear();
            MediaMetadata.Clear();
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter      = "All Media Files|*.wav;*.aac;*.wma;*.wmv;*.avi;*.mpg;*.mpeg;*.m1v;*.mp2;*.mp3;*.mpa;*.mpe;*.m3u;*.mp4;*.mov;*.3g2;*.3gp2;*.3gp;*.3gpp;*.m4a;*.cda;*.aif;*.aifc;*.aiff;*.mid;*.midi;*.rmi;*.mkv;*.WAV;*.AAC;*.WMA;*.WMV;*.AVI;*.MPG;*.MPEG;*.M1V;*.MP2;*.MP3;*.MPA;*.MPE;*.M3U;*.MP4;*.MOV;*.3G2;*.3GP2;*.3GP;*.3GPP;*.M4A;*.CDA;*.AIF;*.AIFC;*.AIFF;*.MID;*.MIDI;*.RMI;*.MKV";
            dlg.Multiselect = true;
            DialogResult dialogResult = dlg.ShowDialog();

            if (dialogResult == System.Windows.Forms.DialogResult.OK)
            {
                foreach (String file in dlg.FileNames)
                {
                    Songs.Add(file);
                    _element = new TagLibMetadata(file);
                    if (_element.MetaDataTL.Tag.Title == null)
                    {
                        _element.MetaDataTL.Tag.Title = "Unknown";
                    }
                    //if (element.MetaDataTL.Tag.Performers.Length < 0)
                    //{
                    //    element.MetaDataTL.Tag.Performers = new string[1] { "Unknown" };
                    //    element.MetaDataTL.Save();
                    //}
                    //element.MetaDataTL.Tag.Performers[0] = "Unknown";
                    MediaMetadata.Add(_element);
                }
                IndexList = new int[Songs.Count];
                for (int i = 0; i < Songs.Count; i++)
                {
                    IndexList[i] = i;
                }
            }
        }
Beispiel #2
0
        public void InitPlaylist(string path)
        {
            var files = Directory.EnumerateFiles(path, "*.*", SearchOption.AllDirectories)
                        .Where(x => x.EndsWith(".mp3") || x.EndsWith(".wav") || x.EndsWith(".WAV") || x.EndsWith(".MKV") || x.EndsWith(".flac") || x.EndsWith(".FLAC"));

            if (files.Count() < 1)
            {
                return;
            }
            foreach (var item in files)
            {
                Songs.Add(item);
                _element = new TagLibMetadata(item);
                if (_element.MetaDataTL.Tag.Title == null)
                {
                    _element.MetaDataTL.Tag.Title = "Unknown";
                }
                //if (element.MetaDataTL.Tag.Performers.Length < 0)
                //{
                //    element.MetaDataTL.Tag.Performers = new string[1] { "Unknown" };
                //    element.MetaDataTL.Save();
                //}
                //element.MetaDataTL.Tag.Performers[0] = "Unknown";
                MediaMetadata.Add(_element);
            }
            IndexList = new int[Songs.Count];
            for (int i = 0; i < Songs.Count; i++)
            {
                IndexList[i] = i;
            }

            //OpenFileDialog dlg = new OpenFileDialog();

            //dlg.Filter = "All Media Files|*.wav;*.aac;*.wma;*.wmv;*.avi;*.mpg;*.mpeg;*.m1v;*.mp2;*.mp3;*.mpa;*.mpe;*.m3u;*.mp4;*.mov;*.3g2;*.3gp2;*.3gp;*.3gpp;*.m4a;*.cda;*.aif;*.aifc;*.aiff;*.mid;*.midi;*.rmi;*.mkv;*.WAV;*.AAC;*.WMA;*.WMV;*.AVI;*.MPG;*.MPEG;*.M1V;*.MP2;*.MP3;*.MPA;*.MPE;*.M3U;*.MP4;*.MOV;*.3G2;*.3GP2;*.3GP;*.3GPP;*.M4A;*.CDA;*.AIF;*.AIFC;*.AIFF;*.MID;*.MIDI;*.RMI;*.MKV";
            //dlg.Multiselect = true;
            //DialogResult dialogResult = dlg.ShowDialog();



            //if (dialogResult == System.Windows.Forms.DialogResult.OK)
            //{
            //    foreach (String file in dlg.FileNames)
            //    {
            //        Playlist.Add(file);
            //    }
            //}
        }