Exemplo n.º 1
0
        //private Uri GetJpgToUrl(string name)
        //{
        //    if (name == null)
        //        throw new ArgumentNullException("name");

        //    var escaped = name.RemoveNonAlphaNumerics().Replace(" ", "_");

        //    try
        //    {
        //        return new Uri(string.Format("http://{0}.jpg.to", escaped), UriKind.Absolute);
        //    }
        //    catch (Exception ex)
        //    {
        //        var m = ex.Message;
        //        return Guid.Empty.ToUrn();
        //    }
        //}

        public override void Load()
        {
            if (Location.IsFile)
            {
                file = Gnosis.Tags.TagLib.File.Create(Location.LocalPath);
                id3v1Tag = file.GetTag(TagTypes.Id3v1) as Gnosis.Tags.TagLib.Id3v1.Tag;
                id3v2Tag = file.GetTag(TagTypes.Id3v2) as Gnosis.Tags.TagLib.Id3v2.Tag;

                //if (id3v1Tag == null || id3v1Tag.IsEmpty)
                //    System.Diagnostics.Debug.WriteLine("ID3v1 tag is null or empty");
                //else
                //{
                //    if (id3v1Tag.Album != null || id3v1Tag.AlbumArtists != null
                //        || id3v1Tag.Comment != null || id3v1Tag.Composers != null || id3v1Tag.Conductor != null
                //    || id3v1Tag.Copyright != null || id3v1Tag.Genres != null || id3v1Tag.Grouping != null)
                //        System.Diagnostics.Debug.WriteLine("ID3v1 has non null tags");
                //}

                //if (id3v2Tag == null || id3v1Tag.IsEmpty)
                //    System.Diagnostics.Debug.WriteLine("ID3v2 tag is null or empty");
                //else
                //{
                //    var x = id3v2Tag.Duration;
                //}
            }
        }
Exemplo n.º 2
0
        //private Uri GetJpgToUrl(string name)
        //{
        //    if (name == null)
        //        throw new ArgumentNullException("name");

        //    var escaped = name.RemoveNonAlphaNumerics().Replace(" ", "_");

        //    try
        //    {
        //        return new Uri(string.Format("http://{0}.jpg.to", escaped), UriKind.Absolute);
        //    }
        //    catch (Exception ex)
        //    {
        //        var m = ex.Message;
        //        return Guid.Empty.ToUrn();
        //    }
        //}

        public override void Load()
        {
            if (Location.IsFile)
            {
                file     = Gnosis.Tags.TagLib.File.Create(Location.LocalPath);
                id3v1Tag = file.GetTag(TagTypes.Id3v1) as Gnosis.Tags.TagLib.Id3v1.Tag;
                id3v2Tag = file.GetTag(TagTypes.Id3v2) as Gnosis.Tags.TagLib.Id3v2.Tag;

                //if (id3v1Tag == null || id3v1Tag.IsEmpty)
                //    System.Diagnostics.Debug.WriteLine("ID3v1 tag is null or empty");
                //else
                //{
                //    if (id3v1Tag.Album != null || id3v1Tag.AlbumArtists != null
                //        || id3v1Tag.Comment != null || id3v1Tag.Composers != null || id3v1Tag.Conductor != null
                //    || id3v1Tag.Copyright != null || id3v1Tag.Genres != null || id3v1Tag.Grouping != null)
                //        System.Diagnostics.Debug.WriteLine("ID3v1 has non null tags");
                //}

                //if (id3v2Tag == null || id3v1Tag.IsEmpty)
                //    System.Diagnostics.Debug.WriteLine("ID3v2 tag is null or empty");
                //else
                //{
                //    var x = id3v2Tag.Duration;
                //}
            }
        }
Exemplo n.º 3
0
        public void ReadTag()
        {
            file = Gnosis.Tags.TagLib.File.Create(location2);
            tag  = file.GetTag(TagTypes.Id3v2) as Gnosis.Tags.TagLib.Id3v2.Tag;

            Assert.IsTrue(System.IO.File.Exists(location2));
            Assert.IsNotNull(file);
            Assert.IsNotNull(tag);

            Assert.AreEqual(title, tag.Title);
            Assert.AreEqual(titleSort, tag.TitleSort);
            Assert.AreEqual(grouping, tag.Grouping);
            Assert.AreEqual(subtitle, tag.Subtitle);

            Assert.AreEqual(album, tag.Album);
            Assert.AreEqual(albumSort, tag.AlbumSort);
            Assert.AreEqual(albumSubtitle, tag.AlbumSubtitle);

            Assert.AreEqual(artists, tag.ArtistsList);
            Assert.AreEqual(artistsSort, tag.ArtistsSort);
            Assert.AreEqual(albumArtists, tag.AlbumArtistsList);

            Assert.AreEqual(composers, tag.ComposersList);
            Assert.AreEqual(genres, tag.GenresList);
            Assert.AreEqual(moods, tag.Moods);
            Assert.AreEqual(languages, tag.Languages.Select(code => Language.GetLanguageByCode(code)));
            Assert.AreEqual(conductor, tag.Conductor);

            Assert.AreEqual(recordingDate, tag.RecordingDate);
            Assert.AreEqual(releaseDate, tag.ReleaseDate);

            Assert.AreEqual(originalTitle, tag.OriginalTitle);
            Assert.AreEqual(originalArtists, tag.OriginalArtists);
            Assert.AreEqual(originalReleaseDate, tag.OriginalReleaseDate);

            Assert.AreEqual(trackNumber, tag.Track);
            Assert.AreEqual(trackCount, tag.TrackCount);
            Assert.AreEqual(discNumber, tag.Disc);
            Assert.AreEqual(discCount, tag.DiscCount);

            Assert.AreEqual(duration, tag.Duration);
            Assert.AreEqual(beatsPerMinute, tag.BeatsPerMinute);

            Assert.AreEqual(playCount, tag.PlayCount);
            Assert.AreEqual(playlistDelay, tag.PlaylistDelay);

            Assert.AreEqual(originalFilename, tag.OriginalFilename);
            Assert.AreEqual(encodingDate, tag.EncodingDate);
            Assert.AreEqual(taggingDate, tag.TaggingDate);

            Assert.AreEqual(publisher, tag.Publisher);
            Assert.AreEqual(isrc, tag.InternationalStandardRecordingCode);
        }
Exemplo n.º 4
0
        public void ReadLyrics()
        {
            file = Gnosis.Tags.TagLib.File.Create(location1);
            tag  = file.GetTag(TagTypes.Id3v2) as Gnosis.Tags.TagLib.Id3v2.Tag;
            Assert.IsTrue(System.IO.File.Exists(location1));
            Assert.IsNotNull(file);
            Assert.IsNotNull(tag);

            const string langEnglish = "eng";
            const string descEnglish = "After 6 PM";

            #region English Lyrics
            const string lyricsEnglish =
                @"Don't act so weird
Hard as a rock
If I showed you pieces of skin
That even the sunlight doesn't touch
And so many beauty spots that even I didn't know
I showed you my sheer force
Achilles' heel, my poetry

What will you do, just one more story
What will I do if I don't see you again
Oh, oh

If since the day you're not there
I saw the night fall way before 6 p.m.
If since the day you're not there
I saw the night fall way before 6 p.m.
Way before

Don't leave the boat
When we haven't even set sail yet
Toward some desert island

And later, later we'll see
If you see me unarmed
Because you launch your missiles
If you already know my cardinal points
The most sensitive and subtle ones

What will you do, life will tell
What will I do if I don't see you again
Oh, oh

If since the day you're not there
I saw the night fall way before 6 p.m.
If since the day you're not there
I saw the night fall way before 6 p.m.

Way before 6 p.m.

Way before";
            #endregion

            const string langSpanish = "spa";
            const string descSpanish = "Antes De Las Seis";

            #region Spanish Lyrics
            const string lyricsSpanish =
                @"No actúes tan extraño
Duro como una roca
Si te mostre pedazos de piel
Que la luz del sol aun no toca
Y tantos lunares que ni yo misma conocia
Te mostre mi fuerza bruta
Mi talon de Aquiles, mi poesia

Que haras solo una historia mas
Que hare si no te vuelvo a ver
Oh, oh

Si desde el dia en que no estas
Vi la noche llegar mucho antes de las seis
Si desde el dia en que no estas
Vi la noche llegar mucho antes de las seis
Mucho antes

No dejes el barco
Tanto antes de que zarpemos
Hacia alguna isla desierta

Y despues, despues veremos
Si me ves desarmada
Porque lanzas tus misiles
Si ya conoces mis puntos cardinales
Los mas sensibles y sutiles

Que haras la vida lo dira
Que hare si no te vuelvo a ver
Oh, oh

Si desde el dia en que no estas
Vi la noche llegar mucho antes de las seis
Si desde el dia en que no estas
Vi la noche llegar mucho antes de las seis

Mucho antes de las seis

Mucho antes";
            #endregion

            Assert.AreEqual(2, tag.GetUnsynchronizedLyrics().Count());
            var frameSpanish = tag.GetUnsynchronizedLyrics(descSpanish, langSpanish);
            Assert.IsNotNull(frameSpanish);
            Assert.AreEqual(descSpanish, frameSpanish.Description);
            Assert.AreEqual(langSpanish, frameSpanish.Language);
            Assert.AreEqual(lyricsSpanish, frameSpanish.Text);
            var frameEnglish = tag.GetUnsynchronizedLyrics(descEnglish, langEnglish);
            Assert.IsNotNull(frameEnglish);
            Assert.AreEqual(descEnglish, frameEnglish.Description);
            Assert.AreEqual(langEnglish, frameEnglish.Language);
            Assert.AreEqual(lyricsEnglish, frameEnglish.Text);
        }
Exemplo n.º 5
0
        public void ReadLyrics()
        {
            file = Gnosis.Tags.TagLib.File.Create(location1);
            tag = file.GetTag(TagTypes.Id3v2) as Gnosis.Tags.TagLib.Id3v2.Tag;
            Assert.IsTrue(System.IO.File.Exists(location1));
            Assert.IsNotNull(file);
            Assert.IsNotNull(tag);

            const string langEnglish = "eng";
            const string descEnglish = "After 6 PM";

            #region English Lyrics
            const string lyricsEnglish =
    @"Don't act so weird
Hard as a rock
If I showed you pieces of skin
That even the sunlight doesn't touch
And so many beauty spots that even I didn't know
I showed you my sheer force
Achilles' heel, my poetry

What will you do, just one more story
What will I do if I don't see you again
Oh, oh

If since the day you're not there
I saw the night fall way before 6 p.m.
If since the day you're not there
I saw the night fall way before 6 p.m.
Way before

Don't leave the boat
When we haven't even set sail yet
Toward some desert island

And later, later we'll see
If you see me unarmed
Because you launch your missiles
If you already know my cardinal points
The most sensitive and subtle ones

What will you do, life will tell
What will I do if I don't see you again
Oh, oh

If since the day you're not there
I saw the night fall way before 6 p.m.
If since the day you're not there
I saw the night fall way before 6 p.m.

Way before 6 p.m.

Way before";
            #endregion

            const string langSpanish = "spa";
            const string descSpanish = "Antes De Las Seis";
            
            #region Spanish Lyrics
            const string lyricsSpanish = 
@"No actúes tan extraño
Duro como una roca
Si te mostre pedazos de piel
Que la luz del sol aun no toca
Y tantos lunares que ni yo misma conocia
Te mostre mi fuerza bruta
Mi talon de Aquiles, mi poesia

Que haras solo una historia mas
Que hare si no te vuelvo a ver
Oh, oh

Si desde el dia en que no estas
Vi la noche llegar mucho antes de las seis
Si desde el dia en que no estas
Vi la noche llegar mucho antes de las seis
Mucho antes

No dejes el barco
Tanto antes de que zarpemos
Hacia alguna isla desierta

Y despues, despues veremos
Si me ves desarmada
Porque lanzas tus misiles
Si ya conoces mis puntos cardinales
Los mas sensibles y sutiles

Que haras la vida lo dira
Que hare si no te vuelvo a ver
Oh, oh

Si desde el dia en que no estas
Vi la noche llegar mucho antes de las seis
Si desde el dia en que no estas
Vi la noche llegar mucho antes de las seis

Mucho antes de las seis

Mucho antes";
            #endregion

            Assert.AreEqual(2, tag.GetUnsynchronizedLyrics().Count());
            var frameSpanish = tag.GetUnsynchronizedLyrics(descSpanish, langSpanish);
            Assert.IsNotNull(frameSpanish);
            Assert.AreEqual(descSpanish, frameSpanish.Description);
            Assert.AreEqual(langSpanish, frameSpanish.Language);
            Assert.AreEqual(lyricsSpanish, frameSpanish.Text);
            var frameEnglish = tag.GetUnsynchronizedLyrics(descEnglish, langEnglish);
            Assert.IsNotNull(frameEnglish);
            Assert.AreEqual(descEnglish, frameEnglish.Description);
            Assert.AreEqual(langEnglish, frameEnglish.Language);
            Assert.AreEqual(lyricsEnglish, frameEnglish.Text);
        }
Exemplo n.º 6
0
        public void ReadTag()
        {
            file = Gnosis.Tags.TagLib.File.Create(location2);
            tag = file.GetTag(TagTypes.Id3v2) as Gnosis.Tags.TagLib.Id3v2.Tag;

            Assert.IsTrue(System.IO.File.Exists(location2));
            Assert.IsNotNull(file);
            Assert.IsNotNull(tag);

            Assert.AreEqual(title, tag.Title);
            Assert.AreEqual(titleSort, tag.TitleSort);
            Assert.AreEqual(grouping, tag.Grouping);
            Assert.AreEqual(subtitle, tag.Subtitle);

            Assert.AreEqual(album, tag.Album);
            Assert.AreEqual(albumSort, tag.AlbumSort);
            Assert.AreEqual(albumSubtitle, tag.AlbumSubtitle);

            Assert.AreEqual(artists, tag.ArtistsList);
            Assert.AreEqual(artistsSort, tag.ArtistsSort);
            Assert.AreEqual(albumArtists, tag.AlbumArtistsList);

            Assert.AreEqual(composers, tag.ComposersList);
            Assert.AreEqual(genres, tag.GenresList);
            Assert.AreEqual(moods, tag.Moods);
            Assert.AreEqual(languages, tag.Languages.Select(code => Language.GetLanguageByCode(code)));
            Assert.AreEqual(conductor, tag.Conductor);

            Assert.AreEqual(recordingDate, tag.RecordingDate);
            Assert.AreEqual(releaseDate, tag.ReleaseDate);

            Assert.AreEqual(originalTitle, tag.OriginalTitle);
            Assert.AreEqual(originalArtists, tag.OriginalArtists);
            Assert.AreEqual(originalReleaseDate, tag.OriginalReleaseDate);

            Assert.AreEqual(trackNumber, tag.Track);
            Assert.AreEqual(trackCount, tag.TrackCount);
            Assert.AreEqual(discNumber, tag.Disc);
            Assert.AreEqual(discCount, tag.DiscCount);

            Assert.AreEqual(duration, tag.Duration);
            Assert.AreEqual(beatsPerMinute, tag.BeatsPerMinute);

            Assert.AreEqual(playCount, tag.PlayCount);
            Assert.AreEqual(playlistDelay, tag.PlaylistDelay);

            Assert.AreEqual(originalFilename, tag.OriginalFilename);
            Assert.AreEqual(encodingDate, tag.EncodingDate);
            Assert.AreEqual(taggingDate, tag.TaggingDate);

            Assert.AreEqual(publisher, tag.Publisher);
            Assert.AreEqual(isrc, tag.InternationalStandardRecordingCode);
        }