Ejemplo n.º 1
0
        public async Task RecordStream(SingleTimer timer)
        {
            var mediaStreamInfo = await GetChannelStream(timer.ChannelId, "none", CancellationToken.None);

            HttpRequestOptions options = new HttpRequestOptionsMod()
            {
                Url = mediaStreamInfo.Path + "?duration=" + timer.Duration()
            };
            await RecordingHelper.DownloadVideo(_httpClient, options, _logger, Path.Combine(RecordingPath, timer.GetRecordingName()), timer.Cts.Token);

            _logger.Info("Recording was a success");
        }
Ejemplo n.º 2
0
        public Task CreateTimerAsync(TimerInfo info, CancellationToken cancellationToken)
        {
            var lastTimer = new SingleTimer(info);

            if (lastTimer.Duration() > 5)
            {
                timers.Add(lastTimer);
                UpdateTimerData();
                timers.Last().StartRecording += (sender, args) => { RecordStream(lastTimer); };
                timers.Last().GenerateEvent();
                _logger.Info("Added timer for: " + info.ProgramId);
            }
            else
            {
                _logger.Error("Timer not created the show is about to end or has already ended");
            }
            return(Task.FromResult(0));
        }