Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Recordings.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 5 - PVR recordings
16#ifdef __cplusplus
17
18namespace kodi
19{
20namespace addon
21{
22
23//==============================================================================
38class PVRRecording : public DynamicCStructHdl<PVRRecording, PVR_RECORDING>
39{
40 friend class CInstancePVRClient;
41
42public:
45 {
46 m_cStructure->iSeriesNumber = PVR_RECORDING_INVALID_SERIES_EPISODE;
47 m_cStructure->iEpisodeNumber = PVR_RECORDING_INVALID_SERIES_EPISODE;
48 m_cStructure->iEpisodePartNumber = PVR_RECORDING_INVALID_SERIES_EPISODE;
49 m_cStructure->iDuration = PVR_RECORDING_VALUE_NOT_AVAILABLE;
50 m_cStructure->iPriority = PVR_RECORDING_VALUE_NOT_AVAILABLE;
51 m_cStructure->iLifetime = PVR_RECORDING_VALUE_NOT_AVAILABLE;
52 m_cStructure->iGenreType = PVR_RECORDING_VALUE_NOT_AVAILABLE;
53 m_cStructure->iGenreSubType = PVR_RECORDING_VALUE_NOT_AVAILABLE;
54 m_cStructure->iPlayCount = PVR_RECORDING_VALUE_NOT_AVAILABLE;
55 m_cStructure->iLastPlayedPosition = PVR_RECORDING_VALUE_NOT_AVAILABLE;
56 m_cStructure->iChannelUid = PVR_RECORDING_VALUE_NOT_AVAILABLE;
57 m_cStructure->channelType = PVR_RECORDING_CHANNEL_TYPE_UNKNOWN;
58 m_cStructure->sizeInBytes = PVR_RECORDING_VALUE_NOT_AVAILABLE;
59 m_cStructure->iClientProviderUid = PVR_PROVIDER_INVALID_UID;
60 }
61 PVRRecording(const PVRRecording& recording) : DynamicCStructHdl(recording) {}
107
110
113 void SetRecordingId(const std::string& recordingId)
114 {
115 ReallocAndCopyString(&m_cStructure->strRecordingId, recordingId.c_str());
116 }
117
119 std::string GetRecordingId() const
120 {
121 return m_cStructure->strRecordingId ? m_cStructure->strRecordingId : "";
122 }
123
126 void SetTitle(const std::string& title)
127 {
128 ReallocAndCopyString(&m_cStructure->strTitle, title.c_str());
129 }
130
132 std::string GetTitle() const { return m_cStructure->strTitle ? m_cStructure->strTitle : ""; }
133
136 void SetTitleExtraInfo(const std::string& titleExtraInfo)
137 {
138 ReallocAndCopyString(&m_cStructure->strTitleExtraInfo, titleExtraInfo.c_str());
139 }
140
142 std::string GetTitleExtraInfo() const
143 {
144 return m_cStructure->strTitleExtraInfo ? m_cStructure->strTitleExtraInfo : "";
145 }
146
149 void SetEpisodeName(const std::string& episodeName)
150 {
151 ReallocAndCopyString(&m_cStructure->strEpisodeName, episodeName.c_str());
152 }
153
155 std::string GetEpisodeName() const
156 {
157 return m_cStructure->strEpisodeName ? m_cStructure->strEpisodeName : "";
158 }
159
164 void SetSeriesNumber(int seriesNumber) { m_cStructure->iSeriesNumber = seriesNumber; }
165
167 int GetSeriesNumber() const { return m_cStructure->iSeriesNumber; }
168
173 void SetEpisodeNumber(int episodeNumber) { m_cStructure->iEpisodeNumber = episodeNumber; }
174
176 int GetEpisodeNumber() const { return m_cStructure->iEpisodeNumber; }
177
180 void SetEpisodePartNumber(int episodePartNumber)
181 {
182 m_cStructure->iEpisodePartNumber = episodePartNumber;
183 }
184
186 int GetEpisodePartNumber() const { return m_cStructure->iEpisodePartNumber; }
187
193 void SetYear(int year) { m_cStructure->iYear = year; }
194
196 int GetYear() const { return m_cStructure->iYear; }
197
201 void SetDirectory(const std::string& directory)
202 {
203 ReallocAndCopyString(&m_cStructure->strDirectory, directory.c_str());
204 }
205
207 std::string GetDirectory() const
208 {
209 return m_cStructure->strDirectory ? m_cStructure->strDirectory : "";
210 }
211
214 void SetPlotOutline(const std::string& plotOutline)
215 {
216 ReallocAndCopyString(&m_cStructure->strPlotOutline, plotOutline.c_str());
217 }
218
220 std::string GetPlotOutline() const
221 {
222 return m_cStructure->strPlotOutline ? m_cStructure->strPlotOutline : "";
223 }
224
227 void SetPlot(const std::string& plot)
228 {
229 ReallocAndCopyString(&m_cStructure->strPlot, plot.c_str());
230 }
231
233 std::string GetPlot() const { return m_cStructure->strPlot ? m_cStructure->strPlot : ""; }
234
237 void SetChannelName(const std::string& channelName)
238 {
239 ReallocAndCopyString(&m_cStructure->strChannelName, channelName.c_str());
240 }
241
243 std::string GetChannelName() const
244 {
245 return m_cStructure->strChannelName ? m_cStructure->strChannelName : "";
246 }
247
250 void SetIconPath(const std::string& iconPath)
251 {
252 ReallocAndCopyString(&m_cStructure->strIconPath, iconPath.c_str());
253 }
254
256 std::string GetIconPath() const
257 {
258 return m_cStructure->strIconPath ? m_cStructure->strIconPath : "";
259 }
260
263 void SetThumbnailPath(const std::string& thumbnailPath)
264 {
265 ReallocAndCopyString(&m_cStructure->strThumbnailPath, thumbnailPath.c_str());
266 }
267
269 std::string GetThumbnailPath() const
270 {
271 return m_cStructure->strThumbnailPath ? m_cStructure->strThumbnailPath : "";
272 }
273
276 void SetFanartPath(const std::string& fanartPath)
277 {
278 ReallocAndCopyString(&m_cStructure->strFanartPath, fanartPath.c_str());
279 }
280
282 std::string GetFanartPath() const
283 {
284 return m_cStructure->strFanartPath ? m_cStructure->strFanartPath : "";
285 }
286
289 void SetRecordingTime(time_t recordingTime) { m_cStructure->recordingTime = recordingTime; }
290
292 time_t GetRecordingTime() const { return m_cStructure->recordingTime; }
293
296 void SetDuration(int duration) { m_cStructure->iDuration = duration; }
297
299 int GetDuration() const { return m_cStructure->iDuration; }
300
303 void SetPriority(int priority) { m_cStructure->iPriority = priority; }
304
306 int GetPriority() const { return m_cStructure->iPriority; }
307
310 void SetLifetime(int lifetime) { m_cStructure->iLifetime = lifetime; }
311
313 int GetLifetime() const { return m_cStructure->iLifetime; }
314
342 void SetGenreType(int genreType) { m_cStructure->iGenreType = genreType; }
343
345 int GetGenreType() const { return m_cStructure->iGenreType; }
346
377 void SetGenreSubType(int genreSubType) { m_cStructure->iGenreSubType = genreSubType; }
378
380 int GetGenreSubType() const { return m_cStructure->iGenreSubType; }
381
402 void SetGenreDescription(const std::string& genreDescription)
403 {
404 ReallocAndCopyString(&m_cStructure->strGenreDescription, genreDescription.c_str());
405 }
406
408 std::string GetGenreDescription() const
409 {
410 return m_cStructure->strGenreDescription ? m_cStructure->strGenreDescription : "";
411 }
412
415 void SetPlayCount(int playCount) { m_cStructure->iPlayCount = playCount; }
416
418 int GetPlayCount() const { return m_cStructure->iPlayCount; }
419
422 void SetLastPlayedPosition(int lastPlayedPosition)
423 {
424 m_cStructure->iLastPlayedPosition = lastPlayedPosition;
425 }
426
428 int GetLastPlayedPosition() const { return m_cStructure->iLastPlayedPosition; }
429
432 void SetIsDeleted(int isDeleted) { m_cStructure->bIsDeleted = isDeleted; }
433
435 int GetIsDeleted() const { return m_cStructure->bIsDeleted; }
436
439 void SetEPGEventId(unsigned int epgEventId) { m_cStructure->iEpgEventId = epgEventId; }
440
442 unsigned int GetEPGEventId() const { return m_cStructure->iEpgEventId; }
443
447 void SetChannelUid(int channelUid) { m_cStructure->iChannelUid = channelUid; }
448
450 int GetChannelUid() const { return m_cStructure->iChannelUid; }
451
467 {
468 m_cStructure->channelType = channelType;
469 }
470
472 PVR_RECORDING_CHANNEL_TYPE GetChannelType() const { return m_cStructure->channelType; }
473
487 void SetFirstAired(const std::string& firstAired)
488 {
489 ReallocAndCopyString(&m_cStructure->strFirstAired, firstAired.c_str());
490 }
491
493 std::string GetFirstAired() const
494 {
495 return m_cStructure->strFirstAired ? m_cStructure->strFirstAired : "";
496 }
497
508 void SetFlags(unsigned int flags) { m_cStructure->iFlags = flags; }
509
511 unsigned int GetFlags() const { return m_cStructure->iFlags; }
512
515 void SetSizeInBytes(int64_t sizeInBytes) { m_cStructure->sizeInBytes = sizeInBytes; }
516
518 int64_t GetSizeInBytes() const { return m_cStructure->sizeInBytes; }
520
525 void SetClientProviderUid(int iClientProviderUid)
526 {
527 m_cStructure->iClientProviderUid = iClientProviderUid;
528 }
529
531 int GetClientProviderUid() const { return m_cStructure->iClientProviderUid; }
532
535 void SetProviderName(const std::string& providerName)
536 {
537 ReallocAndCopyString(&m_cStructure->strProviderName, providerName.c_str());
538 }
539
541 std::string GetProviderName() const
542 {
543 return m_cStructure->strProviderName ? m_cStructure->strProviderName : "";
544 }
545
548 void SetParentalRating(unsigned int iParentalRating)
549 {
550 m_cStructure->iParentalRating = iParentalRating;
551 }
552
554 unsigned int GetParentalRating() const { return m_cStructure->iParentalRating; }
555
558 void SetParentalRatingCode(const std::string& ratingCode)
559 {
560 ReallocAndCopyString(&m_cStructure->strParentalRatingCode, ratingCode.c_str());
561 }
562
564 std::string GetParentalRatingCode() const
565 {
566 return m_cStructure->strParentalRatingCode ? m_cStructure->strParentalRatingCode : "";
567 }
568
571 void SetParentalRatingIcon(const std::string& ratingIcon)
572 {
573 ReallocAndCopyString(&m_cStructure->strParentalRatingIcon, ratingIcon.c_str());
574 }
575
577 std::string GetParentalRatingIcon() const
578 {
579 return m_cStructure->strParentalRatingIcon ? m_cStructure->strParentalRatingIcon : "";
580 }
581
584 void SetParentalRatingSource(const std::string& ratingSource)
585 {
586 ReallocAndCopyString(&m_cStructure->strParentalRatingSource, ratingSource.c_str());
587 }
588
590 std::string GetParentalRatingSource() const
591 {
592 return m_cStructure->strParentalRatingSource ? m_cStructure->strParentalRatingSource : "";
593 }
594
595 static void AllocResources(const PVR_RECORDING* source, PVR_RECORDING* target)
596 {
597 target->strRecordingId = AllocAndCopyString(source->strRecordingId);
598 target->strTitle = AllocAndCopyString(source->strTitle);
599 target->strTitleExtraInfo = AllocAndCopyString(source->strTitleExtraInfo);
600 target->strEpisodeName = AllocAndCopyString(source->strEpisodeName);
601 target->strDirectory = AllocAndCopyString(source->strDirectory);
602 target->strPlotOutline = AllocAndCopyString(source->strPlotOutline);
603 target->strPlot = AllocAndCopyString(source->strPlot);
604 target->strGenreDescription = AllocAndCopyString(source->strGenreDescription);
605 target->strChannelName = AllocAndCopyString(source->strChannelName);
606 target->strIconPath = AllocAndCopyString(source->strIconPath);
607 target->strThumbnailPath = AllocAndCopyString(source->strThumbnailPath);
608 target->strFanartPath = AllocAndCopyString(source->strFanartPath);
609 target->strFirstAired = AllocAndCopyString(source->strFirstAired);
610 target->strProviderName = AllocAndCopyString(source->strProviderName);
611 target->strParentalRatingCode = AllocAndCopyString(source->strParentalRatingCode);
612 target->strParentalRatingIcon = AllocAndCopyString(source->strParentalRatingIcon);
613 target->strParentalRatingSource = AllocAndCopyString(source->strParentalRatingSource);
614 }
615
616 static void FreeResources(PVR_RECORDING* target)
617 {
618 FreeString(target->strRecordingId);
619 FreeString(target->strTitle);
620 FreeString(target->strTitleExtraInfo);
621 FreeString(target->strEpisodeName);
622 FreeString(target->strDirectory);
623 FreeString(target->strPlotOutline);
624 FreeString(target->strPlot);
625 FreeString(target->strGenreDescription);
626 FreeString(target->strChannelName);
627 FreeString(target->strIconPath);
628 FreeString(target->strThumbnailPath);
629 FreeString(target->strFanartPath);
630 FreeString(target->strFirstAired);
631 FreeString(target->strProviderName);
632 FreeString(target->strParentalRatingCode);
633 FreeString(target->strParentalRatingIcon);
634 FreeString(target->strParentalRatingSource);
635 }
636
637private:
638 PVRRecording(const PVR_RECORDING* recording) : DynamicCStructHdl(recording) {}
639 PVRRecording(PVR_RECORDING* recording) : DynamicCStructHdl(recording) {}
640};
642//------------------------------------------------------------------------------
643
644//==============================================================================
654{
655public:
657 PVRRecordingsResultSet() = delete;
658 PVRRecordingsResultSet(const AddonInstance_PVR* instance, PVR_HANDLE handle)
659 : m_instance(instance), m_handle(handle)
660 {
661 }
666
671 {
672 m_instance->toKodi->TransferRecordingEntry(m_instance->toKodi->kodiInstance, m_handle, tag);
673 }
674
676
677private:
678 const AddonInstance_PVR* m_instance = nullptr;
679 const PVR_HANDLE m_handle;
680};
682//------------------------------------------------------------------------------
683
684} /* namespace addon */
685} /* namespace kodi */
686
687#endif /* __cplusplus */
Definition AddonBase.h:288
Definition Recordings.h:39
std::string GetProviderName() const
To get with SetProviderName changed values.
Definition Recordings.h:541
std::string GetParentalRatingIcon() const
To get with SetParentalRatingIcon changed values.
Definition Recordings.h:577
void SetParentalRatingCode(const std::string &ratingCode)
optional Parental rating code for this recording.
Definition Recordings.h:558
unsigned int GetParentalRating() const
To get with SetParentalRating changed values.
Definition Recordings.h:554
void SetParentalRating(unsigned int iParentalRating)
optional Age rating for the recording.
Definition Recordings.h:548
std::string GetParentalRatingSource() const
To get with SetParentalRatingSource changed values.
Definition Recordings.h:590
void SetProviderName(const std::string &providerName)
optional Name for the provider of this channel.
Definition Recordings.h:535
std::string GetParentalRatingCode() const
To get with SetParentalRatingCode changed values.
Definition Recordings.h:564
void SetClientProviderUid(int iClientProviderUid)
optional Unique identifier of the provider this channel belongs to.
Definition Recordings.h:525
void SetParentalRatingIcon(const std::string &ratingIcon)
optional Parental rating icon for this recording.
Definition Recordings.h:571
int GetClientProviderUid() const
To get with SetClientProviderUid changed values.
Definition Recordings.h:531
void SetParentalRatingSource(const std::string &ratingSource)
optional Parental rating source for this recording.
Definition Recordings.h:584
Definition Recordings.h:654
#define PVR_PROVIDER_INVALID_UID
Denotes that no provider uid is available.
Definition pvr_providers.h:28
PVR_RECORDING_CHANNEL_TYPE
Definition pvr_recordings.h:90
@ PVR_RECORDING_CHANNEL_TYPE_UNKNOWN
0 : Unknown type.
Definition pvr_recordings.h:92
int64_t GetSizeInBytes() const
To get with SetSizeInBytes changed values.
Definition Recordings.h:518
void SetChannelUid(int channelUid)
optional Unique identifier of the channel for this recording. PVR_CHANNEL_INVALID_UID denotes that ch...
Definition Recordings.h:447
void SetGenreSubType(int genreSubType)
optional Genre sub type.
Definition Recordings.h:377
PVR_RECORDING_CHANNEL_TYPE GetChannelType() const
To get with SetChannelType changed values.
Definition Recordings.h:472
void SetChannelName(const std::string &channelName)
optional Channel name.
Definition Recordings.h:237
void SetEpisodeNumber(int episodeNumber)
optional Eepisode number within the "iSeriesNumber" season.
Definition Recordings.h:173
void SetPriority(int priority)
optional Priority of this recording (from 0 - 100).
Definition Recordings.h:303
void SetDuration(int duration)
optional Duration of the recording in seconds.
Definition Recordings.h:296
int GetYear() const
To get with SetYear changed values.
Definition Recordings.h:196
std::string GetRecordingId() const
To get with SetRecordingId changed values.
Definition Recordings.h:119
std::string GetTitleExtraInfo() const
To get with SetTitleExtraInfo changed values.
Definition Recordings.h:142
void SetFirstAired(const std::string &firstAired)
optional First aired date of this recording.
Definition Recordings.h:487
#define PVR_RECORDING_VALUE_NOT_AVAILABLE
Value where set in background to inform that related part not used.
Definition pvr_recordings.h:78
std::string GetPlotOutline() const
To get with SetPlotOutline changed values.
Definition Recordings.h:220
void SetSeriesNumber(int seriesNumber)
optional Series number (usually called season).
Definition Recordings.h:164
void SetTitle(const std::string &title)
required The title of this recording.
Definition Recordings.h:126
std::string GetChannelName() const
To get with SetChannelName changed values.
Definition Recordings.h:243
std::string GetFirstAired() const
To get with SetFirstAired changed values.
Definition Recordings.h:493
int GetIsDeleted() const
To get with SetIsDeleted changed values.
Definition Recordings.h:435
void SetFlags(unsigned int flags)
optional Bit field of independent flags associated with the recording.
Definition Recordings.h:508
void SetEPGEventId(unsigned int epgEventId)
optional EPG event id associated with this recording. Valid ids must be greater than EPG_TAG_INVALID_...
Definition Recordings.h:439
void SetEpisodeName(const std::string &episodeName)
optional Episode name (also known as subtitle).
Definition Recordings.h:149
void SetLastPlayedPosition(int lastPlayedPosition)
optional Last played position of this recording on the client.
Definition Recordings.h:422
time_t GetRecordingTime() const
To get with SetRecordingTime changed values.
Definition Recordings.h:292
void SetIconPath(const std::string &iconPath)
optional Channel logo (icon) path.
Definition Recordings.h:250
std::string GetDirectory() const
To get with SetDirectory changed values.
Definition Recordings.h:207
int GetEpisodePartNumber() const
To get with SetEpisodePartNumber changed values.
Definition Recordings.h:186
void SetPlotOutline(const std::string &plotOutline)
optional Plot outline name.
Definition Recordings.h:214
int GetPriority() const
To get with SetPriority changed values.
Definition Recordings.h:306
std::string GetTitle() const
To get with SetTitle changed values.
Definition Recordings.h:132
void SetDirectory(const std::string &directory)
optional
Definition Recordings.h:201
std::string GetEpisodeName() const
To get with SetEpisodeName changed values.
Definition Recordings.h:155
std::string GetGenreDescription() const
To get with SetGenreDescription changed values.
Definition Recordings.h:408
int GetDuration() const
To get with SetDuration changed values.
Definition Recordings.h:299
void SetThumbnailPath(const std::string &thumbnailPath)
optional Thumbnail path.
Definition Recordings.h:263
std::string GetFanartPath() const
To get with SetFanartPath changed values.
Definition Recordings.h:282
int GetLastPlayedPosition() const
To get with SetLastPlayedPosition changed values.
Definition Recordings.h:428
int GetSeriesNumber() const
To get with SetSeriesNumber changed values.
Definition Recordings.h:167
void SetLifetime(int lifetime)
optional Life time in days of this recording.
Definition Recordings.h:310
std::string GetPlot() const
To get with SetPlot changed values.
Definition Recordings.h:233
int GetLifetime() const
To get with SetLifetime changed values.
Definition Recordings.h:313
void SetPlayCount(int playCount)
optional Play count of this recording on the client.
Definition Recordings.h:415
unsigned int GetEPGEventId() const
To get with SetEPGEventId changed values.
Definition Recordings.h:442
void SetEpisodePartNumber(int episodePartNumber)
optional Episode part number.
Definition Recordings.h:180
void SetFanartPath(const std::string &fanartPath)
optional Fanart path.
Definition Recordings.h:276
int GetEpisodeNumber() const
To get with SetEpisodeNumber changed values.
Definition Recordings.h:176
void SetSizeInBytes(int64_t sizeInBytes)
optional Size of the recording in bytes.
Definition Recordings.h:515
void SetTitleExtraInfo(const std::string &titleExtraInfo)
optional The title extra information of this recording.
Definition Recordings.h:136
void SetGenreType(int genreType)
optional Genre type.
Definition Recordings.h:342
#define PVR_RECORDING_INVALID_SERIES_EPISODE
Special kodi::addon::PVRRecording::SetSeriesNumber() and kodi::addon::PVRRecording::SetEpisodeNumber(...
Definition pvr_recordings.h:70
std::string GetIconPath() const
To get with SetIconPath changed values.
Definition Recordings.h:256
std::string GetThumbnailPath() const
To get with SetThumbnailPath changed values.
Definition Recordings.h:269
void SetYear(int year)
optional Year of first release (use to identify a specific movie re-make) / first airing for TV shows...
Definition Recordings.h:193
unsigned int GetFlags() const
To get with SetFlags changed values.
Definition Recordings.h:511
void SetRecordingId(const std::string &recordingId)
required Unique identifier of the recording on the client.
Definition Recordings.h:113
void SetRecordingTime(time_t recordingTime)
optional Start time of the recording.
Definition Recordings.h:289
int GetGenreType() const
To get with SetGenreType changed values.
Definition Recordings.h:345
void SetIsDeleted(int isDeleted)
optional Shows this recording is deleted and can be undelete.
Definition Recordings.h:432
int GetGenreSubType() const
To get with SetGenreSubType changed values.
Definition Recordings.h:380
int GetPlayCount() const
To get with SetPlayCount changed values.
Definition Recordings.h:418
void SetPlot(const std::string &plot)
optional Plot name.
Definition Recordings.h:227
void SetGenreDescription(const std::string &genreDescription)
optional To set own genre description name.
Definition Recordings.h:402
void SetChannelType(PVR_RECORDING_CHANNEL_TYPE channelType)
optional Channel type.
Definition Recordings.h:466
int GetChannelUid() const
To get with SetChannelUid changed values.
Definition Recordings.h:450
void Add(const kodi::addon::PVRRecording &tag)
To add and give content from addon to Kodi on related call.
Definition Recordings.h:670
Definition pvr.h:362
"C" PVR add-on recording.
Definition pvr_recordings.h:111