internal Id3V1ToMetadataAdapter(Id3V1 v1Tag)
 {
     Title   = v1Tag.Title;
     Artist  = v1Tag.Artist;
     Album   = v1Tag.Album;
     Genre   = v1Tag.Genre;
     Comment = v1Tag.Comment;
     Year    = v1Tag.Year;
     if (v1Tag.TrackNumber >= 1)
     {
         TrackNumber = v1Tag.TrackNumber.ToString("00", CultureInfo.InvariantCulture);
     }
 }
示例#2
0
 public AudioMetadata ReadMetadata(Stream stream)
 {
     try
     {
         // Check for an ID3v2 tag first
         var tagModel = TagManager.Deserialize(stream);
         return(new TagModelToMetadataAdapter(tagModel));
     }
     catch (TagNotFoundException)
     {
         try
         {
             // If no ID3v2 tag was found, check for ID3v1
             var v1Tag = new Id3V1();
             v1Tag.Deserialize(stream);
             return(new Id3V1ToMetadataAdapter(v1Tag));
         }
         catch (TagNotFoundException e)
         {
             throw new AudioUnsupportedException(e.Message);
         }
     }
 }