Example #1
0
 private static MusicItem fromStatus(StatusPimpResponse status)
 {
     if (!hasTrack(status))
     {
         return(null);
     }
     return(AudioConversions.PimpTrackToMusicItem(status.track, null, null, null, null));
 }
        public override async Task LoadData()
        {
            var status = await session.StatusCall();

            var items = status.playlist.Select(item => AudioConversions.PimpTrackToMusicItem(item, null, session.Username, session.Password, session.IsCloud ? session.CloudServerID : null)).ToList();

            Sync(items, status.index);
        }
        public async Task <IEnumerable <MusicItem> > Search(string term)
        {
            var jsonResponse = await ToJson <IEnumerable <PimpTrack> >("/search?term=" + term + "&limit=100");

            return(jsonResponse
                   .Select(item => AudioConversions.PimpTrackToMusicItem(item, PlaybackUriFor(item.id), Username, Password, IsCloud ? CloudServerID : null))
                   .ToList());
        }
Example #4
0
        /// <summary>
        /// maps a json response to a list of music items
        /// </summary>
        /// <param name="response">the fetched data</param>
        private List <MusicItem> Itemize(FoldersPimpResponse response)
        {
            var ret = new List <MusicItem>();

            foreach (var folder in response.folders)
            {
                ret.Add(AudioConversions.FolderToMusicItem(folder));
            }
            foreach (var track in response.tracks)
            {
                ret.Add(AudioConversions.PimpTrackToMusicItem(track));
            }
            return(ret);
        }
Example #5
0
        public static PlaybackStatus ToPlaybackStatus(StatusPimpResponse status)
        {
            var playlist = status.playlist
                           .Select(track => AudioConversions.PimpTrackToMusicItem(track, null, null, null, null))
                           .ToList();

            return(new PlaybackStatus(
                       fromStatus(status),
                       position(status),
                       status.index,
                       playlist,
                       volume(status),
                       playerState(status),
                       status.mute));
        }
        private AlarmModel ToModel(MusicAlarm json)
        {
            var when = json.when;
            var time = new DateTime(2013, 1, 1, when.hour, when.minute, 0);
            var days = when.days.Select(DayName).ToList();

            return(new AlarmModel(this)
            {
                Id = json.id,
                IsOn = json.enabled,
                Time = time,
                EnabledDays = new ObservableCollection <object>(days),
                Track = AudioConversions.PimpTrackToMusicItem(json.job.track, null, Session.Username, Session.Password, Session.IsCloud ? Session.CloudServerID : null)
            });
        }
Example #7
0
 private MusicItem ToItem(PimpTrack track)
 {
     return(AudioConversions.PimpTrackToMusicItem(track, null, null, null, null));
 }
 public Task <IEnumerable <MusicItem> > Search(string term)
 {
     return(MapList <MusicItem, PimpTrack>(searchResource + "?term=" + term, item => AudioConversions.PimpTrackToMusicItem(item, null, Session.Username, Session.Password, Session.IsCloud ? Session.CloudServerID : null)));
 }
 public Task <IEnumerable <MusicItem> > Tracks()
 {
     return(MapList <MusicItem, PimpTrack>(tracksResource, item => AudioConversions.PimpTrackToMusicItem(item, null, Session.Username, Session.Password, Session.IsCloud ? Session.CloudServerID : null)));
 }
Example #10
0
 public MusicItem TrackToMusicItem(PimpTrack track, Uri uri)
 {
     return(AudioConversions.PimpTrackToMusicItem(track, uri, session.Username, session.Password, session.IsCloud ? session.CloudServerID : null));
 }