diff options
Diffstat (limited to 'timer_thread.c')
-rw-r--r-- | timer_thread.c | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/timer_thread.c b/timer_thread.c index ba82c41..f01cdb6 100644 --- a/timer_thread.c +++ b/timer_thread.c @@ -38,37 +38,41 @@ The project's page is at http://winni.vdr-developer.org/epgsearch cTimerThread *cTimerThread::m_Instance = NULL; TimerThreadStatus cTimerThread::m_Status = TimerThreadReady; -int gl_TimerProgged=0; // Flag that indicates, when programming is finished +int gl_TimerProgged = 0; // Flag that indicates, when programming is finished cTimerThread::cTimerThread() -: cThread("EPGSearch: timer") + : cThread("EPGSearch: timer") { m_Active = false; } -cTimerThread::~cTimerThread() { +cTimerThread::~cTimerThread() +{ if (m_Active) - Stop(); + Stop(); cTimerThread::m_Instance = NULL; } -void cTimerThread::Init(cString cmd) { +void cTimerThread::Init(cString cmd) +{ if (m_Instance == NULL) { - m_Instance = new cTimerThread; - m_Instance->m_cmd = cmd; - m_Instance->Start(); + m_Instance = new cTimerThread; + m_Instance->m_cmd = cmd; + m_Instance->Start(); } } -void cTimerThread::Exit(void) { +void cTimerThread::Exit(void) +{ if (m_Instance != NULL) { - m_Instance->Stop(); - DELETENULL(m_Instance); + m_Instance->Stop(); + DELETENULL(m_Instance); } } -void cTimerThread::Stop(void) { +void cTimerThread::Stop(void) +{ m_Active = false; Cancel(3); } @@ -76,38 +80,32 @@ void cTimerThread::Stop(void) { void cTimerThread::Action(void) { m_Active = true; - if (EPGSearchConfig.useExternalSVDRP && !epgsSVDRP::cSVDRPClient::SVDRPSendCmd) - { - LogFile.eSysLog("ERROR - SVDRPSend script not specified or does not exist (use -f option)"); - m_Active = false; - return; + if (EPGSearchConfig.useExternalSVDRP && !epgsSVDRP::cSVDRPClient::SVDRPSendCmd) { + LogFile.eSysLog("ERROR - SVDRPSend script not specified or does not exist (use -f option)"); + m_Active = false; + return; } - while (m_Active) - { - if (!Running()) - { - m_Active=false; + while (m_Active) { + if (!Running()) { + m_Active = false; break; } - { - LOCK_TIMERS_WRITE; - Timers->SetExplicitModify(); - } - bool bSuccess = SendViaSVDRP(m_cmd); - if (!bSuccess) - { - Epgsearch_osdmessage_v1_0* service_data = new Epgsearch_osdmessage_v1_0; - service_data->message = strdup(tr("Programming timer failed!")); - service_data->type = mtError; - cPluginManager::CallFirstService("Epgsearch-osdmessage-v1.0", service_data); - delete service_data; - } - else - { - gl_TimerProgged = 1; - if (gl_timerStatusMonitor) gl_timerStatusMonitor->SetConflictCheckAdvised(); - } - m_Active = false; + { + LOCK_TIMERS_WRITE; + Timers->SetExplicitModify(); + } + bool bSuccess = SendViaSVDRP(m_cmd); + if (!bSuccess) { + Epgsearch_osdmessage_v1_0* service_data = new Epgsearch_osdmessage_v1_0; + service_data->message = strdup(tr("Programming timer failed!")); + service_data->type = mtError; + cPluginManager::CallFirstService("Epgsearch-osdmessage-v1.0", service_data); + delete service_data; + } else { + gl_TimerProgged = 1; + if (gl_timerStatusMonitor) gl_timerStatusMonitor->SetConflictCheckAdvised(); + } + m_Active = false; }; } |