Ejemplo n.º 1
0
        protected void OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            try
            {
                TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

                if (tvEvent.EventType == TvServerEventType.RecordingEnded)
                {
#if TVE3
                    var recording = Recording.Retrieve(tvEvent.Recording.IdRecording);
#else
                    var recording = ServiceAgents.Instance.RecordingServiceAgent.GetRecording(tvEvent.Recording);
#endif
                    if (recording != null)
                    {
                        ServiceRegistration.Get <ILogger>().Info("SlimTvService: Recording ended: {0}", recording.FileName);
                        ImportRecording(recording.FileName);
                    }
                }
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Warn("SlimTvService: Exception while handling TvServerEvent", ex);
            }
        }
Ejemplo n.º 2
0
        private void controller_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            if (_state == EpgState.Idle)
            {
                return;
            }
            TvServerEventArgs tvArgs = eventArgs as TvServerEventArgs;

            if (eventArgs == null)
            {
                return;
            }
            if (tvArgs != null)
            {
                switch (tvArgs.EventType)
                {
                case TvServerEventType.StartTimeShifting:
                    Log.Epg("epg cancelled due to start timeshifting");
                    OnEpgCancelled();
                    break;

                case TvServerEventType.StartRecording:
                    Log.Epg("epg cancelled due to start recording");
                    OnEpgCancelled();
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        private static void ComSkipLauncher_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            try
            {
                TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

                if (tvEvent.EventType == TvServerEventType.RecordingStarted && _runAtStart)
                {
                    Channel channel = Channel.Retrieve(tvEvent.Recording.IdChannel);

                    string parameters = ProcessParameters(_parameters, tvEvent.Recording.FileName, channel.DisplayName);

                    Log.Info("ComSkipLauncher: Recording started ({0} on {1}), launching program ({2} {3}) ...",
                             tvEvent.Recording.FileName, channel.DisplayName, _program, parameters);

                    LaunchProcess(_program, parameters, Path.GetDirectoryName(_program), ProcessWindowStyle.Hidden);
                }
                else if (tvEvent.EventType == TvServerEventType.RecordingEnded && !_runAtStart)
                {
                    Channel channel = Channel.Retrieve(tvEvent.Recording.IdChannel);

                    string parameters = ProcessParameters(_parameters, tvEvent.Recording.FileName, channel.DisplayName);

                    Log.Info("ComSkipLauncher: Recording ended ({0} on {1}), launching program ({2} {3}) ...",
                             tvEvent.Recording.FileName, channel.DisplayName, _program, parameters);

                    LaunchProcess(_program, parameters, Path.GetDirectoryName(_program), ProcessWindowStyle.Hidden);
                }
            }
            catch (Exception ex)
            {
                Log.Error("ComSkipLauncher - ComSkipLauncher_OnTvServerEvent(): {0}", ex.Message);
            }
        }
Ejemplo n.º 4
0
        protected override void OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            try
            {
                TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

                if (tvEvent.EventType == TvServerEventType.RecordingStarted || tvEvent.EventType == TvServerEventType.RecordingEnded)
                {
                    UpdateServerState();
                    var recording = Recording.Retrieve(tvEvent.Recording.IdRecording);
                    if (recording != null)
                    {
                        ServiceRegistration.Get <ILogger>().Info("SlimTvService: {0}: {1}", tvEvent.EventType, recording.FileName);
                        ImportRecording(recording.FileName);
                    }
                }
                if (tvEvent.EventType == TvServerEventType.RecordingEnded)
                {
                    _ = CleanUpRecordingsAsync();
                }
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Warn("SlimTvService: Exception while handling TvServerEvent", ex);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Handles the OnTvServerEvent event fired by the server.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="eventArgs">The <see cref="System.EventArgs"/> the event data.</param>
        void events_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

            if (eventArgs == null || tvEvent == null)
            {
                return;
            }

            if (tvEvent.EventType == TvServerEventType.StartTimeShifting)
            {
                try
                {
                    Thread doWork = new Thread(delegate()
                    {
                        new TvTimeShiftPositionWatcher(tvEvent);
                    });
                    doWork.Start();
                }
                catch (Exception ex)
                {
                    Log.Error("TsBufferExtractor exception : {0}", ex);
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles the OnTvServerEvent event fired by the server.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="eventArgs">The <see cref="System.EventArgs"/> the event data.</param>
        private void events_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

            if (tvEvent.EventType == TvServerEventType.ProgramUpdated)
            {
                UpdatePersonalTVGuide();
            }
        }
        private void OnTvServerEvent(object sender, EventArgs eventargs)
        {
            TvServerEventArgs tvEvent = (TvServerEventArgs)eventargs;

            if (tvEvent.EventType == TvServerEventType.RecordingEnded)
            {
                Log.Debug("ThumbProcessor.OnTvServerEvent: Enqueue recording {0}", tvEvent.Recording.FileName);
                _queue.EnqueueTask(new List <string> {
                    tvEvent.Recording.FileName
                });
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Handles the OnTvServerEvent event fired by the server.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="eventArgs">The <see cref="System.EventArgs"/> the event data.</param>
        private void events_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

            if (tvEvent.EventType == TvServerEventType.ScheduledAdded ||
                tvEvent.EventType == TvServerEventType.ScheduleDeleted)
            {
                UpdateConflicts();
                Setting setting = cmLayer.GetSetting("CMLastUpdateTime", DateTime.Now.ToString());
                setting.Value = DateTime.Now.ToString();
                setting.Persist();
                //TvController mycontrol;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Handles the OnTvServerEvent event fired by the server.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="eventArgs">The <see cref="System.EventArgs"/> the event data.</param>
        void events_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

            if (eventArgs == null || tvEvent == null)
            {
                return;
            }

            if (tvEvent.EventType == TvServerEventType.RecordingEnded && _filename == tvEvent.Recording.FileName)
            {
                _startMerge = true;

                ITvServerEvent events = GlobalServiceProvider.Instance.Get <ITvServerEvent>();
                events.OnTvServerEvent -= new TvServerEventHandler(events_OnTvServerEvent);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// events_OnTvServerEvent is used to receive requests to Tune External Channels.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="eventArgs">Event arguments.</param>
        private void events_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            try
            {
                TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

                Log.Debug("TV3BlasterPlugin: Received TV Server Event \"{0}\"",
                          Enum.GetName(typeof(TvServerEventType), tvEvent.EventType));

                if (tvEvent.EventType != TvServerEventType.StartZapChannel)
                {
                    return;
                }

                AnalogChannel analogChannel = tvEvent.channel as AnalogChannel;
                if (analogChannel == null)
                {
                    return;
                }

                Log.Debug("TV3BlasterPlugin: Analog channel input source \"{0}\"",
                          Enum.GetName(typeof(AnalogChannel.VideoInputType), analogChannel.VideoSource));

                //if (analogChannel.VideoSource == AnalogChannel.VideoInputType.Tuner)
                //return;

                Log.Info("TV3BlasterPlugin: Tune request - Card: {0}, Channel: {1}, {2}", tvEvent.Card.Id,
                         analogChannel.ChannelNumber, analogChannel.Name);

                if (_externalChannelConfigs == null)
                {
                    throw new InvalidOperationException("Cannot process tune request, no STB settings are loaded");
                }

                Thread newThread = new Thread(ProcessExternalChannel);
                newThread.Name         = "ProcessExternalChannel";
                newThread.Priority     = ThreadPriority.AboveNormal;
                newThread.IsBackground = true;
                newThread.Start(new int[] { analogChannel.ChannelNumber, tvEvent.Card.Id });
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
        }
Ejemplo n.º 11
0
        private void events_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            TvServerEventArgs args = eventArgs as TvServerEventArgs;

            if (args != null &&
                args.EventType == TvServerEventType.ImportEpgPrograms &&
                args.EpgChannel != null &&
                args.EpgChannel.Programs.Count > 0)
            {
                try
                {
                    ImportEpgPrograms(args.EpgChannel);
                }
                catch (Exception ex)
                {
                    Log.Error("ArgusTV.Recorder.MediaPortalTvServer: ImportEpgPrograms(): {0}", ex.Message);
                }
            }
        }
        /// <summary>
        /// Handles the OnTvServerEvent event fired by the server.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="eventArgs">The <see cref="System.EventArgs"/> the event data.</param>
        void events_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

            if (eventArgs == null || tvEvent == null)
            {
                return;
            }
            if ((tvEvent.EventType == TvServerEventType.EndTimeShifting || tvEvent.EventType == TvServerEventType.StartZapChannel) &&
                _idChannelToWatch == tvEvent.Card.IdChannel && _tvEvent.User.Name == tvEvent.User.Name)
            {
                StopTimer();
            }

            if (tvEvent.EventType == TvServerEventType.RecordingStarted && _idChannelToWatch == tvEvent.Card.IdChannel)
            {
                int i = 0;
                while (i < 100)
                {
                    Log.Debug("TsBufferExtractor: waiting for the signal.");
                    if (_isManual == _tvEvent.User.Name)
                    {
                        break;
                    }

                    Thread.Sleep(100);
                    i++;
                }

                if (_isManual == _tvEvent.User.Name)
                {
                    _isManual = string.Empty;
                    CheckRecordingStatus();
                    SnapshotTimeShiftBuffer();
                }
                else
                {
                    Log.Debug("TsBufferExtractor: it is not a manual recording or timeout.");
                }
            }
        }
Ejemplo n.º 13
0
        protected override void OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            try
            {
                TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;

                if (tvEvent.EventType == TvServerEventType.RecordingStarted || tvEvent.EventType == TvServerEventType.RecordingEnded)
                {
                    var recording = ServiceAgents.Instance.RecordingServiceAgent.GetRecording(tvEvent.Recording);
                    if (recording != null)
                    {
                        ServiceRegistration.Get <ILogger>().Info("SlimTvService: {0}: {1}", tvEvent.EventType, recording.FileName);
                        ImportRecording(recording.FileName);
                    }
                }
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Warn("SlimTvService: Exception while handling TvServerEvent", ex);
            }
        }
        private void events_OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            TvServerEventArgs tvEvent       = (TvServerEventArgs)eventArgs;
            AnalogChannel     analogChannel = tvEvent.channel as AnalogChannel;

            if (analogChannel == null)
            {
                return;
            }
            if (tvEvent.EventType == TvServerEventType.StartZapChannel)
            {
                Log.WriteFile("ServerBlaster - CardId: {0}, Channel: {1} - Channel:{2} - VideoSource: {3}",
                              tvEvent.Card.Id, analogChannel.ChannelNumber, analogChannel.Name,
                              analogChannel.VideoSource.ToString());
                _send           = true;
                _channel        = analogChannel.ChannelNumber;
                _card           = tvEvent.Card.Id;
                _videoInputType = analogChannel.VideoSource; // ralphy
                Log.WriteFile("ServerBlaster - Done");
            }
        }
        private void OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            TvServerEventArgs tvArgs = eventArgs as TvServerEventArgs;

            if (eventArgs == null)
            {
                return;
            }
            if (tvArgs != null)
            {
                switch (tvArgs.EventType)
                {
                case TvServerEventType.ScheduledAdded:
                case TvServerEventType.ScheduleDeleted:

                    // Trigger PowerScheduler's StandbyWakeupThread to set the next wakeup time
                    EventWaitHandle eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, "TvEngine.PowerScheduler.StandbyWakeupTriggered");
                    eventWaitHandle.Set();
                    break;
                }
            }
        }
        private void OnTvServerEvent(object sender, EventArgs eventArgs)
        {
            TvServerEventArgs tvArgs = eventArgs as TvServerEventArgs;

            if (eventArgs == null)
            {
                return;
            }
            if (tvArgs != null)
            {
                switch (tvArgs.EventType)
                {
                case TvServerEventType.RecordingStarted:
                case TvServerEventType.RecordingEnded:
                case TvServerEventType.StartTimeShifting:
                case TvServerEventType.EndTimeShifting:

                    // Trigger PowerScheduler's StandbyWakeupThread to check standby conditions
                    EventWaitHandle eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, "TvEngine.PowerScheduler.StandbyWakeupTriggered");
                    eventWaitHandle.Set();
                    break;
                }
            }
        }
 public TvTimeShiftPositionWatcher(TvServerEventArgs eventArgs)
 {
     _tvEvent = eventArgs;
     SetNewChannel(_tvEvent.Card.IdChannel);
 }