예제 #1
0
        public void ReadTags()
        {
            bool gotLongDesc = false;
            bool gotPurdDate = false;

            Assert.AreEqual("Will Yapp", file.Tag.FirstPerformer);
            Assert.AreEqual("Why I Love Monty Python", file.Tag.Title);
            Assert.AreEqual(2008, file.Tag.Year);

            // Test Apple tags
            Mpeg4.AppleTag tag = (Mpeg4.AppleTag)file.GetTag(TagTypes.Apple, false);
            Assert.IsNotNull(tag);

            foreach (Mpeg4.AppleDataBox adbox in tag.DataBoxes(new ReadOnlyByteVector[] { BOXTYPE_LDES }))
            {
                Assert.AreEqual(LONG_DESC, adbox.Text);
                gotLongDesc = true;
            }

            foreach (Mpeg4.AppleDataBox adbox in tag.DataBoxes(new ReadOnlyByteVector[] { BOXTYPE_PURD }))
            {
                Assert.AreEqual(PURD_DATE, adbox.Text);
                gotPurdDate = true;
            }

            Assert.IsTrue(gotLongDesc);
            Assert.IsTrue(gotPurdDate);
        }
예제 #2
0
        public void WriteStandardTags()
        {
            if (System.IO.File.Exists(tmp_file))
            {
                System.IO.File.Delete(tmp_file);
            }

            System.IO.File.Copy(sample_file, tmp_file);

            File tmp = File.Create(tmp_file);

            Mpeg4.AppleTag tag = (Mpeg4.AppleTag)tmp.GetTag(TagTypes.Apple, false);
            SetTags(tag);
            tmp.Save();

            tmp = File.Create(tmp_file);
            tag = (Mpeg4.AppleTag)tmp.GetTag(TagTypes.Apple, false);
            CheckTags(tag);
        }
예제 #3
0
        private void SetTags(Mpeg4.AppleTag tag)
        {
            tag.Title      = "TEST title";
            tag.Performers = new string[] { "TEST performer 1", "TEST performer 2" };
            tag.Comment    = "TEST comment";
            tag.Copyright  = "TEST copyright";
            tag.Genres     = new string [] { "TEST genre 1", "TEST genre 2" };
            tag.Year       = 1999;

            Mpeg4.AppleTag atag = (Mpeg4.AppleTag)tag;
            Assert.IsNotNull(atag);

            Mpeg4.AppleDataBox newbox1 = new Mpeg4.AppleDataBox(
                ByteVector.FromString("TEST Long Description", StringType.UTF8),
                (int)Mpeg4.AppleDataBox.FlagType.ContainsText);
            Mpeg4.AppleDataBox newbox2 = new Mpeg4.AppleDataBox(
                ByteVector.FromString("TEST TV Show", StringType.UTF8),
                (int)Mpeg4.AppleDataBox.FlagType.ContainsText);
            atag.SetData(BOXTYPE_LDES, new Mpeg4.AppleDataBox[] { newbox1 });
            atag.SetData(BOXTYPE_TVSH, new Mpeg4.AppleDataBox[] { newbox2 });
        }
예제 #4
0
        private void CheckTags(Mpeg4.AppleTag tag)
        {
            Assert.AreEqual("TEST title", tag.Title);
            Assert.AreEqual("TEST performer 1; TEST performer 2", tag.JoinedPerformers);
            Assert.AreEqual("TEST comment", tag.Comment);
            Assert.AreEqual("TEST copyright", tag.Copyright);
            Assert.AreEqual("TEST genre 1; TEST genre 2", tag.JoinedGenres);
            Assert.AreEqual(1999, tag.Year);

            Mpeg4.AppleTag atag = (Mpeg4.AppleTag)tag;
            Assert.IsNotNull(atag);

            foreach (Mpeg4.AppleDataBox adbox in atag.DataBoxes(new ReadOnlyByteVector[] { BOXTYPE_LDES }))
            {
                Assert.AreEqual("TEST Long Description", adbox.Text);
            }

            foreach (Mpeg4.AppleDataBox adbox in atag.DataBoxes(new ReadOnlyByteVector[] { BOXTYPE_TVSH }))
            {
                Assert.AreEqual("TEST TV Show", adbox.Text);
            }
        }