Skip to content
This repository
Browse code

Only start checking the nfo file from the first episodedetails tag

  • Loading branch information...
commit f1016fc890ddffd5617b7671f638da3f064731b1 1 parent 6a18804
ScudLee authored April 16, 2013 S. Davilla committed April 16, 2013

Showing 1 changed file with 1 addition and 0 deletions. Show diff stats Hide diff stats

  1. 1  xbmc/NfoFile.cpp
1  xbmc/NfoFile.cpp
@@ -71,6 +71,7 @@ CNfoFile::NFOResult CNfoFile::Create(const CStdString& strPath, const ScraperPtr
71 71
     if (episode > -1 && bNfo && m_type == ADDON_SCRAPER_TVSHOWS)
72 72
     {
73 73
       int infos=0;
  74
+      m_headofdoc = strstr(m_headofdoc,"<episodedetails");
74 75
       while (m_headofdoc && details.m_iEpisode != episode)
75 76
       {
76 77
         m_headofdoc = strstr(m_headofdoc+1,"<episodedetails");

5 notes on commit f1016fc

jmarshallnz
Owner

@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:

http://pastebin.com/3yS1Gen8

See here for more: http://forum.xbmc.org/showthread.php?tid=164078

ScudLee

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.

ScudLee

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.

jmarshallnz
Owner
ScudLee

Done in #2709

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