summaryrefslogtreecommitdiff
path: root/epgelement.c
blob: d0fa0c4ef392a34c5ad54a3efe06bd37942d11c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "switchtimer.h"
#include "services/remotetimers.h"
#include "epgelement.h"

cEpgElement::cEpgElement(const cEvent *event, cChannelEpg *owner) : cGridElement(owner) {
    this->event = event;
    hasTimer = false;
    timerIsActive = false;
    SetTimer();
    hasSwitchTimer = false;
    SetSwitchTimer();
    dummy = false;
}

cEpgElement::~cEpgElement(void) {
}

void cEpgElement::SetTimer() {
    hasTimer = false;
    if (config.useRemoteTimers && pRemoteTimers) {
        RemoteTimers_Event_v1_0 rt;
        rt.event = event;
        if (pRemoteTimers->Service("RemoteTimers::GetTimerByEvent-v1.0", &rt))
            hasTimer = true;
#if VDRVERSNUM >= 20301
    } else {
        eTimerMatch TimerMatch = tmNone;
        LOCK_TIMERS_READ;
        const cTimer *timer = Timers->GetMatch(event, &TimerMatch);
        if (TimerMatch == tmFull) {
            hasTimer = true;
            timerIsActive = timer->HasFlags(tfActive);
        }
#else
    } else if (owner->HasTimer()) {
        hasTimer = event->HasTimer();
#endif
    }
}

void cEpgElement::SetSwitchTimer() {
    if (owner->HasSwitchTimer()) {
        hasSwitchTimer = SwitchTimers.EventInSwitchList(event);
    } else {
        hasSwitchTimer = false;
    }
}

const char *cEpgElement::Title(void) {
    return event->Title();
}

const char *cEpgElement::ShortText(void) {
    if (event->ShortText())
        return event->ShortText();
    return "";
}

void cEpgElement::Debug() {
    esyslog("tvguideng: epgelement %ld: \"%s\" %s - %s, channel %s, timer: %d", id, event->Title(), *(event->GetTimeString()), *(event->GetEndTimeString()), Channel()->Name(), hasTimer);
}