Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
EPG.h
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../AddonBase.h"
12#include "../../c-api/addon-instance/pvr.h"
13
14//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
15// "C++" Definitions group 4 - PVR EPG
16#ifdef __cplusplus
17
18namespace kodi
19{
20namespace addon
21{
22
23//==============================================================================
39class PVREPGTag : public DynamicCStructHdl<PVREPGTag, EPG_TAG>
40{
41 friend class CInstancePVRClient;
42
43public:
45 PVREPGTag()
46 {
47 m_cStructure->iSeriesNumber = EPG_TAG_INVALID_SERIES_EPISODE;
48 m_cStructure->iEpisodeNumber = EPG_TAG_INVALID_SERIES_EPISODE;
49 m_cStructure->iEpisodePartNumber = EPG_TAG_INVALID_SERIES_EPISODE;
50 }
51 PVREPGTag(const PVREPGTag& epg) : DynamicCStructHdl(epg) {}
91
94
97 void SetUniqueBroadcastId(unsigned int uniqueBroadcastId)
98 {
99 m_cStructure->iUniqueBroadcastId = uniqueBroadcastId;
100 }
101
103 unsigned int GetUniqueBroadcastId() const { return m_cStructure->iUniqueBroadcastId; }
104
107 void SetUniqueChannelId(unsigned int uniqueChannelId)
108 {
109 m_cStructure->iUniqueChannelId = uniqueChannelId;
110 }
111
113 unsigned int GetUniqueChannelId() const { return m_cStructure->iUniqueChannelId; }
114
117 void SetTitle(const std::string& title)
118 {
119 ReallocAndCopyString(&m_cStructure->strTitle, title.c_str());
120 }
121
123 std::string GetTitle() const { return m_cStructure->strTitle ? m_cStructure->strTitle : ""; }
124
127 void SetTitleExtraInfo(const std::string& titleExtraInfo)
128 {
129 ReallocAndCopyString(&m_cStructure->strTitleExtraInfo, titleExtraInfo.c_str());
130 }
131
133 std::string GetTitleExtraInfo() const
134 {
135 return m_cStructure->strTitleExtraInfo ? m_cStructure->strTitleExtraInfo : "";
136 }
137
142 void SetStartTime(time_t startTime) { m_cStructure->startTime = startTime; }
143
145 time_t GetStartTime() const { return m_cStructure->startTime; }
146
151 void SetEndTime(time_t endTime) { m_cStructure->endTime = endTime; }
152
154 time_t GetEndTime() const { return m_cStructure->endTime; }
155
158 void SetPlotOutline(const std::string& plotOutline)
159 {
160 ReallocAndCopyString(&m_cStructure->strPlotOutline, plotOutline.c_str());
161 }
162
164 std::string GetPlotOutline() const
165 {
166 return m_cStructure->strPlotOutline ? m_cStructure->strPlotOutline : "";
167 }
168
171 void SetPlot(const std::string& plot)
172 {
173 ReallocAndCopyString(&m_cStructure->strPlot, plot.c_str());
174 }
175
177 std::string GetPlot() const { return m_cStructure->strPlot ? m_cStructure->strPlot : ""; }
178
181 void SetOriginalTitle(const std::string& originalTitle)
182 {
183 ReallocAndCopyString(&m_cStructure->strOriginalTitle, originalTitle.c_str());
184 }
185
187 std::string GetOriginalTitle() const
188 {
189 return m_cStructure->strOriginalTitle ? m_cStructure->strOriginalTitle : "";
190 }
191
196 void SetCast(const std::string& cast)
197 {
198 ReallocAndCopyString(&m_cStructure->strCast, cast.c_str());
199 }
200
202 std::string GetCast() const { return m_cStructure->strCast ? m_cStructure->strCast : ""; }
203
208 void SetDirector(const std::string& director)
209 {
210 ReallocAndCopyString(&m_cStructure->strDirector, director.c_str());
211 }
212
214 std::string GetDirector() const
215 {
216 return m_cStructure->strDirector ? m_cStructure->strDirector : "";
217 }
218
223 void SetWriter(const std::string& writer)
224 {
225 ReallocAndCopyString(&m_cStructure->strWriter, writer.c_str());
226 }
227
229 std::string GetWriter() const { return m_cStructure->strWriter ? m_cStructure->strWriter : ""; }
230
233 void SetYear(int year) { m_cStructure->iYear = year; }
234
236 int GetYear() const { return m_cStructure->iYear; }
237
240 void SetIMDBNumber(const std::string& IMDBNumber)
241 {
242 ReallocAndCopyString(&m_cStructure->strIMDBNumber, IMDBNumber.c_str());
243 }
244
246 std::string GetIMDBNumber() const
247 {
248 return m_cStructure->strIMDBNumber ? m_cStructure->strIMDBNumber : "";
249 }
250
253 void SetIconPath(const std::string& iconPath)
254 {
255 ReallocAndCopyString(&m_cStructure->strIconPath, iconPath.c_str());
256 }
257
259 std::string GetIconPath() const
260 {
261 return m_cStructure->strIconPath ? m_cStructure->strIconPath : "";
262 }
263
295 void SetGenreType(int genreType) { m_cStructure->iGenreType = genreType; }
296
298 int GetGenreType() const { return m_cStructure->iGenreType; }
299
332 void SetGenreSubType(int genreSubType) { m_cStructure->iGenreSubType = genreSubType; }
333
335 int GetGenreSubType() const { return m_cStructure->iGenreSubType; }
336
354 void SetGenreDescription(const std::string& genreDescription)
355 {
356 ReallocAndCopyString(&m_cStructure->strGenreDescription, genreDescription.c_str());
357 }
358
360 std::string GetGenreDescription() const
361 {
362 return m_cStructure->strGenreDescription ? m_cStructure->strGenreDescription : "";
363 }
364
367 void SetFirstAired(const std::string& firstAired)
368 {
369 ReallocAndCopyString(&m_cStructure->strFirstAired, firstAired.c_str());
370 }
371
373 std::string GetFirstAired() const
374 {
375 return m_cStructure->strFirstAired ? m_cStructure->strFirstAired : "";
376 }
377
380 void SetParentalRating(unsigned int parentalRating)
381 {
382 m_cStructure->iParentalRating = parentalRating;
383 }
384
386 unsigned int GetParentalRating() const { return m_cStructure->iParentalRating; }
387
390 void SetParentalRatingCode(const std::string& parentalRatingCode)
391 {
392 ReallocAndCopyString(&m_cStructure->strParentalRatingCode, parentalRatingCode.c_str());
393 }
394
396 std::string GetParentalRatingCode() const
397 {
398 return m_cStructure->strParentalRatingCode ? m_cStructure->strParentalRatingCode : "";
399 }
400
403 void SetParentalRatingIcon(const std::string& parentalRatingIcon)
404 {
405 ReallocAndCopyString(&m_cStructure->strParentalRatingIcon, parentalRatingIcon.c_str());
406 }
407
409 std::string GetParentalRatingIcon() const
410 {
411 return m_cStructure->strParentalRatingIcon ? m_cStructure->strParentalRatingIcon : "";
412 }
413
416 void SetParentalRatingSource(const std::string& parentalRatingSource)
417 {
418 //m_parentalRatingSource = parentalRatingSource;
419 ReallocAndCopyString(&m_cStructure->strParentalRatingSource, parentalRatingSource.c_str());
420 }
421
423 std::string GetParentalRatingSource() const
424 {
425 return m_cStructure->strParentalRatingSource ? m_cStructure->strParentalRatingSource : "";
426 }
427
430 void SetStarRating(int starRating) { m_cStructure->iStarRating = starRating; }
431
433 int GetStarRating() const { return m_cStructure->iStarRating; }
434
437 void SetSeriesNumber(int seriesNumber) { m_cStructure->iSeriesNumber = seriesNumber; }
438
440 int GetSeriesNumber() const { return m_cStructure->iSeriesNumber; }
441
444 void SetEpisodeNumber(int episodeNumber) { m_cStructure->iEpisodeNumber = episodeNumber; }
445
447 int GetEpisodeNumber() const { return m_cStructure->iEpisodeNumber; }
448
451 void SetEpisodePartNumber(int episodePartNumber)
452 {
453 m_cStructure->iEpisodePartNumber = episodePartNumber;
454 }
455
457 int GetEpisodePartNumber() const { return m_cStructure->iEpisodePartNumber; }
458
461 void SetEpisodeName(const std::string& episodeName)
462 {
463 ReallocAndCopyString(&m_cStructure->strEpisodeName, episodeName.c_str());
464 }
465
467 std::string GetEpisodeName() const
468 {
469 return m_cStructure->strEpisodeName ? m_cStructure->strEpisodeName : "";
470 }
471
481 void SetFlags(unsigned int flags) { m_cStructure->iFlags = flags; }
482
484 unsigned int GetFlags() const { return m_cStructure->iFlags; }
485
488 void SetSeriesLink(const std::string& seriesLink)
489 {
490 ReallocAndCopyString(&m_cStructure->strSeriesLink, seriesLink.c_str());
491 }
492
494 std::string GetSeriesLink() const
495 {
496 return m_cStructure->strSeriesLink ? m_cStructure->strSeriesLink : "";
497 }
498
500
501 static void AllocResources(const EPG_TAG* source, EPG_TAG* target)
502 {
503 target->strTitle = AllocAndCopyString(source->strTitle);
504 target->strTitleExtraInfo = AllocAndCopyString(source->strTitleExtraInfo);
505 target->strPlotOutline = AllocAndCopyString(source->strPlotOutline);
506 target->strPlot = AllocAndCopyString(source->strPlot);
507 target->strOriginalTitle = AllocAndCopyString(source->strOriginalTitle);
508 target->strCast = AllocAndCopyString(source->strCast);
509 target->strDirector = AllocAndCopyString(source->strDirector);
510 target->strWriter = AllocAndCopyString(source->strWriter);
511 target->strIMDBNumber = AllocAndCopyString(source->strIMDBNumber);
512 target->strIconPath = AllocAndCopyString(source->strIconPath);
513 target->strGenreDescription = AllocAndCopyString(source->strGenreDescription);
514 target->strParentalRatingCode = AllocAndCopyString(source->strParentalRatingCode);
515 target->strParentalRatingIcon = AllocAndCopyString(source->strParentalRatingIcon);
516 target->strParentalRatingSource = AllocAndCopyString(source->strParentalRatingSource);
517 target->strEpisodeName = AllocAndCopyString(source->strEpisodeName);
518 target->strSeriesLink = AllocAndCopyString(source->strSeriesLink);
519 target->strFirstAired = AllocAndCopyString(source->strFirstAired);
520 }
521
522 static void FreeResources(EPG_TAG* target)
523 {
524 FreeString(target->strTitle);
525 FreeString(target->strTitleExtraInfo);
526 FreeString(target->strPlotOutline);
527 FreeString(target->strPlot);
528 FreeString(target->strOriginalTitle);
529 FreeString(target->strCast);
530 FreeString(target->strDirector);
531 FreeString(target->strWriter);
532 FreeString(target->strIMDBNumber);
533 FreeString(target->strIconPath);
534 FreeString(target->strGenreDescription);
535 FreeString(target->strParentalRatingCode);
536 FreeString(target->strParentalRatingIcon);
537 FreeString(target->strParentalRatingSource);
538 FreeString(target->strEpisodeName);
539 FreeString(target->strSeriesLink);
540 FreeString(target->strFirstAired);
541 }
542
543private:
544 PVREPGTag(const EPG_TAG* epg) : DynamicCStructHdl(epg) {}
545 PVREPGTag(EPG_TAG* epg) : DynamicCStructHdl(epg) {}
546};
548//------------------------------------------------------------------------------
549
550//==============================================================================
560{
561public:
563 PVREPGTagsResultSet() = delete;
564 PVREPGTagsResultSet(const AddonInstance_PVR* instance, PVR_HANDLE handle)
565 : m_instance(instance), m_handle(handle)
566 {
567 }
572
577 {
578 m_instance->toKodi->TransferEpgEntry(m_instance->toKodi->kodiInstance, m_handle, tag);
579 }
580
582
583private:
584 const AddonInstance_PVR* m_instance = nullptr;
585 const PVR_HANDLE m_handle;
586};
588//------------------------------------------------------------------------------
589
590} /* namespace addon */
591} /* namespace kodi */
592
593#endif /* __cplusplus */
Definition AddonBase.h:288
Definition EPG.h:40
unsigned int GetUniqueBroadcastId() const
To get with SetUniqueBroadcastId changed values.
Definition EPG.h:103
void SetUniqueBroadcastId(unsigned int uniqueBroadcastId)
required Identifier for this event. Event uids must be unique for a channel. Valid uids must be great...
Definition EPG.h:97
std::string GetParentalRatingIcon() const
To get with SetParentalRatingIcon changed values.
Definition EPG.h:409
void SetGenreSubType(int genreSubType)
optional Genre sub type.
Definition EPG.h:332
void SetEpisodeNumber(int episodeNumber)
optional Episode number.
Definition EPG.h:444
unsigned int GetParentalRating() const
To get with SetParentalRating changed values.
Definition EPG.h:386
std::string GetIMDBNumber() const
To get with SetIMDBNumber changed values.
Definition EPG.h:246
int GetYear() const
To get with SetYear changed values.
Definition EPG.h:236
void SetStartTime(time_t startTime)
required Start time in UTC.
Definition EPG.h:142
void SetCast(const std::string &cast)
optional Cast name(s).
Definition EPG.h:196
std::string GetTitleExtraInfo() const
To get with SetTitleExtraInfo changed values.
Definition EPG.h:133
void SetFirstAired(const std::string &firstAired)
optional First aired in UTC.
Definition EPG.h:367
std::string GetPlotOutline() const
To get with SetPlotOutline changed values.
Definition EPG.h:164
std::string GetParentalRatingSource() const
To get with SetParentalRatingSource changed values.
Definition EPG.h:423
void SetSeriesNumber(int seriesNumber)
optional Series number.
Definition EPG.h:437
void SetWriter(const std::string &writer)
optional Writer name(s).
Definition EPG.h:223
void SetTitle(const std::string &title)
required This event's title.
Definition EPG.h:117
std::string GetFirstAired() const
To get with SetFirstAired changed values.
Definition EPG.h:373
void SetFlags(unsigned int flags)
optional Bit field of independent flags associated with the EPG entry.
Definition EPG.h:481
void SetEpisodeName(const std::string &episodeName)
optional Episode name.
Definition EPG.h:461
void SetSeriesLink(const std::string &seriesLink)
optional Series link for this event.
Definition EPG.h:488
time_t GetEndTime() const
To get with SetEndTime changed values.
Definition EPG.h:154
void SetIconPath(const std::string &iconPath)
optional Icon path.
Definition EPG.h:253
unsigned int GetUniqueChannelId() const
To get with SetUniqueChannelId changed values.
Definition EPG.h:113
std::string GetCast() const
To get with SetCast changed values.
Definition EPG.h:202
void SetParentalRatingCode(const std::string &parentalRatingCode)
optional This event's parental rating code.
Definition EPG.h:390
void SetOriginalTitle(const std::string &originalTitle)
optional Original title.
Definition EPG.h:181
int GetEpisodePartNumber() const
To get with SetEpisodePartNumber changed values.
Definition EPG.h:457
void SetPlotOutline(const std::string &plotOutline)
optional Plot outline name.
Definition EPG.h:158
std::string GetOriginalTitle() const
To get with SetOriginalTitle changed values.
Definition EPG.h:187
int GetStarRating() const
To get with SetStarRating changed values.
Definition EPG.h:433
std::string GetTitle() const
To get with SetTitle changed values.
Definition EPG.h:123
std::string GetEpisodeName() const
To get with SetEpisodeName changed values.
Definition EPG.h:467
std::string GetGenreDescription() const
To get with SetGenreDescription changed values.
Definition EPG.h:360
std::string GetDirector() const
To get with SetDirector changed values.
Definition EPG.h:214
void SetStarRating(int starRating)
optional Star rating.
Definition EPG.h:430
void SetParentalRatingIcon(const std::string &parentalRatingIcon)
optional This event's parental rating icon.
Definition EPG.h:403
int GetSeriesNumber() const
To get with SetSeriesNumber changed values.
Definition EPG.h:440
std::string GetPlot() const
To get with GetPlot changed values.
Definition EPG.h:177
time_t GetStartTime() const
To get with SetStartTime changed values.
Definition EPG.h:145
void SetDirector(const std::string &director)
optional Director name(s).
Definition EPG.h:208
std::string GetParentalRatingCode() const
To get with SetParentalRatingCode changed values.
Definition EPG.h:396
std::string GetWriter() const
To get with SetDirector changed values.
Definition EPG.h:229
void SetEpisodePartNumber(int episodePartNumber)
optional Episode part number.
Definition EPG.h:451
int GetEpisodeNumber() const
To get with SetEpisodeNumber changed values.
Definition EPG.h:447
void SetTitleExtraInfo(const std::string &titleExtraInfo)
optional This event's title extra information.
Definition EPG.h:127
void SetGenreType(int genreType)
optional Genre type.
Definition EPG.h:295
std::string GetIconPath() const
To get with SetIconPath changed values.
Definition EPG.h:259
void SetYear(int year)
optional Year.
Definition EPG.h:233
unsigned int GetFlags() const
To get with SetFlags changed values.
Definition EPG.h:484
void SetUniqueChannelId(unsigned int uniqueChannelId)
required Unique identifier of the channel this event belongs to.
Definition EPG.h:107
int GetGenreType() const
To get with SetGenreType changed values.
Definition EPG.h:298
int GetGenreSubType() const
To get with SetGenreSubType changed values.
Definition EPG.h:335
void SetPlot(const std::string &plot)
optional Plot name.
Definition EPG.h:171
void SetGenreDescription(const std::string &genreDescription)
optional genre. Will be used only when genreType == EPG_GENRE_USE_STRING or genreSubType == EPG_GENR...
Definition EPG.h:354
void SetParentalRatingSource(const std::string &parentalRatingSource)
optional The event's parental rating source.
Definition EPG.h:416
void SetEndTime(time_t endTime)
required End time in UTC.
Definition EPG.h:151
void SetParentalRating(unsigned int parentalRating)
optional Parental rating.
Definition EPG.h:380
void SetIMDBNumber(const std::string &IMDBNumber)
optional IMDB identification number.
Definition EPG.h:240
std::string GetSeriesLink() const
To get with SetSeriesLink changed values.
Definition EPG.h:494
void Add(const kodi::addon::PVREPGTag &tag)
To add and give content from addon to Kodi on related call.
Definition EPG.h:576
#define EPG_TAG_INVALID_SERIES_EPISODE
Special kodi::addon::PVREPGTag::SetSeriesNumber(), kodi::addon::PVREPGTag::SetEpisodeNumber() and kod...
Definition pvr_epg.h:582
Definition pvr.h:362
"C" PVR add-on channel group member.
Definition pvr_epg.h:623