From 412cb2517e4b0416e64c4ba1f59b92c564a9614a Mon Sep 17 00:00:00 2001 From: Martin Vallevand Date: Fri, 23 Aug 2024 02:02:19 -0400 Subject: [PATCH] Update reading XMLTV xmltv_ns for PVR API v9.0.0 Update EpisodePartNumber with the total number of episodes in an episode sequence. Use with Episode number --- src/iptvsimple/data/EpgEntry.cpp | 10 ++++++++-- src/iptvsimple/data/MediaEntry.cpp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/iptvsimple/data/EpgEntry.cpp b/src/iptvsimple/data/EpgEntry.cpp index 3c792e49b..dae7cc378 100644 --- a/src/iptvsimple/data/EpgEntry.cpp +++ b/src/iptvsimple/data/EpgEntry.cpp @@ -360,13 +360,19 @@ bool EpgEntry::ParseXmltvNsEpisodeNumberInfo(const std::string& episodeNumberStr if (!episodePartString.empty()) { - int totalNumberOfParts; - int numElementsParsed = std::sscanf(episodePartString.c_str(), "%d/%d", &m_episodePartNumber, &totalNumberOfParts); + int numElementsParsed = std::sscanf(episodePartString.c_str(), "%d/%d", &m_episodeNumber, &m_episodePartNumber); if (numElementsParsed == 2) + { + m_episodeNumber++; m_episodePartNumber++; + } else if (numElementsParsed == 1) + { + if (m_episodeNumber == EPG_TAG_INVALID_SERIES_EPISODE) + m_episodeNumber++; m_episodePartNumber = EPG_TAG_INVALID_SERIES_EPISODE; + } } } diff --git a/src/iptvsimple/data/MediaEntry.cpp b/src/iptvsimple/data/MediaEntry.cpp index 9e70d0db4..ebcec7598 100644 --- a/src/iptvsimple/data/MediaEntry.cpp +++ b/src/iptvsimple/data/MediaEntry.cpp @@ -265,7 +265,7 @@ void MediaEntry::UpdateTo(kodi::addon::PVRRecording& left, bool isInVirtualMedia // left.SetStarRating(m_starRating); left.SetSeriesNumber(m_seasonNumber); left.SetEpisodeNumber(m_episodeNumber); - // left.SetEpisodePartNumber(m_episodePartNumber); + left.SetEpisodePartNumber(m_episodePartNumber); left.SetEpisodeName(m_episodeName); left.SetFirstAired(m_firstAired); int iFlags = EPG_TAG_FLAG_UNDEFINED;