Пример #1
0
 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));
     }
 }
Пример #2
0
        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));
        }
Пример #3
0
        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);
            }
        }