private void AddAll(List <Entry> entries, ICollection <MusicItem> dest) { foreach (var item in entries) { Uri uri = null; if (!item.isDir) { uri = session.StreamUriFor(item.id); } dest.Add(AudioConversions.EntryToMusicItem(item, uri, session.Username, session.Password)); } }
private MusicItem currentPlaylistTrack(JukeboxPlaylist playlist) { var index = playlist.currentIndex; if (index < 0) { return(null); } var track = playlist.entry[index]; return(AudioConversions.EntryToMusicItem(track, session.StreamUriFor(track.id), session.Username, session.Password)); }
public override async Task LoadData() { var response = await session.serverGetPlaylistAsync(); var playlistIndex = response.jukeboxPlaylist.currentIndex; // entry null => playlist empty var entries = response.jukeboxPlaylist.entry; if (entries != null) { var index = 0; var items = new List <PlaylistMusicItem>(); foreach (var entry in entries) { MusicItem musicItem = AudioConversions.EntryToMusicItem(entry, session.StreamUriFor(entry.id), session.Username, session.Password); items.Add(new PlaylistMusicItem(musicItem, index++)); } SyncPlaylist(items, playlistIndex); } else { SyncPlaylist(new List <PlaylistMusicItem>(), playlistIndex); } }