Skip to content

Commit 8809990

Browse files
authored
Merge pull request #991 from phunkyfish/fix-episode-part
Fix episode part parsing
2 parents 084876e + 5760bd9 commit 8809990

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

pvr.iptvsimple/addon.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<addon
33
id="pvr.iptvsimple"
4-
version="22.6.0"
4+
version="22.6.1"
55
name="IPTV Simple Client"
66
provider-name="nightik and Ross Nicholson">
77
<requires>@ADDON_DEPENDS@

pvr.iptvsimple/changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v22.6.1
2+
- Fix episode part parsing
3+
14
v22.5.1
25
- Add support to inputstream.adaptive.common_headers to set headers
36
- Fix an issue that was replacing user headers set with inputstream.adaptive.common_headers

src/iptvsimple/data/EpgEntry.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ bool EpgEntry::ParseEpisodeNumberInfo(std::vector<std::pair<std::string, std::st
338338

339339
bool EpgEntry::ParseXmltvNsEpisodeNumberInfo(const std::string& episodeNumberString)
340340
{
341+
// All season and episode numbers start from zero so will need to be incremented.
342+
// Apart from the totalNumberOfParts which does not.
343+
341344
size_t found = episodeNumberString.find(".");
342345
if (found != std::string::npos)
343346
{
@@ -360,19 +363,11 @@ bool EpgEntry::ParseXmltvNsEpisodeNumberInfo(const std::string& episodeNumberStr
360363

361364
if (!episodePartString.empty())
362365
{
363-
int numElementsParsed = std::sscanf(episodePartString.c_str(), "%d/%d", &m_episodeNumber, &m_episodePartNumber);
366+
int totalNumberOfParts = 1;
367+
int numElementsParsed = std::sscanf(episodePartString.c_str(), "%d/%d", &m_episodePartNumber, &totalNumberOfParts);
364368

365-
if (numElementsParsed == 2)
366-
{
367-
m_episodeNumber++;
368-
m_episodePartNumber++;
369-
}
370-
else if (numElementsParsed == 1)
371-
{
372-
if (m_episodeNumber == EPG_TAG_INVALID_SERIES_EPISODE)
373-
m_episodeNumber++;
374-
m_episodePartNumber = EPG_TAG_INVALID_SERIES_EPISODE;
375-
}
369+
if ((numElementsParsed == 2 && totalNumberOfParts != 1) || numElementsParsed == 1)
370+
m_episodePartNumber++;
376371
}
377372
}
378373

0 commit comments

Comments
 (0)