コード例 #1
0
        public ActionResult <TrackTitle> Current(string channelId)
        {
            if (!ChannelExists(channelId))
            {
                return(ChannelNotFound(channelId));
            }

            return(_channelTrackRepository.CurrentChannelTrackFor(channelId)
                   .Track
                   .ToTrackTitle());
        }
コード例 #2
0
        private async Task NextTrack()
        {
            using (IServiceScope scope = _serviceProvider.CreateScope())
            {
                IChannelTrackRepository channelTrackRepository = scope.ServiceProvider.GetService <IChannelTrackRepository>();

                await channelTrackRepository.MoveToNextTrack(_currentChannel);

                _currentTrack = channelTrackRepository.CurrentChannelTrackFor(_currentChannel).Track;

                await _radioHubProxy.UpdateTrack(_currentChannel, _currentTrack);
            }

            _timer.Stop();
            _timer.Interval = _currentTrack.Length.TotalMilliseconds;
            _timer.Start();
            _stopwatch.Restart();
        }