Skip to content
Browse files

Only start checking the nfo file from the first episodedetails tag

  • Loading branch information...
1 parent 6a18804 commit f1016fc890ddffd5617b7671f638da3f064731b1 @ScudLee ScudLee committed with davilla
Showing with 1 addition and 0 deletions.
  1. +1 −0 xbmc/NfoFile.cpp
1 xbmc/NfoFile.cpp
@@ -71,6 +71,7 @@ CNfoFile::NFOResult CNfoFile::Create(const CStdString& strPath, const ScraperPtr
if (episode > -1 && bNfo && m_type == ADDON_SCRAPER_TVSHOWS)
int infos=0;
+ m_headofdoc = strstr(m_headofdoc,"<episodedetails");
while (m_headofdoc && details.m_iEpisode != episode)
m_headofdoc = strstr(m_headofdoc+1,"<episodedetails");

5 comments on commit f1016fc

Team Kodi member

@ScudLee: Might this be the reason that some .nfo files that have an additional root node no longer work? I don't see why exactly (maybe parsing fails due to the extra closing node?), but it may well be reproducible with this .nfo file:

See here for more:


I suspect it is this, but I also can't see it.

From my testing, though, it's not the closing tag (which is what I thought too), only the opening tag is needed to cause the bug (with or without the XML declaration)... Which makes no sense as it should be skipped over anyway.

Just an extra closing tag on its own at the end doesn't trigger the bug.
Nor does just having an extra commented out line at the start.

An opened and immediately closed node at the start does trigger the bug though.

In all cases the debug log just says "Found matching Full NFO file".

I can do some proper debugging tomorrow if needed.


Okay, I think I got it. It was because the bNfo = GetDetails(details) just above this would return true but not load actually load any details when there's an extra node in the way. Previously this would just mean the first time in the while loop would fail and it would advance to the first <episodedetails as needed (coincidentally this would result in the same bug as I was trying to fix, if the episode numbers differed, but I guess because the files affected were automatically generated that never happened anyway).

With my fix however, it's already advanced, but it will still fail in the first loop, and when it advances again, it doesn't find any more <episodedetails, and so you get an empty details.

The simple fix is just to just do another bNfo = GetDetails(details); after my added line, to reload the details again.

I can do a PR if you want.

Team Kodi member

Done in #2709

Please sign in to comment.
Something went wrong with that request. Please try again.