]> git.vomp.tv Git - vompclient.git/blob - event.cc
Fix resuming recording directly after stopping it
[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   epgImage = 0;
44 }
45
46 Event::~Event()
47 {
48   if (title) delete[] title;
49   if (subtitle) delete[] subtitle;
50   if (description) delete[] description;
51 }
52
53 void Event::settitle(const char* s)
54 {
55   delete title;
56   title = new char[strlen(s) + 1];
57   strcpy(title, s);
58 }
59
60 void Event::setdescription(const char* s)
61 {
62   delete description;
63   description = new char[strlen(s) + 1];
64   strcpy(description, s);
65 }
66
67 void Event::setsubtitle(const char* s)
68 {
69   delete subtitle;
70   subtitle = new char[strlen(s) + 1];
71   strcpy(subtitle, s);
72 }
73
74
75 void Event::loadinfos(UINT channelid)
76 {
77         VDR *vdr=VDR::getInstance();
78         if (movieInfo) delete movieInfo;
79         if (seriesInfo) delete seriesInfo;
80
81         movieInfo = NULL;
82         seriesInfo = NULL;
83
84
85         if (movieID == 0 && seriesID == 0) {
86                 vdr->getScraperEventType(channelid, id, movieID, seriesID, episodeID, epgImage);
87                 Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper EventType %d %d, %d %d %d %d",
88                                 id, channelid,
89                                 movieID, seriesID, episodeID);
90         }
91
92         if (!vdr->isConnected()) Command::getInstance()->connectionLost();
93
94         if (movieID != 0)
95         {
96                 movieInfo = vdr->getScraperMovieInfo(movieID);
97                 Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper MovieInfo ");
98         }
99         else if (seriesID != 0)
100         {
101                 seriesInfo = vdr->getScraperSeriesInfo(seriesID, episodeID);
102                 Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper SeriesInfo ");
103         }
104
105
106         if (!vdr->isConnected()) Command::getInstance()->connectionLost();
107 }
108
109