Esempio n. 1
0
        private AudioSkillResponse HandlePlaybackStoppedRequest(AudioRequestBundle request)
        {
            _log.LogLine($"Handle PlaybackStopped request (token={request.Token} | offset={request.OffsetInMilliseconds}).");

            _currentOffsetInMilliseconds = request.OffsetInMilliseconds;
            return(DefaultResponse(request));
        }
Esempio n. 2
0
        private AudioSkillResponse HandlePlaybackStartedRequest(AudioRequestBundle request)
        {
            _log.LogLine($"Handle PlaybackStarted request (token={request.Token}).");

            Guid.TryParse(request.Token, out Guid songRef);
            var songs   = _queueReader.QueuedSongs();
            var current = songs.FirstOrDefault(s => s.SongRef == songRef);

            if (current == null)
            {
                return(Failed($"Failed to find current song for token={songRef}"));
            }

            _currentSong = current;
            return(DefaultResponse(request));
        }
Esempio n. 3
0
        private AudioSkillResponse HandlePlaybackNearlyFinishedRequest(AudioRequestBundle request)
        {
            _log.LogLine($"Handle PlaybackNearlyFinished request (token={request.Token}).");

            Guid.TryParse(request.Token, out Guid songRef);
            var songs   = _queueReader.QueuedSongs();
            var current = songs.FirstOrDefault(s => s.SongRef == songRef);

            if (current == null)
            {
                return(Failed($"Failed to find current song for token={songRef}"));
            }

            var index = songs.IndexOf(current);

            if (index + 1 < songs.Count)
            {
                var next = songs[index + 1];
                return(PlaySong(next, songs, false));
            }

            _log.LogLine("No songs left in queue.");
            return(DefaultResponse(request));
        }