public void CheckRecordingStatus(CancellationToken cancellationToken)
        {
            var schedules        = Plugin.TvProxy.GetCurrentSchedules(cancellationToken);
            int currentSchedules = schedules.Sum(s => s.Id) * schedules.Sum(s => s.ScheduleType) * schedules.Sum(s => s.PreRecordInterval) * schedules.Sum(s => s.PostRecordInterval);

            if (currentSchedules != lastSchedules)
            {
                Plugin.Logger.Info("Changes of timers at TVServer detected. Refreshing timers now.");
                RefreshTimers(cancellationToken);
                RefreshSeriesTimers(cancellationToken);
                lastSchedules = currentSchedules;
            }

            int currentRecordingCount = Plugin.TvProxy.GetRecordingCount(cancellationToken);

            if (currentRecordingCount != lastRecordingCount)
            {
                RecordingStatusChangedEventArgs args = new RecordingStatusChangedEventArgs();
                args.NewStatus = RecordingStatus.New;

                Plugin.Logger.Info("Changes of recordings at TVServer detected. Refreshing recordings now.");
                RecordingStatusChanged?.Invoke(this, args);
                lastRecordingCount = currentRecordingCount;
            }
        }
 private void RegisterRecordingStatusChangedEvent()
 {
     _recordingStatusCallback = (elapsedTime, fileSize, _) =>
     {
         RecordingStatusChanged?.Invoke(this, new RecordingStatusChangedEventArgs((long)elapsedTime, (long)fileSize));
     };
     Native.SetStatusChangedCallback(_handle, _recordingStatusCallback).
     ThrowIfError("Failed to initialize status changed event.");
 }
        public async Task RecordingStatus(string status)
        {
            await RecordingStatusChanged.InvokeAsync(status);

            if (status == "Stopped")
            {
                Recording = false;
            }
        }
Exemple #4
0
        private void RegisterRecordingProgressEvent()
        {
            _recordingProgressCallback = (ulong elapsedTime, ulong fileSize, IntPtr userData) =>
            {
                RecordingStatusChanged?.Invoke(this, new RecordingStatusChangedEventArgs((long)elapsedTime, (long)fileSize));
            };

            Native.SetRecordingProgressCallback(_handle, _recordingProgressCallback, IntPtr.Zero).
            ThrowIfError("Failed to initialize RecordingStatusChanged event");
        }
Exemple #5
0
 private void OnRecordingStatusChanged()
 {
     RecordingStatusChanged?.Invoke(this, EventArgs.Empty);
 }