Exemplo n.º 1
0
        private void SetAlbumPropertiesFromTracks()
        {
            AlbumTrack first = _tracks[0];

            AlbumTitle  = first.Album;
            Genre       = first.Genre;
            Artist      = first.Artist;
            ReleaseDate = first.ReleaseDate;
            if (first.Picture != null)
            {
                Picture = new Picture(first.Picture).ImageSource;
            }

            for (int i = 1; i < _tracks.Count; i++)
            {
                AlbumTrack track = _tracks[i];

                if (AlbumTitle != track.Album)
                {
                    AlbumTitle = null;
                }
                if (Genre != track.Genre)
                {
                    Genre = null;
                }
                if (Artist != track.Artist)
                {
                    IsVariousArtists = true;
                    Artist           = null;
                }
                if (ReleaseDate != track.ReleaseDate)
                {
                    ReleaseDate = null;
                }
            }

            // TODO: Use Album Artist from tracks
            // TODO: Use TCMP from tracks
        }
Exemplo n.º 2
0
        private static List <AlbumTrack> GetTracksFromPath(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException("path");
            }

            string[] files = Directory.GetFiles(path, "*.mp3"); // TODO: Expand supported file types
            if (files == null || files.Length == 0)
            {
                throw new Exception(string.Format("No audio files found in '{0}'", path)); // TODO: Localize
            }
            var tracks = new List <AlbumTrack>();

            foreach (string file in files)
            {
                AlbumTrack track = new AlbumTrack(file);
                tracks.Add(track);
            }

            return(tracks);
        }