TVServer Import error episode-num field (1 Viewer)

mbb

Portal Pro
November 20, 2004
374
15
Home Country
France France
since my tvguide provider add some new feature the TVguide.xml import fail.

status:tvguide.xml:Invalid XML file:Input string was not in a correct format.;

After some investigation, it seems that MP doesnt handle well the episode-num field.
I asked my provider about this and he claims that he respects the xmltv.dtd standard about this: XML: XMLTV - DTD for TV listings

I did some some test by replacing some string:
xmltv_ns">.. by xmltv_ns">
..</episode-num> by </episode-num>
xmltv_ns">0.. by xmltv_ns">0
and the same for 1.., 2.., 3.., etc

It works, and seems to confirm that the episode-num field parsing have something wrong.

I upload the file to test and some logs

Thanks
mbb
 

mbb

Portal Pro
November 20, 2004
374
15
Home Country
France France
Ok I take time to run it in debug mode and I found the problem :) ... and the the solution

in XMLTVImport.cs the code doesnt work for this example 3..38/40 because it presume that p as only one digit, but 38 have 2 digits ;)

we have to replace
Code:
int p = 0;
int t = 0;
if (Convert.ToInt32(episodePart.Substring(0, 1)) == 0)
{
    p = Convert.ToInt32(episodePart.Substring(0, 1)) + 1;
}
else
{
    p = Convert.ToInt32(episodePart.Substring(0, 1));
}
t = Convert.ToInt32(episodePart.Substring(2, 1));
episodePart = Convert.ToString(p) + "/" + Convert.ToString(t);

by
Code:
int p = 0;
int t = 0;
if (Convert.ToInt32(episodePart.Substring(0, episodePart.IndexOf("/", 0))) == 0)
{
    p = Convert.ToInt32(episodePart.Substring(0, episodePart.IndexOf("/", 0))) + 1;
}
else
{
    p = Convert.ToInt32(episodePart.Substring(0, episodePart.IndexOf("/", 0)));
}
t = Convert.ToInt32(episodePart.Substring(episodePart.IndexOf("/", 0) + 1, episodePart.Length -  episodePart.IndexOf("/", 0) + 1)));
episodePart = Convert.ToString(p) + "/" + Convert.ToString(t);
 

mbb

Portal Pro
November 20, 2004
374
15
Home Country
France France
Finally I rewrite all the episode-num parsing in a more universal manner
It follow now the XMLTV DTD standard in all case ;)

I join the fixed XmlTvImport.cs sources and the compiled dll to test the fix.
 

gemx

Retired Team Member
  • Premium Supporter
  • October 31, 2006
    1,972
    539
    Home Country
    Germany Germany
    Fixed in rev. 19047.

    :D mbb
     

    Users who are viewing this thread

    Top Bottom