Example #1
0
 private static void FillTagData(MediaTag mpTag, TagLib.File ID3Tag)
 {
     if (ID3Tag.Tag != null)
     {
         mpTag.Name = ID3Tag.Tag.Title ?? null;
         mpTag.Album = ID3Tag.Tag.Album ?? null;
         mpTag.Artist = ID3Tag.Tag.FirstPerformer ?? null;
     }
 }
 private Track CreateNewTrack(MediaTag tag, string file)
 {
     return new Track
     {
         AddedOn = DateTime.Today,
         FilePath = file,
         Tag = tag,
         WasEverInAPlaylist = false,
         ThreeMonthCount = 0,
         TotalCount = 0,
         LastUpdateCount = 0,
         DoesLike = null,
     };
 }
Example #3
0
 public MediaTag TryCreateTagFromFile(string filePath)
 {
     MediaTag tag = null;
     try
     {
         var ID3Tag = TagLib.File.Create(filePath);
         if (ID3Tag is TagLib.Mpeg.AudioFile)
         {
             tag = new MediaTag();
             FillTagData(tag, ID3Tag);
         }
     }
     catch(Exception e)
     {
     }
     return tag;
 }