/// <summary>
        /// Abort an active recording.
        /// </summary>
        /// <param name="activeRecording">The active recording to abort.</param>
        public async Task AbortActiveRecording(ActiveRecording activeRecording)
        {
            var request = NewRequest(HttpMethod.Post, "AbortActiveRecording");

            request.AddBody(activeRecording);
            await ExecuteAsync(request).ConfigureAwait(false);
        }
Ejemplo n.º 2
0
        private void PlaySelectedRecording()
        {
            ActiveRecording activeRecording = GetSelectedActiveRecording();

            if (activeRecording != null)
            {
                Utility.RunVlc(activeRecording.RecordingFileName);
            }
        }
Ejemplo n.º 3
0
 internal static bool IsChannelRecording(Guid channelId, out ActiveRecording activeRecording)
 {
     foreach (ActiveRecording recording in ActiveRecordings)
     {
         if (recording.CardChannelAllocation.ChannelId == channelId)
         {
             activeRecording = recording;
             return(true);
         }
     }
     activeRecording = null;
     return(false);
 }
Ejemplo n.º 4
0
 private void SetTarget(Channel channel, Guid?guideProgramId, string title, string subTitle, string episodeNumberDisplay, DateTime startTime,
                        ScheduleType?scheduleType, UpcomingProgram upcomingProgram, UpcomingGuideProgram upcomingGuideProgram, ActiveRecording activeRecording)
 {
     _channel              = channel;
     _guideProgramId       = guideProgramId;
     _title                = title;
     _subTitle             = subTitle;
     _episodeNumberDisplay = episodeNumberDisplay;
     _startTime            = startTime;
     _scheduleType         = scheduleType;
     _upcomingProgram      = upcomingProgram;
     _activeRecording      = activeRecording;
     _upcomingGuideProgram = upcomingGuideProgram;
 }
Ejemplo n.º 5
0
        private ActiveRecording GetSelectedActiveRecording()
        {
            ActiveRecording activeRecording = null;

            if (_activeRecordingsControl.SelectedRows.Count > 0)
            {
                UpcomingOrActiveProgramView upcomingProgramView = _activeRecordingsControl.SelectedRows[0].DataBoundItem as UpcomingOrActiveProgramView;
                if (upcomingProgramView != null)
                {
                    activeRecording = upcomingProgramView.ActiveRecording;
                }
            }
            return(activeRecording);
        }
Ejemplo n.º 6
0
        internal static bool IsActiveRecording(Guid channelId, GuideProgram guideProgram, out ActiveRecording activeRecording)
        {
            Guid upcomingProgramId = guideProgram.GetUniqueUpcomingProgramId(channelId);

            foreach (ActiveRecording recording in ActiveRecordings)
            {
                if (recording.Program.UpcomingProgramId == upcomingProgramId)
                {
                    activeRecording = recording;
                    return(true);
                }
            }
            activeRecording = null;
            return(false);
        }
 public UpcomingOrActiveProgramView(ActiveRecording activeRecording)
 {
     _activeRecording = activeRecording;
     _upcomingProgram = activeRecording.Program;
 }
Ejemplo n.º 8
0
 public void SetTarget(ActiveRecording activeRecording)
 {
     SetTarget(activeRecording.Program.Channel, activeRecording.Program.GuideProgramId, activeRecording.Program.Title,
               activeRecording.Program.SubTitle, activeRecording.Program.EpisodeNumberDisplay,
               activeRecording.Program.StartTime, ScheduleType.Recording, activeRecording.Program, null, activeRecording);
 }
Ejemplo n.º 9
0
        public bool ProcessLogEntry(LogEntry logEntry, MuxOptions options)
        {
            if (logEntry.Type == LogEntry.TypeStartRecording)
            {
                if (ActiveRecording != null)
                {
                    // already recording, shouldn't happen
                    return(false);
                }

                ActiveRecording = new Recording
                {
                    Connection     = this,
                    StartTimestamp = logEntry.Timestamp,
                    LogFile        = logEntry.FilePath
                };

                if (StartTimestamp == null)
                {
                    StartTimestamp = logEntry.Timestamp;
                }

                ActiveRecording.Update(logEntry);
            }
            else if (logEntry.Type == LogEntry.TypeUpdateRecording)
            {
                if (ActiveRecording == null)
                {
                    // not recording, shouldn't happen
                    return(false);
                }

                ActiveRecording.Update(logEntry);
            }
            else if (logEntry.Type == LogEntry.TypeStopRecording)
            {
                if (ActiveRecording == null)
                {
                    // not recording, shouldn't happen
                    return(false);
                }

                ActiveRecording.Update(logEntry, true);

                ActiveRecording.StopTimestamp = logEntry.Timestamp;
                ActiveRecording.AudioFile     = logEntry.Data?.AudioFile;
                ActiveRecording.VideoFile     = logEntry.Data?.VideoFile;

                if (ActiveRecording.AudioFile != null)
                {
                    ActiveRecording.AudioStartTimestamp = logEntry.Data?.AudioFirstFrameTimestamp ?? ActiveRecording.StartTimestamp;
                    ActiveRecording.AudioStopTimestamp  = logEntry.Data?.AudioLastFrameTimestamp ?? ActiveRecording.StopTimestamp;

                    if (!Path.IsPathRooted(ActiveRecording.AudioFile))
                    {
                        ActiveRecording.AudioFile = Path.Combine(options.InputPath, ActiveRecording.AudioFile);
                    }
                }

                if (ActiveRecording.VideoFile != null)
                {
                    ActiveRecording.VideoStartTimestamp = logEntry.Data?.VideoFirstFrameTimestamp ?? ActiveRecording.StartTimestamp;
                    ActiveRecording.VideoStopTimestamp  = logEntry.Data?.VideoLastFrameTimestamp ?? ActiveRecording.StopTimestamp;

                    if (!Path.IsPathRooted(ActiveRecording.VideoFile))
                    {
                        ActiveRecording.VideoFile = Path.Combine(options.InputPath, ActiveRecording.VideoFile);
                    }
                }

                var videoDelay = logEntry.Data?.VideoDelay ?? 0D;
                if (videoDelay != 0 && ActiveRecording.AudioFile != null && ActiveRecording.VideoStartTimestamp.HasValue && ActiveRecording.VideoStopTimestamp.HasValue)
                {
                    ActiveRecording.VideoStartTimestamp = ActiveRecording.VideoStartTimestamp.Value.AddSeconds(videoDelay);
                    ActiveRecording.VideoStopTimestamp  = ActiveRecording.VideoStopTimestamp.Value.AddSeconds(videoDelay);
                }

                // ensure consistency on start/stop timestamps
                var audioStartTimestampTicks = long.MaxValue;
                var audioStopTimestampTicks  = long.MinValue;
                if (ActiveRecording.AudioFile != null && ActiveRecording.AudioStartTimestamp.HasValue && ActiveRecording.AudioStopTimestamp.HasValue)
                {
                    audioStartTimestampTicks = ActiveRecording.AudioStartTimestamp.Value.Ticks;
                    audioStopTimestampTicks  = ActiveRecording.AudioStopTimestamp.Value.Ticks;
                }

                var videoStartTimestampTicks = long.MaxValue;
                var videoStopTimestampTicks  = long.MinValue;
                if (ActiveRecording.VideoFile != null && ActiveRecording.VideoStartTimestamp.HasValue && ActiveRecording.VideoStopTimestamp.HasValue)
                {
                    videoStartTimestampTicks = ActiveRecording.VideoStartTimestamp.Value.Ticks;
                    videoStopTimestampTicks  = ActiveRecording.VideoStopTimestamp.Value.Ticks;
                }

                StartTimestamp = ActiveRecording.StartTimestamp = new DateTime(Math.Min(audioStartTimestampTicks, videoStartTimestampTicks));
                StopTimestamp  = ActiveRecording.StopTimestamp = new DateTime(Math.Max(audioStopTimestampTicks, videoStopTimestampTicks));

                _Recordings.Add(ActiveRecording);
                ActiveRecording = null;
            }
            return(true);
        }
Ejemplo n.º 10
0
 internal static string GetIconImageFileName(ActiveRecording activeRecording)
 {
     return(GetIconImageFileName(ScheduleType.Recording, activeRecording.Program.IsPartOfSeries, activeRecording.Program.CancellationReason,
                                 true, activeRecording.CardChannelAllocation, activeRecording.ConflictingPrograms));
 }
Ejemplo n.º 11
0
 public static string BuildRecordingInfoToolTip(ActiveRecording activeRecording, string onText)
 {
     return(BuildRecordingInfoToolTip(activeRecording.ActualStartTime, activeRecording.ActualStopTime,
                                      activeRecording.CardChannelAllocation, onText));
 }