Exemplo n.º 1
0
        public TrackFile(string path, string root = null)
        {
            var track = TagLib.File.Create(path);

            if (String.IsNullOrEmpty(root) || (!System.IO.Path.IsPathRooted(path)) || !path.StartsWith(root))
            {
                Path = path;
            }
            else
            {
                Path = path.Remove(0, root.Length + 1);
            }
            Tag = track.Tag;

            Genres = TrimStrings(Tag.Genres);

            if (track.GetTag(TagTypes.Id3v2) is TagLib.Id3v2.Tag id3v2)
            {
                Comments = id3v2.GetAllComments(TagLib.Id3v2.Tag.Language);
                Ratings  = id3v2.GetAllRatings();
            }
            else
            {
                Comments = new Dictionary <string, string>();
                Ratings  = new List <TrackRating>();
            }

            MediaMonkey = new MediaMonkeyTags(this);
            Dances      = new TrackDances(this);
        }
Exemplo n.º 2
0
 public Track(string path, uint trackNumber, string title, string[] artistNames, string[] albumArtistNames, string albumTitle, uint beatsPerMinute, Dictionary <string, string> comments, string[] genres, string grouping, List <TrackRating> ratings)
 {
     TrackNumber      = trackNumber;
     Title            = title;
     ArtistNames      = artistNames;
     AlbumTitle       = albumTitle;
     AlbumArtistNames = albumArtistNames;
     BeatsPerMinute   = beatsPerMinute;
     Comments         = comments ?? new Dictionary <string, string>();
     Genres           = genres ?? new string[0];
     Grouping         = grouping;
     Path             = path;
     if ((ratings != null) && (ratings.Count > 0))
     {
         Ratings.AddRange(ratings);
     }
     MediaMonkey = new MediaMonkeyTags(this);
     Dances      = new TrackDances(this);
 }