Skip to content

Commit

Permalink
Add parental rating fields to EPG, Timers and Recordings.
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaMikeCharlie committed Jun 18, 2024
1 parent be2a436 commit 1e6b5c7
Show file tree
Hide file tree
Showing 10 changed files with 196 additions and 3 deletions.
95 changes: 95 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,12 @@
<icon></icon>
<genretype>48</genretype>
<genresubtype>0</genresubtype>
<parentalratingcode>CC-DD</parentalratingcode>
<parentalratingicon>data/cc-dd.png</parentalratingicon>
<parentalratingsource>ABC</parentalratingsource>
<cast>Actor One, Actor Two, Actor Three</cast>
<director>Director Name</director>
<writer>Writer Name</writer>
</entry>
<entry>
<broadcastid>400</broadcastid>
Expand All @@ -386,6 +393,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 +409,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 All @@ -422,6 +437,10 @@
<icon></icon>
<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 @@ -434,6 +453,10 @@
<icon></icon>
<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 @@ -446,6 +469,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 @@ -458,6 +484,9 @@
<icon></icon>
<genretype>176</genretype>
<genresubtype>0</genresubtype>
<parentalrating>15</parentalrating>
<parentalratingcode>EEE</parentalratingcode>
<parentalratingicon>data/eee.png</parentalratingicon>
</entry>

<entry>
Expand All @@ -471,6 +500,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 @@ -495,6 +528,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 @@ -507,6 +543,7 @@
<icon></icon>
<genretype>30</genretype>
<genresubtype>0</genresubtype>
<parentalrating>9</parentalrating>
</entry>
<entry>
<broadcastid>1900</broadcastid>
Expand All @@ -519,6 +556,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 @@ -543,6 +584,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 @@ -555,6 +600,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 @@ -567,6 +616,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 @@ -579,6 +632,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 @@ -600,6 +657,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 Expand Up @@ -1194,5 +1276,18 @@
<state>3</state>
<summary>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.</summary>
</timer>
<timer>
<title>Demo Timer entry #10</title>
<channelid>1</channelid>
<starttime>13:15</starttime>
<endtime>14:45</endtime>
<state>1</state>
<summary>SUMMARY 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.</summary>
<plot>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>
<parentalrating>13</parentalrating>
<parentalratingcode>CC-DD</parentalratingcode>
<parentalratingicon>data/cc-dd.png</parentalratingicon>
<parentalratingsource>ABC</parentalratingsource>
</timer>
</timers>
</demo>
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="21.0.0"
version="22.0.0"
name="Demo PVR Client"
provider-name="Pulse-Eight Ltd., Team Kodi">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
7 changes: 7 additions & 0 deletions pvr.demo/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v22.0.0
- Add support for parentalRatingIcon to EPG events.
- Add support for parentalRatingCode/Icon/Source to timers and recordings.

v21.1.0
- Add support for parentalRating and parentalRatingCode to EPG events.

v20.5.0
- Update PVR API 8.0.2

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.
78 changes: 77 additions & 1 deletion src/PVRDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PVR_ERROR CPVRDemo::GetCapabilities(kodi::addon::PVRCapabilities& capabilities)

PVR_ERROR CPVRDemo::GetBackendName(std::string& name)
{
name = "pulse-eight demo pvr add-on";
name = "Demo PVR Client";
return PVR_ERROR_NO_ERROR;
}

Expand Down Expand Up @@ -125,6 +125,14 @@ PVR_ERROR CPVRDemo::GetEPGForChannel(int channelUid,
tag.SetSeriesNumber(myTag.iSeriesNumber);
tag.SetEpisodeNumber(myTag.iEpisodeNumber);
tag.SetEpisodeName(myTag.strEpisodeName);
tag.SetParentalRating(myTag.iParentalRating);
tag.SetParentalRatingCode(myTag.strParentalRatingCode);
tag.SetParentalRatingIcon(myTag.strParentalRatingIcon);
tag.SetParentalRatingSource(myTag.strParentalRatingSource);

tag.SetCast(myTag.strCast);
tag.SetDirector(myTag.strDirector);
tag.SetWriter(myTag.strWriter);

iLastEndTimeTmp = tag.GetEndTime();

Expand Down Expand Up @@ -331,6 +339,10 @@ 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 @@ -373,6 +385,10 @@ PVR_ERROR CPVRDemo::GetTimers(kodi::addon::PVRTimersResultSet& results)
kodiTimer.SetState(timer.state);
kodiTimer.SetTitle(timer.strTitle);
kodiTimer.SetSummary(timer.strSummary);
//kodiTimer.SetParentalRating(timer.iParentalRating);
//kodiTimer.SetParentalRatingCode(timer.strParentalRatingCode);
//kodiTimer.SetParentalRatingIcon(timer.strParentalRatingIcon);
//kodiTimer.SetParentalRatingSource(timer.strParentalRatingSource);

results.Add(kodiTimer);
}
Expand Down Expand Up @@ -770,6 +786,33 @@ 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;

/* cast */
if (XMLGetString(pEpgNode, "cast", strTmp))
entry.strCast = strTmp;

/* director */
if (XMLGetString(pEpgNode, "director", strTmp))
entry.strDirector = strTmp;

/* writer */
if (XMLGetString(pEpgNode, "writer", strTmp))
entry.strWriter = strTmp;

kodi::Log(ADDON_LOG_DEBUG, "loaded EPG entry '%s' channel '%d' start '%d' end '%d'",
entry.strTitle.c_str(), entry.iChannelId, entry.startTime, entry.endTime);

Expand Down Expand Up @@ -861,6 +904,24 @@ 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;

kodi::Log(ADDON_LOG_DEBUG, "loaded recording '%s' channel '%d' duration '%d'",
recording.strTitle.c_str(), recording.iChannelId, recording.iDuration);

return true;
}

Expand Down Expand Up @@ -914,6 +975,21 @@ bool CPVRDemo::ScanXMLTimerData(const XMLNode* pTimerNode, PVRDemoTimer& timer)
}
}

/* parental rating age */
XMLGetInt(pTimerNode, "parentalrating", timer.iParentalRating);

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

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

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

kodi::Log(ADDON_LOG_DEBUG, "loaded timer '%s' channel '%d' start '%d' end '%d'",
timer.strTitle.c_str(), timer.iChannelId, timer.startTime, timer.endTime);
return true;
Expand Down
Loading

0 comments on commit 1e6b5c7

Please sign in to comment.