Example #1
0
        /// <summary>
        /// Used internally to fill a row of a DataSet with metadata for the given media file.
        /// </summary>
        /// <param name="filename">Windows Media File (.wma file)</param></param>
        /// <param name="row">The TrackRow to be filled with data</param>
        private void RetrieveTrackRow(string filename, ref MediaData.TrackRow row)
        {
            MediaData.TrackDataTable tab = new MediaData.TrackDataTable();

            using (MetadataEditor md = new MetadataEditor(filename))
            {
                row.Title       = md[MediaMetadata.Title] as string;
                row.Author      = md[MediaMetadata.Author] as string;
                row.AlbumTitle  = md[MediaMetadata.AlbumTitle] as string;
                row.AlbumArtist = md[MediaMetadata.AlbumArtist] as string;
                row.Publisher   = md[MediaMetadata.Publisher] as string;
                row.Genre       = md[MediaMetadata.Genre] as string;

                object o = md[MediaMetadata.TrackNumber];
                if (o == null)
                {
                    row.SetTrackNumberNull();
                }
                else
                {
                    row.TrackNumber = (uint)o;
                }

                o = md[MediaMetadata.Duration];
                if (o == null)
                {
                    row.SetDurationNull();
                }
                else
                {
                    row.Duration = new TimeSpan((long)(ulong)o);
                }

                o = md[MediaMetadata.BitRate];
                if (o == null)
                {
                    row.SetBitRateNull();
                }
                else
                {
                    row.BitRate = (uint)o;
                }

                o = md[MediaMetadata.IsProtected];
                if (o == null)
                {
                    row.SetIsProtectedNull();
                }
                else
                {
                    row.IsProtected = (bool)o;
                }

                o = md[MediaMetadata.FileSize];
                if (o == null)
                {
                    row.SetFileSizeNull();
                }
                else
                {
                    row.FileSize = (ulong)o;
                }

                row.FileName = filename;
            }
        }
Example #2
0
 public MetadataEnumerator(MetadataEditor editor)
 {
     ed = editor;
 }