Beispiel #1
0
 /// <summary>
 /// Updates the pull observers.
 /// </summary>
 /// <param name="data">Data retrieved from the pull.</param>
 private void UpdatePullObservers(PullResponse data)
 {
     foreach (var observer in this.PullObservers)
     {
         observer.onNewPullData(data);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Called by MainController when new pull data comes in. This builds the model from the pull data.
        /// </summary>
        /// <param name="data">Data.</param>
        public override void onNewPullData(PullResponse data)
        {
            // TODO: use ISongs, will need spotify lookup to get more detailed song info.
            var queue = data.SuggestQueue;
            var songs = new List <ISong>();

            // look up the metadata with spotify for each song
            foreach (var elem in queue.Songs)
            {
                var songID = elem.ID;

                // TODO: lookup all the songs at once
                var song = mainController.musicService.GetSong(songID);
                songs.Add(song);
            }

            SetAll(songs);
        }
Beispiel #3
0
        public void onNewPullData(PullResponse data)
        {
            // TODO: implement properly


            if (data == null)
            {
                return;
            }

            var playingInfo = data.Playing;

            // update old messages
            previousPullData = currentPullData;
            currentPullData  = playingInfo;

            // check for relevant change
            if (currentPullData.CurrentSongID == previousPullData.CurrentSongID)
            {
                // if no change, and we aren't playing, request next song
                return;
            }

            // if we don't have a song, skip
            if (!currentPullData.HasSong)
            {
                return;
            }

            // lookup song
            var song = musicService.GetSong(currentPullData.CurrentSongID);

            musicService.PlaySong(song);

            Debug.WriteLine("Tried to play: " + song.UniqueId + " name: " + song.Name);
        }
Beispiel #4
0
 public virtual void onNewPullData(PullResponse data)
 {
     throw new NotImplementedException();
 }