Пример #1
0
void cPluginRestfulapi::MainThreadHook(void)
{
  // Perform actions in the context of the main program thread.
  // WARNING: Use with great care - see PLUGINS.html!
  TaskScheduler* scheduler = TaskScheduler::get();

  scheduler->DoTasks();
 
  tChannelID channelID = scheduler->SwitchableChannel();
  
  if (!( channelID == tChannelID::InvalidID )) {
     cChannel* channel = Channels.GetByChannelID(channelID);
     if (channel != NULL) {
        Channels.SwitchTo( channel->Number() );
        scheduler->SwitchableChannel(tChannelID::InvalidID);
     }
  }

  cRecording* recording = scheduler->SwitchableRecording();

  if (recording != NULL) {
     #if APIVERSNUM > 10727
     cReplayControl::SetRecording(recording->FileName());
     #else
     cReplayControl::SetRecording(recording->FileName(), recording->Title());
     #endif
     scheduler->SwitchableRecording(NULL);
     cControl::Shutdown();
     cControl::Launch(new cReplayControl);
  }
}