private void PlatformLoad(Action<int> progressCallback)
        {
            var songList = new List<Song>();
            var albumList = new List<Album>();

            foreach (var collection in MPMediaQuery.AlbumsQuery.Collections)
            {
                var nsAlbumArtist = collection.RepresentativeItem.ValueForProperty(MPMediaItem.AlbumArtistProperty);
                var nsAlbumName = collection.RepresentativeItem.ValueForProperty(MPMediaItem.AlbumTitleProperty);
                var nsAlbumGenre = collection.RepresentativeItem.ValueForProperty(MPMediaItem.GenreProperty);
                string albumArtist = nsAlbumArtist == null ? "Unknown Artist" : nsAlbumArtist.ToString();
                string albumName = nsAlbumName == null ? "Unknown Album" : nsAlbumName.ToString();
                string albumGenre = nsAlbumGenre == null ? "Unknown Genre" : nsAlbumGenre.ToString();
                MPMediaItemArtwork thumbnail = collection.RepresentativeItem.ValueForProperty(MPMediaItem.ArtworkProperty) as MPMediaItemArtwork;

                var albumSongs = new List<Song>((int)collection.Count);
                var album = new Album(new SongCollection(albumSongs), albumName, new Artist(albumArtist), new Genre(albumGenre), thumbnail);
                albumList.Add(album);

                foreach (var item in collection.Items)
                {
                    var nsArtist = item.ValueForProperty(MPMediaItem.ArtistProperty);
                    var nsTitle = item.ValueForProperty(MPMediaItem.TitleProperty);
                    var nsGenre = item.ValueForProperty(MPMediaItem.GenreProperty);
                    var assetUrl = item.ValueForProperty(MPMediaItem.AssetURLProperty) as NSUrl;

                    if (nsTitle == null || assetUrl == null) // The Asset URL check will exclude iTunes match items from the Media Library that are not downloaded, but show up in the music app
                        continue;

                    string artist = nsArtist == null ? "Unknown Artist" : nsArtist.ToString();
                    string title = nsTitle.ToString();
                    string genre = nsGenre == null ? "Unknown Genre" : nsGenre.ToString();
                    TimeSpan duration = TimeSpan.FromSeconds(((NSNumber)item.ValueForProperty(MPMediaItem.PlaybackDurationProperty)).FloatValue);

                    var song = new Song(album, new Artist(artist), new Genre(genre), title, duration, item, assetUrl);
                    albumSongs.Add(song);
                    songList.Add(song);
                }
            }

            albumCollection = new AlbumCollection(albumList);
            songCollection = new SongCollection(songList);

            /*_playLists = new PlaylistCollection();
					
			MPMediaQuery playlists = new MPMediaQuery();
			playlists.GroupingType = MPMediaGrouping.Playlist;
            for (int i = 0; i < playlists.Collections.Length; i++)
            {
                MPMediaItemCollection item = playlists.Collections[i];
                Playlist list = new Playlist();
                list.Name = playlists.Items[i].ValueForProperty(MPMediaPlaylistPropertyName).ToString();
                for (int k = 0; k < item.Items.Length; k++)
                {
                    TimeSpan time = TimeSpan.Parse(item.Items[k].ValueForProperty(MPMediaItem.PlaybackDurationProperty).ToString());
                    list.Duration += time;
                }
                _playLists.Add(list);
            }*/
        }
Exemple #2
0
        public AlbumCollection GetAlbums()
        {
            throw new NotImplementedException();
            IWMPMediaCollection media     = wmp.mediaCollection;
            IWMPPlaylist        playlist  = media.getAll();
            List <Album>        albumlist = new List <Album>();

            for (int i = 0; i < playlist.count; i++)
            {
                IWMPMedia temp = playlist[i];
                if (temp.getItemInfo("MediaType") == "audio")
                {
                    string albumname = temp.getItemInfo("Album");
                }
            }
            AlbumCollection albums = new AlbumCollection(albumlist);

            return(albums);
        }
Exemple #3
0
        private void PlatformLoad(Action <int> progressCallback)
        {
            List <StorageFile> files = new List <StorageFile>();

            this.GetAllFiles(musicFolder, files);

            List <Song>  songList  = new List <Song>();
            List <Album> albumList = new List <Album>();

            Task.Run(async() =>
            {
                Dictionary <string, Artist> artists = new Dictionary <string, Artist>();
                Dictionary <string, Album> albums   = new Dictionary <string, Album>();
                Dictionary <string, Genre> genres   = new Dictionary <string, Genre>();

                var cacheFile = await ApplicationData.Current.TemporaryFolder.CreateFileAsync("MediaLibrary.cache", CreationCollisionOption.OpenIfExists);
                var cache     = new Dictionary <string, MusicProperties>();

                // Read cache
                using (var stream = new BinaryReader(await cacheFile.OpenStreamForReadAsync()))
                    try
                    {
                        for (; stream.BaseStream.Position < stream.BaseStream.Length;)
                        {
                            var entry = MusicProperties.Deserialize(stream);
                            cache.Add(entry.Path, entry);
                        }
                    }
                    catch { }

                // Write cache
                using (var stream = new BinaryWriter(await cacheFile.OpenStreamForWriteAsync()))
                {
                    int prevProgress = 0;

                    for (int i = 0; i < files.Count; i++)
                    {
                        var file = files[i];
                        try
                        {
                            MusicProperties properties;
                            if (!(cache.TryGetValue(file.Path, out properties) && properties.TryMatch(file)))
                            {
                                properties = new MusicProperties(file);
                            }
                            properties.Serialize(stream);

                            if (string.IsNullOrWhiteSpace(properties.Title))
                            {
                                continue;
                            }

                            Artist artist;
                            if (!artists.TryGetValue(properties.Artist, out artist))
                            {
                                artist = new Artist(properties.Artist);
                                artists.Add(artist.Name, artist);
                            }

                            Artist albumArtist;
                            if (!artists.TryGetValue(properties.AlbumArtist, out albumArtist))
                            {
                                albumArtist = new Artist(properties.AlbumArtist);
                                artists.Add(albumArtist.Name, albumArtist);
                            }

                            Genre genre;
                            if (!genres.TryGetValue(properties.Genre, out genre))
                            {
                                genre = new Genre(properties.Genre);
                                genres.Add(genre.Name, genre);
                            }

                            Album album;
                            if (!albums.TryGetValue(properties.Album, out album))
                            {
                                var thumbnail = Task.Run(async() => await properties.File.GetThumbnailAsync(ThumbnailMode.MusicView, 300, ThumbnailOptions.ResizeThumbnail)).Result;
                                album         = new Album(new SongCollection(), properties.Album, albumArtist, genre, thumbnail.Type == ThumbnailType.Image ? thumbnail : null);
                                albums.Add(album.Name, album);
                                albumList.Add(album);
                            }

                            var song = new Song(album, artist, genre, properties);
                            song.Album.Songs.Add(song);
                            songList.Add(song);
                        }
                        catch (Exception e)
                        {
                            Debug.WriteLine("MediaLibrary exception: " + e.Message);
                        }

                        int progress = 100 * i / files.Count;
                        if (progress > prevProgress)
                        {
                            prevProgress = progress;
                            if (progressCallback != null)
                            {
                                progressCallback.Invoke(progress);
                            }
                        }
                    }
                }
            }).Wait();

            if (progressCallback != null)
            {
                progressCallback.Invoke(100);
            }

            albumCollection = new AlbumCollection(albumList);
            songCollection  = new SongCollection(songList);
        }
        private void PlatformLoad(Action<int> progressCallback)
        {
            List<Song> songList = new List<Song>();
            List<Album> albumList = new List<Album>();

            using (var musicCursor = Context.ContentResolver.Query(MediaStore.Audio.Media.ExternalContentUri, null, null, null, null))
            {
                if (musicCursor != null)
                {
                    Dictionary<string, Artist> artists = new Dictionary<string, Artist>();
                    Dictionary<string, Album> albums = new Dictionary<string, Album>();
                    Dictionary<string, Genre> genres = new Dictionary<string, Genre>();

                    // Note: Grabbing album art using MediaStore.Audio.AlbumColumns.AlbumArt and
                    // MediaStore.Audio.AudioColumns.AlbumArt is broken
                    // See: https://code.google.com/p/android/issues/detail?id=1630
                    // Workaround: http://stackoverflow.com/questions/1954434/cover-art-on-android

                    int albumNameColumn = musicCursor.GetColumnIndex(MediaStore.Audio.AlbumColumns.Album);
                    int albumArtistColumn = musicCursor.GetColumnIndex(MediaStore.Audio.AlbumColumns.Artist);
                    int albumIdColumn = musicCursor.GetColumnIndex(MediaStore.Audio.AlbumColumns.AlbumId);
                    int genreColumn = musicCursor.GetColumnIndex(MediaStore.Audio.GenresColumns.Name); // Also broken :(

                    int artistColumn = musicCursor.GetColumnIndex(MediaStore.Audio.AudioColumns.Artist);
                    int titleColumn = musicCursor.GetColumnIndex(MediaStore.Audio.AudioColumns.Title);
                    int durationColumn = musicCursor.GetColumnIndex(MediaStore.Audio.AudioColumns.Duration);
                    int assetIdColumn = musicCursor.GetColumnIndex(MediaStore.Audio.AudioColumns.Id);

                    if (titleColumn == -1 || durationColumn == -1 || assetIdColumn == -1)
                    {
                        Debug.WriteLine("Missing essential properties from music library. Returning empty library.");
                        albumCollection = new AlbumCollection(albumList);
                        songCollection = new SongCollection(songList);
                        return;
                    }

                    for (musicCursor.MoveToFirst(); !musicCursor.IsAfterLast; musicCursor.MoveToNext())
                        try
                        {
                            long durationProperty = musicCursor.GetLong(durationColumn);
                            TimeSpan duration = TimeSpan.FromMilliseconds(durationProperty);

                            // Exclude sound effects
                            if (duration < MinimumSongDuration)
                                continue;

                            string albumNameProperty = (albumNameColumn > -1 ? musicCursor.GetString(albumNameColumn) : null) ?? "Unknown Album";
                            string albumArtistProperty = (albumArtistColumn > -1 ? musicCursor.GetString(albumArtistColumn) : null) ?? "Unknown Artist";
                            string genreProperty = (genreColumn > -1 ? musicCursor.GetString(genreColumn) : null) ?? "Unknown Genre";
                            string artistProperty = (artistColumn > -1 ? musicCursor.GetString(artistColumn) : null) ?? "Unknown Artist";
                            string titleProperty = musicCursor.GetString(titleColumn);

                            long assetId = musicCursor.GetLong(assetIdColumn);
                            var assetUri = ContentUris.WithAppendedId(MediaStore.Audio.Media.ExternalContentUri, assetId);
                            long albumId = albumIdColumn > -1 ? musicCursor.GetInt(albumIdColumn) : -1;
                            var albumArtUri = albumId > -1 ? ContentUris.WithAppendedId(Uri.Parse("content://media/external/audio/albumart"), albumId) : null;

                            Artist artist;
                            if (!artists.TryGetValue(artistProperty, out artist))
                            {
                                artist = new Artist(artistProperty);
                                artists.Add(artist.Name, artist);
                            }

                            Artist albumArtist;
                            if (!artists.TryGetValue(albumArtistProperty, out albumArtist))
                            {
                                albumArtist = new Artist(albumArtistProperty);
                                artists.Add(albumArtist.Name, albumArtist);
                            }

                            Genre genre;
                            if (!genres.TryGetValue(genreProperty, out genre))
                            {
                                genre = new Genre(genreProperty);
                                genres.Add(genre.Name, genre);
                            }

                            Album album;
                            if (!albums.TryGetValue(albumNameProperty, out album))
                            {
                                album = new Album(new SongCollection(), albumNameProperty, albumArtist, genre, albumArtUri);
                                albums.Add(album.Name, album);
                                albumList.Add(album);
                            }

                            var song = new Song(album, artist, genre, titleProperty, duration, assetUri);
                            song.Album.Songs.Add(song);
                            songList.Add(song);
                        }
                        catch (Exception e)
                        {
                            Debug.WriteLine("MediaLibrary exception: " + e.Message);
                        }
                }

                musicCursor.Close();
            }

            albumCollection = new AlbumCollection(albumList);
            songCollection = new SongCollection(songList);
        }
Exemple #5
0
        private void PlatformLoad(Action <int> progressCallback)
        {
            List <Song>  songList  = new List <Song>();
            List <Album> albumList = new List <Album>();

            using (var musicCursor = Context.ContentResolver.Query(MediaStore.Audio.Media.ExternalContentUri, null, null, null, null))
            {
                if (musicCursor != null && musicCursor.MoveToFirst())
                {
                    Dictionary <string, Artist> artists = new Dictionary <string, Artist>();
                    Dictionary <string, Album>  albums  = new Dictionary <string, Album>();
                    Dictionary <string, Genre>  genres  = new Dictionary <string, Genre>();

                    // Note: Grabbing album art using MediaStore.Audio.AlbumColumns.AlbumArt and
                    // MediaStore.Audio.AudioColumns.AlbumArt is broken
                    // See: https://code.google.com/p/android/issues/detail?id=1630
                    // Workaround: http://stackoverflow.com/questions/1954434/cover-art-on-android

                    int albumNameColumn   = musicCursor.GetColumnIndex(MediaStore.Audio.AlbumColumns.Album);
                    int albumArtistColumn = musicCursor.GetColumnIndex(MediaStore.Audio.AlbumColumns.Artist);
                    int albumIdColumn     = musicCursor.GetColumnIndex(MediaStore.Audio.AlbumColumns.AlbumId);
                    int genreColumn       = musicCursor.GetColumnIndex(MediaStore.Audio.GenresColumns.Name); // Also broken :(

                    int artistColumn   = musicCursor.GetColumnIndex(MediaStore.Audio.AudioColumns.Artist);
                    int titleColumn    = musicCursor.GetColumnIndex(MediaStore.Audio.AudioColumns.Title);
                    int durationColumn = musicCursor.GetColumnIndex(MediaStore.Audio.AudioColumns.Duration);
                    int assetIdColumn  = musicCursor.GetColumnIndex(MediaStore.Audio.AudioColumns.Id);

                    if (titleColumn == -1 || durationColumn == -1 || assetIdColumn == -1)
                    {
                        Debug.WriteLine("Missing essential properties from music library. Returning empty library.");
                        albumCollection = new AlbumCollection(albumList);
                        songCollection  = new SongCollection(songList);
                        return;
                    }

                    do
                    {
                        long     durationProperty = musicCursor.GetLong(durationColumn);
                        TimeSpan duration         = TimeSpan.FromMilliseconds(durationProperty);

                        // Exclude sound effects
                        if (duration < MinimumSongDuration)
                        {
                            continue;
                        }

                        string albumNameProperty   = albumNameColumn > -1 ? musicCursor.GetString(albumNameColumn) : "Unknown Album";
                        string albumArtistProperty = albumArtistColumn > -1 ? musicCursor.GetString(albumArtistColumn) : "Unknown Artist";
                        string genreProperty       = genreColumn > -1 ? musicCursor.GetString(genreColumn) : "Unknown Genre";
                        string artistProperty      = artistColumn > -1 ? musicCursor.GetString(artistColumn) : "Unknown Artist";
                        string titleProperty       = musicCursor.GetString(titleColumn);

                        long assetId     = musicCursor.GetLong(assetIdColumn);
                        var  assetUri    = ContentUris.WithAppendedId(MediaStore.Audio.Media.ExternalContentUri, assetId);
                        long albumId     = albumIdColumn > -1 ? musicCursor.GetInt(albumIdColumn) : -1;
                        var  albumArtUri = albumId > -1 ? ContentUris.WithAppendedId(Uri.Parse("content://media/external/audio/albumart"), albumId) : null;

                        Artist artist;
                        if (!artists.TryGetValue(artistProperty, out artist))
                        {
                            artist = new Artist(artistProperty);
                            artists.Add(artist.Name, artist);
                        }

                        Artist albumArtist;
                        if (!artists.TryGetValue(albumArtistProperty, out albumArtist))
                        {
                            albumArtist = new Artist(albumArtistProperty);
                            artists.Add(albumArtist.Name, albumArtist);
                        }

                        Genre genre;
                        if (!genres.TryGetValue(genreProperty, out genre))
                        {
                            genre = new Genre(genreProperty);
                            genres.Add(genre.Name, genre);
                        }

                        Album album;
                        if (!albums.TryGetValue(albumNameProperty, out album))
                        {
                            album = new Album(new SongCollection(), albumNameProperty, albumArtist, genre, albumArtUri);
                            albums.Add(album.Name, album);
                            albumList.Add(album);
                        }

                        var song = new Song(album, artist, genre, titleProperty, duration, assetUri);
                        song.Album.Songs.Add(song);
                        songList.Add(song);
                    } while (musicCursor.MoveToNext());
                }
            }

            albumCollection = new AlbumCollection(albumList);
            songCollection  = new SongCollection(songList);
        }
Exemple #6
0
        private void PlatformLoad(Action <int> progressCallback)
        {
            MPMediaQuery mediaQuery = new MPMediaQuery();
            var          value      = NSObject.FromObject(MPMediaType.Music);
            var          type       = MPMediaItem.MediaTypeProperty;
            var          predicate  = MPMediaPropertyPredicate.PredicateWithValue(value, type);

            mediaQuery.AddFilterPredicate(predicate);
            mediaQuery.GroupingType = MPMediaGrouping.Album;

            List <Song>  songList  = new List <Song>();
            List <Album> albumList = new List <Album>();

            for (int i = 0; i < mediaQuery.Collections.Length; i++)
            {
                MPMediaItemCollection itemCollection = mediaQuery.Collections[i];
                List <Song>           albumSongs     = new List <Song>(itemCollection.Count);

                var                nsAlbumArtist = itemCollection.RepresentativeItem.ValueForProperty(MPMediaItem.AlbumArtistProperty);
                var                nsAlbumName   = itemCollection.RepresentativeItem.ValueForProperty(MPMediaItem.AlbumTitleProperty);
                var                nsAlbumGenre  = itemCollection.RepresentativeItem.ValueForProperty(MPMediaItem.GenreProperty);
                string             albumArtist   = nsAlbumArtist == null ? "Unknown Artist" : nsAlbumArtist.ToString();
                string             albumName     = nsAlbumName == null ? "Unknown Album" : nsAlbumName.ToString();
                string             albumGenre    = nsAlbumGenre == null ? "Unknown Genre" : nsAlbumGenre.ToString();
                MPMediaItemArtwork thumbnail     = itemCollection.RepresentativeItem.ValueForProperty(MPMediaItem.ArtworkProperty) as MPMediaItemArtwork;

                var album = new Album(new SongCollection(albumSongs), albumName, new Artist(albumArtist), new Genre(albumGenre), thumbnail);
                albumList.Add(album);

                for (int j = 0; j < itemCollection.Count; j++)
                {
                    var nsArtist = itemCollection.Items[j].ValueForProperty(MPMediaItem.ArtistProperty);
                    var nsTitle  = itemCollection.Items[j].ValueForProperty(MPMediaItem.TitleProperty);
                    var nsGenre  = itemCollection.Items[j].ValueForProperty(MPMediaItem.GenreProperty);
                    var assetUrl = itemCollection.Items[j].ValueForProperty(MPMediaItem.AssetURLProperty) as NSUrl;

                    if (nsTitle == null || assetUrl == null) // The Asset URL check will exclude iTunes match items from the Media Library that are not downloaded, but show up in the music app
                    {
                        continue;
                    }

                    string   artist   = nsArtist == null ? "Unknown Artist" : nsArtist.ToString();
                    string   title    = nsTitle.ToString();
                    string   genre    = nsGenre == null ? "Unknown Genre" : nsGenre.ToString();
                    TimeSpan duration = TimeSpan.FromSeconds(((NSNumber)itemCollection.Items[j].ValueForProperty(MPMediaItem.PlaybackDurationProperty)).FloatValue);

                    var song = new Song(album, new Artist(artist), new Genre(genre), title, duration, itemCollection.Items[j], assetUrl);
                    albumSongs.Add(song);
                    songList.Add(song);
                }
            }

            albumCollection = new AlbumCollection(albumList);
            songCollection  = new SongCollection(songList);

            /*_playLists = new PlaylistCollection();
             *
             *          MPMediaQuery playlists = new MPMediaQuery();
             *          playlists.GroupingType = MPMediaGrouping.Playlist;
             * for (int i = 0; i < playlists.Collections.Length; i++)
             * {
             *  MPMediaItemCollection item = playlists.Collections[i];
             *  Playlist list = new Playlist();
             *  list.Name = playlists.Items[i].ValueForProperty(MPMediaPlaylistPropertyName).ToString();
             *  for (int k = 0; k < item.Items.Length; k++)
             *  {
             *      TimeSpan time = TimeSpan.Parse(item.Items[k].ValueForProperty(MPMediaItem.PlaybackDurationProperty).ToString());
             *      list.Duration += time;
             *  }
             *  _playLists.Add(list);
             * }*/
        }
        private void PlatformLoad(Action<int> progressCallback)
        {
#if !WINDOWS_UAP
            Task.Run(async () =>
            {
                if (musicFolder == null)
                {
                    try
                    {
                        musicFolder = KnownFolders.MusicLibrary;
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine("Failed to access Music Library: " + e.Message);
                        albumCollection = new AlbumCollection(new List<Album>());
                        songCollection = new SongCollection(new List<Song>());
                        return;
                    }
                }
                    
            
                var files = new List<StorageFile>();
                await this.GetAllFiles(musicFolder, files);

                var songList = new List<Song>();
                var albumList = new List<Album>();

                var artists = new Dictionary<string, Artist>();
                var albums = new Dictionary<string, Album>();
                var genres = new Dictionary<string, Genre>();

                var cache = new Dictionary<string, MusicProperties>();

                // Read cache
                var cacheFile = await ApplicationData.Current.TemporaryFolder.CreateFileAsync(CacheFile, CreationCollisionOption.OpenIfExists);
                using (var stream = new BinaryReader(await cacheFile.OpenStreamForReadAsync()))
                    try
                    {
                        for (; stream.BaseStream.Position < stream.BaseStream.Length; )
                        {
                            var entry = MusicProperties.Deserialize(stream);
                            cache.Add(entry.Path, entry);
                        }
                    }
                    catch { }

                // Write cache
                cacheFile = await ApplicationData.Current.TemporaryFolder.CreateFileAsync(CacheFile, CreationCollisionOption.ReplaceExisting);
                using (var stream = new BinaryWriter(await cacheFile.OpenStreamForWriteAsync()))
                {
                    int prevProgress = 0;

                    for (int i = 0; i < files.Count; i++)
                    {
                        var file = files[i];
                        try
                        {
                            MusicProperties properties;
                            if (!(cache.TryGetValue(file.Path, out properties) && properties.TryMatch(file)))
                                properties = new MusicProperties(file);
                            properties.Serialize(stream);

                            if (string.IsNullOrWhiteSpace(properties.Title))
                                continue;

                            Artist artist;
                            if (!artists.TryGetValue(properties.Artist, out artist))
                            {
                                artist = new Artist(properties.Artist);
                                artists.Add(artist.Name, artist);
                            }

                            Artist albumArtist;
                            if (!artists.TryGetValue(properties.AlbumArtist, out albumArtist))
                            {
                                albumArtist = new Artist(properties.AlbumArtist);
                                artists.Add(albumArtist.Name, albumArtist);
                            }

                            Genre genre;
                            if (!genres.TryGetValue(properties.Genre, out genre))
                            {
                                genre = new Genre(properties.Genre);
                                genres.Add(genre.Name, genre);
                            }

                            Album album;
                            if (!albums.TryGetValue(properties.Album, out album))
                            {
                                var thumbnail = Task.Run(async () => await properties.File.GetThumbnailAsync(ThumbnailMode.MusicView, 300, ThumbnailOptions.ResizeThumbnail)).Result;
                                album = new Album(new SongCollection(), properties.Album, albumArtist, genre, thumbnail.Type == ThumbnailType.Image ? thumbnail : null);
                                albums.Add(album.Name, album);
                                albumList.Add(album);
                            }

                            var song = new Song(album, artist, genre, properties);
                            song.Album.Songs.Add(song);
                            songList.Add(song);
                        }
                        catch (Exception e)
                        {
                            Debug.WriteLine("MediaLibrary exception: " + e.Message);
                        }

                        int progress = 100 * i / files.Count;
                        if (progress > prevProgress)
                        {
                            prevProgress = progress;
                            if (progressCallback != null)
                                progressCallback.Invoke(progress);
                        }
                    }
                }

                if (progressCallback != null)
                    progressCallback.Invoke(100);

                albumCollection = new AlbumCollection(albumList);
                songCollection = new SongCollection(songList);
            }).Wait();
#endif
        }
        public AlbumCollection GetAlbums()
        {
            throw new NotImplementedException();
            IWMPMediaCollection media = wmp.mediaCollection;
            IWMPPlaylist playlist = media.getAll();
            List<Album> albumlist = new List<Album>();

            for (int i = 0; i < playlist.count; i++)
            {
                IWMPMedia temp = playlist[i];
                if (temp.getItemInfo("MediaType") == "audio")
                {
                    string albumname = temp.getItemInfo("Album");
                }
            }
            AlbumCollection albums = new AlbumCollection(albumlist);
            return albums;
        }
Exemple #9
0
 public InitLls(SongCollection sc01, AlbumCollection alc01, ArtistCollection arc01)
 {
     this.sc01 = sc01;
     this.alc01 = alc01;
     this.arc01 = arc01;
 }