Exemple #1
0
        /// <summary>
        /// Write the current state of this song back into WMP
        /// </summary>
        public override void Commit()
        {
            if (this.Media == null)
            {
                return;
            }

            if (this.Media.isReadOnlyItem(Wmp.WMTitle) == false)
            {
                this.Media.setItemInfo(Wmp.WMTitle, this.Title);
            }
            if (this.Media.isReadOnlyItem(Wmp.WMAuthor) == false)
            {
                this.Media.setItemInfo(Wmp.WMAuthor, this.Artist);
            }
            if (this.Media.isReadOnlyItem(Wmp.WMAlbumTitle) == false)
            {
                this.Media.setItemInfo(Wmp.WMAlbumTitle, this.Album);
            }
            if (this.Media.isReadOnlyItem(Wmp.WMGenre) == false)
            {
                this.Media.setItemInfo(Wmp.WMGenre, this.Genre);
            }

            if (this.Media.isReadOnlyItem(Wmp.WMLyrics) == false &&
                this.Media.getItemInfo(Wmp.WMLyrics) != this.Lyrics)
            {
                /*
                 * Life is never easy. We should be able to simply say:
                 * this.Media.setItemInfo(Wmp.WMLyrics, this.Lyrics);
                 * but that doesn't work. On WMP 9 and 10, it doesn't update
                 * the lyrics at all. On WMP 11, it updates them, but creates
                 * hundreds of entries -- one for each language.
                 * So we have to do something more complicated
                 */
                using (MetaDataEditor editor = new MetaDataEditor(this.Media.sourceURL)) {
                    editor.SetFieldValue(Wmp.WMLyrics, this.Lyrics);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Write the current state of this song back into WMP
        /// </summary>
        public override void Commit()
        {
            if (this.Media == null)
                return;

            if (this.Media.isReadOnlyItem(Wmp.WMTitle) == false)
                this.Media.setItemInfo(Wmp.WMTitle, this.Title);
            if (this.Media.isReadOnlyItem(Wmp.WMAuthor) == false)
                this.Media.setItemInfo(Wmp.WMAuthor, this.Artist);
            if (this.Media.isReadOnlyItem(Wmp.WMAlbumTitle) == false)
                this.Media.setItemInfo(Wmp.WMAlbumTitle, this.Album);
            if (this.Media.isReadOnlyItem(Wmp.WMGenre) == false)
                this.Media.setItemInfo(Wmp.WMGenre, this.Genre);

            if (this.Media.isReadOnlyItem(Wmp.WMLyrics) == false &&
                this.Media.getItemInfo(Wmp.WMLyrics) != this.Lyrics) {
                /*
                 * Life is never easy. We should be able to simply say:
                 * this.Media.setItemInfo(Wmp.WMLyrics, this.Lyrics);
                 * but that doesn't work. On WMP 9 and 10, it doesn't update
                 * the lyrics at all. On WMP 11, it updates them, but creates
                 * hundreds of entries -- one for each language.
                 * So we have to do something more complicated
                 */
                using (MetaDataEditor editor = new MetaDataEditor(this.Media.sourceURL)) {
                    editor.SetFieldValue(Wmp.WMLyrics, this.Lyrics);
                }
            }
        }
Exemple #3
0
        static void TestMetaDataEditor2()
        {
            WindowsMediaPlayer wmpPlayer = new WindowsMediaPlayer();
            IWMPPlaylist playlist = wmpPlayer.mediaCollection.getByAttribute("MediaType", "audio");
            IWMPMedia media = playlist.get_Item(100);
            Console.WriteLine(media.name);
            Console.WriteLine(media.getItemInfo("WM/Genre"));
            Console.WriteLine("-");

            using (MetaDataEditor mde = new MetaDataEditor(media.sourceURL)) {
                //mde.SetFieldValue("WM/Lyrics", "MORE LIKE THIS things");
                //mde.SetFieldValue("WM/Genre", "80's rock");
                Console.WriteLine(mde.GetFieldValue("WM/Year"));
                Console.WriteLine(mde.GetFieldValue("WM/Lyrics"));
                Console.WriteLine(mde.GetFieldValue("WM/Genre"));
                Console.WriteLine(mde.GetFieldValue("WM/Publisher"));
                Console.WriteLine(mde.GetFieldValue("unknown"));
            }
        }
Exemple #4
0
 static void TestMetaDataEditor()
 {
     string file = @"C:\Documents and Settings\Admin_2\My Documents\My Music\iTunes\iTunes Music\After the fire\Der Kommissar\01 Der Kommissar.wma";
     using (MetaDataEditor mde = new MetaDataEditor(file)) {
         //mde.SetFieldValue("WM/Lyrics", "These are some more of my favourite things");
         //mde.SetFieldValue("WM/Genre", "80's rock");
         Console.WriteLine(mde.GetFieldValue("WM/Year"));
         Console.WriteLine(mde.GetFieldValue("WM/Lyrics"));
         Console.WriteLine(mde.GetFieldValue("Genre"));
         Console.WriteLine(mde.GetFieldValue("WM/Publisher"));
         Console.WriteLine(mde.GetFieldValue("unknown"));
     }
 }