/// <summary>Migrate the metadata from one file to another.</summary>
        /// <param name="source">The source editor.></param>
        /// <param name="augmentMetadata">Whether to augment the metadata for WMP and MCE.</param>
        /// <returns>The migrated collection.</returns>
        public virtual IDictionary CopyMetadataFromSource(MetadataEditor source, bool augmentMetadata, bool throwComErrors)
        {
            // Get the source metadata
            IDictionary metadata = source.GetAttributes(true);

            //using (StreamWriter sw = File.CreateText(@"C:\temp\metadata.txt"))
            //{
            //    Hashtable ht = (Hashtable)metadata;
            //    foreach (string k in ht.Keys)
            //        sw.WriteLine(k);
            //}


            // Augment the metadata to provide a better experience in both WMP and MCE
            if (augmentMetadata)
            {
                string title    = GetMetadataItemAsString(metadata, MetadataEditor.Title);
                string subTitle = GetMetadataItemAsString(metadata, MetadataEditor.Subtitle);
                if (!title.EndsWith(subTitle))
                {
                    title += (title.Length > 0 && subTitle.Length > 0 ? " - " : String.Empty) + subTitle;
                }
                SetMetadataItemAsString(metadata, MetadataEditor.Title, title);

                CopyMetadataItem(metadata, MetadataEditor.SubtitleDescription, metadata, MetadataEditor.Description);
                CopyMetadataItem(metadata, MetadataEditor.Credits, metadata, MetadataEditor.Author);
                CopyMetadataItem(metadata, MetadataEditor.Title, metadata, MetadataEditor.AlbumTitle);
                CopyMetadataItem(metadata, MetadataEditor.StationName, metadata, MetadataEditor.Composer);
                CopyMetadataItem(metadata, MetadataEditor.ParentalRating, metadata, MetadataEditor.ContentGroupDescription);
                CopyMetadataItem(metadata, MetadataEditor.MediaOriginalBroadcastDateTime, metadata, MetadataEditor.PartOfSet);
                CopyMetadataItem(metadata, MetadataEditor.ParentalRating, metadata, MetadataEditor.Mood);
            }

            // Set the metadata
            SetAttributes(metadata, throwComErrors);
            return(metadata);
        }
示例#2
0
        /// <summary>Migrate the metadata from one file to another.</summary>
        /// <param name="source">The source editor.></param>
        /// <param name="augmentMetadata">Whether to augment the metadata for WMP and MCE.</param>
        /// <returns>The migrated collection.</returns>
        public virtual IDictionary CopyMetadataFromSource(MetadataEditor source, bool augmentMetadata, bool throwComErrors)
        {
            // Get the source metadata
            IDictionary metadata = source.GetAttributes(true);

            //using (StreamWriter sw = File.CreateText(@"C:\temp\metadata.txt"))
            //{
            //    Hashtable ht = (Hashtable)metadata;
            //    foreach (string k in ht.Keys)
            //        sw.WriteLine(k);
            //}


            // Augment the metadata to provide a better experience in both WMP and MCE
            if (augmentMetadata)
            {
                string title = GetMetadataItemAsString(metadata, MetadataEditor.Title);
                string subTitle = GetMetadataItemAsString(metadata, MetadataEditor.Subtitle);
                if (!title.EndsWith(subTitle))
                {
                    title += (title.Length > 0 && subTitle.Length > 0 ? " - " : String.Empty) + subTitle;
                }
                SetMetadataItemAsString(metadata, MetadataEditor.Title, title);

                CopyMetadataItem(metadata, MetadataEditor.SubtitleDescription, metadata, MetadataEditor.Description);
                CopyMetadataItem(metadata, MetadataEditor.Credits, metadata, MetadataEditor.Author);
                CopyMetadataItem(metadata, MetadataEditor.Title, metadata, MetadataEditor.AlbumTitle);
                CopyMetadataItem(metadata, MetadataEditor.StationName, metadata, MetadataEditor.Composer);
                CopyMetadataItem(metadata, MetadataEditor.ParentalRating, metadata, MetadataEditor.ContentGroupDescription);
                CopyMetadataItem(metadata, MetadataEditor.MediaOriginalBroadcastDateTime, metadata, MetadataEditor.PartOfSet);
                CopyMetadataItem(metadata, MetadataEditor.ParentalRating, metadata, MetadataEditor.Mood);
            }

            // Set the metadata
            SetAttributes(metadata, throwComErrors);
            return metadata;
        }
 public virtual IDictionary CopyMetadataFromSource(MetadataEditor source, bool augmentMetadata)
 {
     return(CopyMetadataFromSource(source, augmentMetadata, false));
 }
示例#4
0
 public virtual IDictionary CopyMetadataFromSource(MetadataEditor source, bool augmentMetadata)
 {
     return CopyMetadataFromSource(source, augmentMetadata, false);
 }