Skip to content

Commit

Permalink
Add parental rating fields to EPG and Recordings (Piers). (#164)
Browse files Browse the repository at this point in the history
Co-authored-by: Kai Sommerfeld <[email protected]>
  • Loading branch information
DeltaMikeCharlie and ksooo authored Aug 21, 2024
1 parent 6afe978 commit e2fc15b
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 3 deletions.
79 changes: 79 additions & 0 deletions pvr.demo/PVRDemoAddonSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
<icon></icon>
<genretype>32</genretype>
<genresubtype>0</genresubtype>
<parentalrating>11</parentalrating>
</entry>
<entry>
<broadcastid>300</broadcastid>
Expand All @@ -372,6 +373,9 @@
<icon></icon>
<genretype>48</genretype>
<genresubtype>0</genresubtype>
<parentalratingcode>CC-DD</parentalratingcode>
<parentalratingicon>data/cc-dd.png</parentalratingicon>
<parentalratingsource>ABC</parentalratingsource>
</entry>
<entry>
<broadcastid>400</broadcastid>
Expand All @@ -386,6 +390,10 @@
<icon></icon>
<genretype>64</genretype>
<genresubtype>0</genresubtype>
<parentalrating>9</parentalrating>
<parentalratingcode>A</parentalratingcode>
<parentalratingicon>data/a.png</parentalratingicon>
<parentalratingsource>ABC</parentalratingsource>
</entry>
<entry>
<broadcastid>500</broadcastid>
Expand All @@ -398,6 +406,10 @@
<icon></icon>
<genretype>80</genretype>
<genresubtype>0</genresubtype>
<parentalrating>11</parentalrating>
<parentalratingcode>BB</parentalratingcode>
<parentalratingicon>data/bb.png</parentalratingicon>
<parentalratingsource>ABCD</parentalratingsource>
</entry>
<entry>
<broadcastid>600</broadcastid>
Expand Down Expand Up @@ -425,6 +437,10 @@
<episodepart>5</episodepart>
<genretype>112</genretype>
<genresubtype>0</genresubtype>
<parentalrating>15</parentalrating>
<parentalratingcode>EEE</parentalratingcode>
<parentalratingicon>data/eee.png</parentalratingicon>
<parentalratingsource>ABCD</parentalratingsource>
</entry>
<entry>
<broadcastid>800</broadcastid>
Expand All @@ -440,6 +456,10 @@
<episodetitle>Demo EPG entry 8 Episode Part Title</episodetitle>
<genretype>128</genretype>
<genresubtype>0</genresubtype>
<parentalrating>9</parentalrating>
<parentalratingcode>A</parentalratingcode>
<parentalratingicon>data/a.png</parentalratingicon>
<parentalratingsource>ABC</parentalratingsource>
</entry>
<entry>
<broadcastid>900</broadcastid>
Expand All @@ -452,6 +472,9 @@
<icon></icon>
<genretype>144</genretype>
<genresubtype>0</genresubtype>
<parentalrating>11</parentalrating>
<parentalratingcode>BB</parentalratingcode>
<parentalratingsource>ABC</parentalratingsource>
</entry>
<entry>
<broadcastid>1100</broadcastid>
Expand All @@ -464,6 +487,9 @@
<icon></icon>
<genretype>176</genretype>
<genresubtype>0</genresubtype>
<parentalrating>15</parentalrating>
<parentalratingcode>EEE</parentalratingcode>
<parentalratingicon>data/eee.png</parentalratingicon>
</entry>

<entry>
Expand All @@ -477,6 +503,10 @@
<icon></icon>
<genretype>30</genretype>
<genresubtype>0</genresubtype>
<parentalrating>13</parentalrating>
<parentalratingcode>CC-DD</parentalratingcode>
<parentalratingicon>data/cc-dd.png</parentalratingicon>
<parentalratingsource>ABCD</parentalratingsource>
</entry>
<entry>
<broadcastid>1600</broadcastid>
Expand All @@ -501,6 +531,9 @@
<icon></icon>
<genretype>20</genretype>
<genresubtype>0</genresubtype>
<parentalratingcode>BB</parentalratingcode>
<parentalratingicon>data/bb.png</parentalratingicon>
<parentalratingsource>ABC</parentalratingsource>
</entry>
<entry>
<broadcastid>2400</broadcastid>
Expand All @@ -513,6 +546,7 @@
<icon></icon>
<genretype>30</genretype>
<genresubtype>0</genresubtype>
<parentalrating>9</parentalrating>
</entry>
<entry>
<broadcastid>1900</broadcastid>
Expand All @@ -525,6 +559,10 @@
<icon></icon>
<genretype>10</genretype>
<genresubtype>0</genresubtype>
<parentalrating>11</parentalrating>
<parentalratingcode>BB</parentalratingcode>
<parentalratingicon>data/bb.png</parentalratingicon>
<parentalratingsource>ABCD</parentalratingsource>
</entry>
<entry>
<broadcastid>2000</broadcastid>
Expand All @@ -549,6 +587,10 @@
<icon></icon>
<genretype>30</genretype>
<genresubtype>0</genresubtype>
<parentalrating>11</parentalrating>
<parentalratingcode>BB</parentalratingcode>
<parentalratingicon>data/bb.png</parentalratingicon>
<parentalratingsource>ÜŤƑ-8-ṰẼŠṮ</parentalratingsource>
</entry>
<entry>
<broadcastid>2200</broadcastid>
Expand All @@ -561,6 +603,10 @@
<icon></icon>
<genretype>10</genretype>
<genresubtype>0</genresubtype>
<parentalrating>9</parentalrating>
<parentalratingcode>A</parentalratingcode>
<parentalratingicon>data/a.png</parentalratingicon>
<parentalratingsource>ABC</parentalratingsource>
</entry>
<entry>
<broadcastid>2300</broadcastid>
Expand All @@ -573,6 +619,10 @@
<icon></icon>
<genretype>20</genretype>
<genresubtype>0</genresubtype>
<parentalrating>13</parentalrating>
<parentalratingcode>CC-DD</parentalratingcode>
<parentalratingicon>data/cc-dd.png</parentalratingicon>
<parentalratingsource>ABCD</parentalratingsource>
</entry>
<entry>
<broadcastid>2400</broadcastid>
Expand All @@ -585,6 +635,10 @@
<icon></icon>
<genretype>30</genretype>
<genresubtype>0</genresubtype>
<parentalrating>11</parentalrating>
<parentalratingcode>BB</parentalratingcode>
<parentalratingicon>data/bb.png</parentalratingicon>
<parentalratingsource>ABCD</parentalratingsource>
</entry>
</epg>
<recordings>
Expand All @@ -606,6 +660,31 @@
<episode>1</episode>
<channel>1</channel>
<provider>1</provider> <!-- Demo Provider 1 -->
<parentalrating>9</parentalrating>
<parentalratingcode>A</parentalratingcode>
<parentalratingicon>data/a.png</parentalratingicon>
</recording>
<recording>
<title>Demo TV Recording entry 11</title>
<episodetitle>Demo TV Recording 11 Episode Name</episodetitle>
<url>https://mirrors.kodi.tv/demo-files/BBB/bbb_sunflower_1080p_30fps_normal.mp4</url>
<directory>/</directory>
<channelname>Demo TV Channel 1</channelname>
<plotoutline>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</plotoutline>
<plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
<genretype>10</genretype>
<genresubtype>0</genresubtype>
<time>12:00</time>
<duration>7200</duration>
<radio>0</radio>
<series>2</series>
<episode>1</episode>
<channel>1</channel>
<provider>1</provider> <!-- Demo Provider 1 -->
<parentalrating>11</parentalrating>
<parentalratingcode>BB</parentalratingcode>
<parentalratingicon>data/bb.png</parentalratingicon>
<parentalratingsource>ABC</parentalratingsource>
</recording>
<recording>
<title>Demo TV Recording entry 2</title>
Expand Down
1 change: 1 addition & 0 deletions pvr.demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Dummy data and files to be used with the PVR Demo Add-on.

## Icons
There are 11 icons used for the channels. The same icons are used for TV and Radio.
4 icons of various aspect ratios are available for ParentalRatingIcons.

## PVR Channel Data types

Expand Down
2 changes: 1 addition & 1 deletion pvr.demo/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.demo"
version="22.2.1"
version="22.3.0"
name="Demo PVR Client"
provider-name="Pulse-Eight Ltd., Team Kodi">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.demo/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v22.3.0
- Add support for parentalRating+Code+Icon+Source to EPG and recordings.

v22.2.1
- Add missing SetEpisodePartNumber()

Expand Down
Binary file added pvr.demo/data/a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pvr.demo/data/bb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pvr.demo/data/cc-dd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pvr.demo/data/eee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 39 additions & 1 deletion src/PVRDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ PVR_ERROR CPVRDemo::GetEPGForChannel(int channelUid,
tag.SetEpisodeName(myTag.strEpisodeName);
tag.SetEpisodePartNumber(myTag.iEpisodePartNumber);
tag.SetYear(myTag.iYear);
tag.SetParentalRating(myTag.iParentalRating);
tag.SetParentalRatingCode(myTag.strParentalRatingCode);
tag.SetParentalRatingIcon(myTag.strParentalRatingIcon);
tag.SetParentalRatingSource(myTag.strParentalRatingSource);

iLastEndTimeTmp = tag.GetEndTime();

Expand Down Expand Up @@ -336,7 +340,11 @@ PVR_ERROR CPVRDemo::GetRecordings(bool deleted, kodi::addon::PVRRecordingsResult

/* PVR API 8.0.0 */
kodiRecording.SetClientProviderUid(recording.iProviderId);

kodiRecording.SetParentalRating(recording.iParentalRating);
kodiRecording.SetParentalRatingCode(recording.strParentalRatingCode);
kodiRecording.SetParentalRatingIcon(recording.strParentalRatingIcon);
kodiRecording.SetParentalRatingSource(recording.strParentalRatingSource);

results.Add(kodiRecording);
}

Expand Down Expand Up @@ -776,6 +784,21 @@ bool CPVRDemo::ScanXMLEpgData(const XMLNode* pEpgNode)
/* genre subtype */
XMLGetInt(pEpgNode, "genresubtype", entry.iGenreSubType);

/* parental rating age */
XMLGetInt(pEpgNode, "parentalrating", entry.iParentalRating);

/* parental rating code */
if (XMLGetString(pEpgNode, "parentalratingcode", strTmp))
entry.strParentalRatingCode = strTmp;

/* parental rating icon */
if (XMLGetString(pEpgNode, "parentalratingicon", strTmp))
entry.strParentalRatingIcon = ClientPath() + strTmp;

/* parental rating source */
if (XMLGetString(pEpgNode, "parentalratingsource", strTmp))
entry.strParentalRatingSource = strTmp;

/* episodepart */
if (!XMLGetInt(pEpgNode, "episodepart", entry.iEpisodePartNumber))
entry.iEpisodePartNumber = EPG_TAG_INVALID_SERIES_EPISODE;
Expand Down Expand Up @@ -879,6 +902,21 @@ bool CPVRDemo::ScanXMLRecordingData(const XMLNode* pRecordingNode,
recording.iProviderId = PVR_PROVIDER_INVALID_UID;
XMLGetInt(pRecordingNode, "provider", recording.iProviderId);

/* parental rating age */
XMLGetInt(pRecordingNode, "parentalrating", recording.iParentalRating);

/* parental rating code */
if (XMLGetString(pRecordingNode, "parentalratingcode", strTmp))
recording.strParentalRatingCode = strTmp;

/* parental rating icon */
if (XMLGetString(pRecordingNode, "parentalratingicon", strTmp))
recording.strParentalRatingIcon = ClientPath() + strTmp;

/* parental rating source */
if (XMLGetString(pRecordingNode, "parentalratingsource", strTmp))
recording.strParentalRatingSource = strTmp;

/* recording year */
if (!XMLGetInt(pRecordingNode, "year", recording.iYear))
recording.iYear = 0;
Expand Down
9 changes: 8 additions & 1 deletion src/PVRDemo.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ struct PVRDemoEpgEntry
int iGenreType;
int iGenreSubType;
// time_t firstAired;
// int iParentalRating;
int iParentalRating = 0;
// int iStarRating;
// bool bNotify;
int iSeriesNumber;
int iEpisodeNumber;
int iEpisodePartNumber;
std::string strEpisodeName;
std::string strParentalRatingCode;
std::string strParentalRatingIcon;
std::string strParentalRatingSource;
int iYear;
};

Expand Down Expand Up @@ -69,6 +72,10 @@ struct PVRDemoRecording
time_t recordingTime;
int iChannelId;
int iProviderId;
int iParentalRating = 0;
std::string strParentalRatingCode;
std::string strParentalRatingIcon;
std::string strParentalRatingSource;
int iYear;
};

Expand Down

0 comments on commit e2fc15b

Please sign in to comment.