]> git.vomp.tv Git - vompclient.git/blob - event.cc
Add first support for TVScraper in VVideolive also some optimization for raspberry...
[vompclient.git] / event.cc
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #include "event.h"
22 #include "log.h"
23 #include "command.h"
24 #include "movieinfo.h"
25 #include "seriesinfo.h"
26 #include "vdr.h"
27
28 Event::Event()
29 {
30   id = 0;
31   time = 0;
32   duration = 0;
33
34   title = NULL;
35   subtitle = NULL;
36   description = NULL;
37   movieInfo = NULL;
38   seriesInfo = NULL;
39 }
40
41 Event::~Event()
42 {
43   if (title) delete[] title;
44   if (subtitle) delete[] subtitle;
45   if (description) delete[] description;
46   if (movieInfo) delete movieInfo;
47   if (seriesInfo) delete seriesInfo;
48 }
49
50 void Event::settitle(const char* s)
51 {
52   delete title;
53   title = new char[strlen(s) + 1];
54   strcpy(title, s);
55 }
56
57 void Event::setdescription(const char* s)
58 {
59   delete description;
60   description = new char[strlen(s) + 1];
61   strcpy(description, s);
62 }
63
64 void Event::setsubtitle(const char* s)
65 {
66   delete subtitle;
67   subtitle = new char[strlen(s) + 1];
68   strcpy(subtitle, s);
69 }
70
71
72 void Event::loadinfos(UINT channelid)
73 {
74         VDR *vdr=VDR::getInstance();
75         if (movieInfo) delete movieInfo;
76         if (seriesInfo) delete seriesInfo;
77
78         movieInfo = NULL;
79         seriesInfo = NULL;
80         movieID = 0;
81         seriesID =0;
82
83         vdr->getScraperEventType(channelid, id, movieID, seriesID, episodeID);
84         Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper EventType %d %d, %d %d %d",
85                         id, channelid,
86                         movieID, seriesID, episodeID);
87
88         if (!vdr->isConnected()) Command::getInstance()->connectionLost();
89
90         if (movieID != 0)
91         {
92                 movieInfo = vdr->getScraperMovieInfo(movieID);
93                 Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper MovieInfo ");
94         }
95         else if (seriesID != 0)
96         {
97                 seriesInfo = vdr->getScraperSeriesInfo(seriesID, episodeID);
98                 Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper SeriesInfo ");
99         }
100
101
102         if (!vdr->isConnected()) Command::getInstance()->connectionLost();
103 }
104
105