summaryrefslogtreecommitdiff
path: root/epghandler.c
blob: 5bed74fcde670c73b7d3b03ca0c98b9146b37eb9 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
 * cEEpgHandler.c
 *
 *  Created on: 11.3.2012
 *      Author: d.petrovski
 */

#include "epghandler.h"
#include "log.h"

cEEpgHandler::cEEpgHandler() {
	// TODO Auto-generated constructor stub
    LogD(1, prep("cEEpgHandler()"));

}

cEEpgHandler::~cEEpgHandler() {
	// TODO Auto-generated destructor stub
}

bool cEEpgHandler::HandleEitEvent(cSchedule* Schedule,
		const SI::EIT::Event* EitEvent, uchar TableID, uchar Version) {
    //LogD(1, prep("HandleEitEvent"));
    return false;
//	return true;
}

bool cEEpgHandler::SetEventID(cEvent* Event, tEventID EventID) {
	Event->SetEventID(EventID);
	return true;
}

bool cEEpgHandler::SetTitle(cEvent* Event, const char* Title) {
    LogD(1, prep("Event id:%d title:%s new title:%s"), Event->EventID(), Event->Title(), Title);

    if (!Event->Title() || Title && (!strcmp(Event->Title(),"") || (strcmp(Title,"") && strcmp(Event->Title(),Title))))
	Event->SetTitle(Title);
    return true;
}

bool cEEpgHandler::SetShortText(cEvent* Event, const char* ShortText) {
    LogD(1, prep("Event id:%d ShortText:%s new ShortText:%s"), Event->EventID(), Event->ShortText(), ShortText);

    if (Event->ShortText() && !strcmp(Event->ShortText(),""))
    	origShortText = Event->ShortText();
    else
    	origShortText.clear();

    //if (!Event->ShortText() || ShortText && (!strcmp(Event->ShortText(),"") || (strcmp(ShortText,"") && strcmp(Event->ShortText(),ShortText))))
	Event->SetShortText(ShortText);
    return true;
}

bool cEEpgHandler::SetDescription(cEvent* Event, const char* Description) {
    LogD(1, prep("Event id:%d Description:%s new Description:%s"), Event->EventID(), Event->Description(), Description);

    if (Event->Description() && !strcmp(Event->Description(),""))
    	origDescription = Event->Description();
    else
    	origDescription.clear();
    
    //if (!Event->Description() || Description && (!strcmp(Event->Description(),"") || (strcmp(Description,"") && strcmp(Event->Description(),Description))))
	Event->SetDescription(Description);
    return true;
}

bool cEEpgHandler::SetContents(cEvent* Event, uchar* Contents) {
	Event->SetContents(Contents);
	return true;
}

bool cEEpgHandler::SetParentalRating(cEvent* Event, int ParentalRating) {
	Event->SetParentalRating(ParentalRating);
	return true;
}

bool cEEpgHandler::SetStartTime(cEvent* Event, time_t StartTime) {
	Event->SetStartTime(StartTime);
	return true;
}

bool cEEpgHandler::SetDuration(cEvent* Event, int Duration) {
	Event->SetDuration(Duration);
	return true;
}

bool cEEpgHandler::SetVps(cEvent* Event, time_t Vps) {
	Event->SetVps(Vps);
	return true;
}

bool cEEpgHandler::HandleEvent(cEvent* Event) {
    //LogD(1, prep("HandleEvent"));

	//After FixEpgBugs of cEvent set the original Short Text if empty
	if (!Event->ShortText() && !strcmp(Event->ShortText(),""))
		Event->SetShortText(origShortText.c_str());

	//TODO just to see the difference
	if (!origDescription.empty() && !origDescription.compare(Event->Description())) {
		origDescription.append(" | EIT: ");
		origDescription.append(Event->Description());
		Event->SetDescription(origDescription.c_str());
	}

	return true;
}

bool cEEpgHandler::SortSchedule(cSchedule* Schedule) {
	Schedule->Sort();
	return true;
}

bool cEEpgHandler::DropOutdated(cSchedule* Schedule, time_t SegmentStart,
		time_t SegmentEnd, uchar TableID, uchar Version) {
	return false;
}