Skip to content

Commit

Permalink
Support selective replay by epg entry
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuehlma committed Feb 9, 2020
1 parent 26a8528 commit 707c31d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions pvr.zattoo/addon.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<news>
v18.1.12
- Add support for parental pin
- Use selective recall flag by programme
v18.1.11
- Improve caching of epg data
v18.1.10
Expand Down
9 changes: 7 additions & 2 deletions src/ZatData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ using namespace rapidjson;

constexpr char app_token_file[] = "special://temp/zattoo_app_token";
const char data_file[] = "special://profile/addon_data/pvr.zattoo/data.json";
const unsigned int EPG_TAG_FLAG_SELECTIVE_REPLAY = 0x00400000;
static const std::string user_agent = std::string("Kodi/")
+ std::string(STR(KODI_VERSION)) + std::string(" pvr.zattoo/")
+ std::string(STR(ZATTOO_VERSION)) + std::string(" (Kodi PVR addon)");
Expand Down Expand Up @@ -901,7 +902,7 @@ void ZatData::GetEPGForChannelExternalService(int uniqueChannelId,
tag.iEpisodePartNumber = 0; /* not supported */
std::string subtitle = GetStringOrEmpty(program, "Subtitle");
tag.strEpisodeName = subtitle.c_str();
tag.iFlags = EPG_TAG_FLAG_UNDEFINED;
tag.iFlags = program["SelectiveReplayAllowed"].GetBool() ? EPG_TAG_FLAG_SELECTIVE_REPLAY : EPG_TAG_FLAG_UNDEFINED;
std::string genreStr = GetStringOrEmpty(program, "Genre");
int genre = m_categories.Category(genreStr);
if (genre)
Expand Down Expand Up @@ -987,7 +988,7 @@ void ZatData::GetEPGForChannelAsync(int uniqueChannelId, time_t iStart,
tag.iEpisodeNumber = 0; /* not supported */
tag.iEpisodePartNumber = 0; /* not supported */
tag.strEpisodeName = nullptr; /* not supported */
tag.iFlags = EPG_TAG_FLAG_UNDEFINED;
tag.iFlags = epgEntry.selectiveReplay ? EPG_TAG_FLAG_SELECTIVE_REPLAY : EPG_TAG_FLAG_UNDEFINED;

int genre = m_categories.Category(epgEntry.strGenreString);
if (genre)
Expand Down Expand Up @@ -1067,6 +1068,7 @@ std::map<time_t, PVRIptvEpgEntry>* ZatData::LoadEPG(time_t iStart, time_t iEnd,
entry.strIconPath = GetImageUrl(GetStringOrEmpty(program, "i_t"));
entry.iChannelId = channel->iUniqueId;
entry.strPlot = GetStringOrEmpty(program, "et");
entry.selectiveReplay = program["r_e"].GetBool();

const Value& genres = program["g"];
for (Value::ConstValueIterator itr2 = genres.Begin();
Expand Down Expand Up @@ -1425,6 +1427,9 @@ int ZatData::GetRecallSeconds(const EPG_TAG *tag)
}
if (m_selectiveRecallEnabled)
{
if ((tag->iFlags & EPG_TAG_FLAG_SELECTIVE_REPLAY) == 0) {
return 0;
}
ZatChannel channel = m_channelsByUid[tag->iUniqueChannelId];
return channel.selectiveRecallSeconds;
}
Expand Down
1 change: 1 addition & 0 deletions src/ZatData.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct PVRIptvEpgEntry
std::string strPlot;
std::string strIconPath;
std::string strGenreString;
bool selectiveReplay;
};

struct ZatRecordingData
Expand Down

0 comments on commit 707c31d

Please sign in to comment.