]> git.vomp.tv Git - vompclient.git/blob - event.cc
For new raspberry version: fixes, move to new version of libav, use avresample, Bugfi...
[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 MovieInfo* Event::movieInfo = NULL;
29 SeriesInfo* Event::seriesInfo = NULL;
30
31 Event::Event()
32 {
33   id = 0;
34   time = 0;
35   duration = 0;
36
37   title = NULL;
38   subtitle = NULL;
39   description = NULL;
40   index = -1;
41   movieID = 0;
42   seriesID =0;
43 }
44
45 Event::~Event()
46 {
47   if (title) delete[] title;
48   if (subtitle) delete[] subtitle;
49   if (description) delete[] description;
50 }
51
52 void Event::settitle(const char* s)
53 {
54   delete title;
55   title = new char[strlen(s) + 1];
56   strcpy(title, s);
57 }
58
59 void Event::setdescription(const char* s)
60 {
61   delete description;
62   description = new char[strlen(s) + 1];
63   strcpy(description, s);
64 }
65
66 void Event::setsubtitle(const char* s)
67 {
68   delete subtitle;
69   subtitle = new char[strlen(s) + 1];
70   strcpy(subtitle, s);
71 }
72
73
74 void Event::loadinfos(UINT channelid)
75 {
76         VDR *vdr=VDR::getInstance();
77         if (movieInfo) delete movieInfo;
78         if (seriesInfo) delete seriesInfo;
79
80         movieInfo = NULL;
81         seriesInfo = NULL;
82
83
84         if (movieID == 0 && seriesID == 0) {
85                 vdr->getScraperEventType(channelid, id, movieID, seriesID, episodeID);
86                 Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper EventType %d %d, %d %d %d",
87                                 id, channelid,
88                                 movieID, seriesID, episodeID);
89         }
90
91         if (!vdr->isConnected()) Command::getInstance()->connectionLost();
92
93         if (movieID != 0)
94         {
95                 movieInfo = vdr->getScraperMovieInfo(movieID);
96                 Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper MovieInfo ");
97         }
98         else if (seriesID != 0)
99         {
100                 seriesInfo = vdr->getScraperSeriesInfo(seriesID, episodeID);
101                 Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper SeriesInfo ");
102         }
103
104
105         if (!vdr->isConnected()) Command::getInstance()->connectionLost();
106 }
107
108