#ifndef VDR_SEARCHTIMER_THREAD_H
#define VDR_SEARCHTIMER_THREAD_H

#include <vdr/thread.h>
#include "epgsearchext.h"

// --- cRecordingObj --------------------------------------------------------
class cRecordingObj : public cListObject {
public:
    cRecording* recording;
    cSearchExt* search;
public:
    cRecordingObj(cRecording* r, cSearchExt* s) : recording(r), search(s) {}
    ~cRecordingObj() { recording = NULL;} // do not delete anything!
};

class cSearchTimerThread: public cThread {
 private:
    bool m_Active;
    time_t m_lastUpdate;
 protected:
    virtual void Action(void);
    void AddModTimer(cTimer* Timer, int, cSearchExt*, const cEvent*, int Prio, int Lifetime, char* Summary = NULL);
    void Stop(void);
    bool NeedUpdate();
    bool TimerWasModified(cTimer* t);
 public:
    static char* SummaryExtended(cSearchExt* searchExt, cTimer* Timer, const cEvent* pEvent);
    static cSearchTimerThread *m_Instance;

    static cTimer* GetTimer(cSearchExt *searchExt, const cEvent *pEvent, bool& bTimesMatchExactly);
    static int GetCountTimers(const cEvent* event, bool compareTitle, bool compareSubtitle, bool compareSummary, unsigned long catvaluesAvoidRepeat, cTimer** first);
    cSearchTimerThread(void);
    virtual ~cSearchTimerThread();
    static void Init(void);
    static void Exit(void);
    void CheckExpiredRecs();
    void DelRecording(int index);
    static int GetCountRecordings(cSearchExt* search);
};

#endif 
