SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV EPG Service

Notices

SageTV EPG Service Discussion related to the SageTV EPG Service used within SageTV. Questions about service area coverage, channel lineups, EPG listings, XMLTV, or anything else related to the service or programming guide data for SageTV should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-07-2005, 10:15 AM
owilsky's Avatar
owilsky owilsky is offline
Sage Aficionado
 
Join Date: Dec 2004
Location: Germany
Posts: 447
Error in XMLTV plugins?

Hi,

I've been having a big problem with xmltv plugin for some months now, so I did some tests.

Description of the problem:
When a show does not have a subtitle, XMLTV plugin generates identical ShowIDs when the title is identical.
This should not happen because the original programmer of the plugin included some code to prevent this: (this thread is about show.java):
Code:
if (this.episodeName != null) {
  crc.update(this.episodeName.getBytes());
} else {
  if (this.startString != null) {
    crc.update(this.startString.getBytes());
  }
}
Unfortunately an empty String does not seem to be null and also it does not seem to be "" in Java which I tested this way:
Code:
public void writeLog(String msg) {
  try {
    File outputFile = new File("C:/Program Files/Frey Technologies/SageTV/xmltv/log.txt");
    FileWriter out = new FileWriter(outputFile, true); //append to file
    out.write(msg);
    out.close();
  }
  catch (IOException ioe) {}
}
in public void EPGInsert:
Code:
  writeLog("title=   '"+this.title+"'\n");
  if (this.episodeName==null) writeLog("Episode= null\n");
  if (this.episodeName=="") writeLog("Episode= empty\n");
  if (this.episodeName!="" && this.episodeName!=null) writeLog("Episode= '"+this.episodeName+"'\n");
Note that I never got "Episode= null" or "Episode= empty" in my log.

My solution:
replace "!=null" with ".length()!=0" :
Code:
        if (this.title.length() != 0)
            crc.update(this.title.getBytes());
        if (this.episodeName.length() != 0) {
            crc.update(this.episodeName.getBytes());
        } else {
            if (this.startString.length() != 0) {
                crc.update(this.startString.getBytes());
            }
        }
        if (this.desc.length() != 0)
            crc.update(this.desc.getBytes());
Conclusion:
I did much more logging so I saw that I got identical ShowIDs on shows with identical titles and empty subtitles. The startString has never been considered.
After my changes the log showed perfectly different ShowIDs for shows without subtitles because in these cases the startString has been considered.
Attached you'll find the changed plugin with sources.

I hope my English is clear enough

Any comments on this?

Oliver
Attached Files
File Type: zip xmltv-owilsky.zip (11.0 KB, 530 views)
__________________
Oliver Kötter
------------
Check this thread for importing German TV Data into SageTV

Using SageTV 7.1.9, Java 1.6.0_24 Win7 Home Premium on an
Asus M4N78-AM Mainboard, AMD Athlon II X2 215, 4 GB RAM, 500 GB HDD, 2xTechnoTrend S-2400 as Network Encoder (LM DVB Smart Recorder), ATI Radeon HD 3450 with analog TV-Out on good old CRT TV (100Hz)
My avatar shows the world's best composer!!!

Last edited by owilsky; 05-14-2005 at 06:26 AM. Reason: Uploaded new version of xmltv plugin
Reply With Quote
  #2  
Old 05-08-2005, 08:02 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
I not seen a problem like this: I always get shows with no episode-name/sub-title recorded separately... Do your XMLTV *files* contain programmes with empty <sub-title> elements? -- it should be that the parser will not populate the episode name with anything (meaning that it will be ==null) if there is no <sub-title> in the <programme>... This fix will probably cause an NPE in programmes with no <sub-title>

But yes, it is probably an oversight that empty sub-titles are included and should be corrected: Perhaps it should be:
Code:
if ( this.episodeName !=null && this.episodeName.trim().length() != 0)
The trouble is that there are at least 5 XMLTV plugins! (see the XMTLV page on the sage-community site in my sig!)
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #3  
Old 05-08-2005, 03:48 PM
owilsky's Avatar
owilsky owilsky is offline
Sage Aficionado
 
Join Date: Dec 2004
Location: Germany
Posts: 447
Quote:
Originally Posted by nielm
I not seen a problem like this: I always get shows with no episode-name/sub-title recorded separately... Do your XMLTV *files* contain programmes with empty <sub-title> elements? -- it should be that the parser will not populate the episode name with anything (meaning that it will be ==null) if there is no <sub-title> in the <programme>... This fix will probably cause an NPE in programmes with no <sub-title>
Yes, I have indeed often shows with <subtitle></subtitle>, which are e.g. news. I don't use xmltv as my grabber but TV Movie Clickfinder, which uses an MS Access Database, a self writte tool creates xml files out of the DB. So I always have the subtitle tags (never null) but sometimes they are empty.

Quote:
Originally Posted by nielm
But yes, it is probably an oversight that empty sub-titles are included and should be corrected: Perhaps it should be:
Code:
if ( this.episodeName !=null && this.episodeName.trim().length() != 0)
The trouble is that there are at least 5 XMLTV plugins! (see the XMTLV page on the sage-community site in my sig!)
Hey, the trim() is really a good idea... just in case...

Oliver
__________________
Oliver Kötter
------------
Check this thread for importing German TV Data into SageTV

Using SageTV 7.1.9, Java 1.6.0_24 Win7 Home Premium on an
Asus M4N78-AM Mainboard, AMD Athlon II X2 215, 4 GB RAM, 500 GB HDD, 2xTechnoTrend S-2400 as Network Encoder (LM DVB Smart Recorder), ATI Radeon HD 3450 with analog TV-Out on good old CRT TV (100Hz)
My avatar shows the world's best composer!!!
Reply With Quote
  #4  
Old 05-09-2005, 01:17 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
I think that an empty sub-title is not allowed inthe XMLTV spec -- maybe passing it through tv_cat or tv_sort mught clean it up
(the plugin should still cope with slightly out-of-spec data)
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #5  
Old 05-14-2005, 06:29 AM
owilsky's Avatar
owilsky owilsky is offline
Sage Aficionado
 
Join Date: Dec 2004
Location: Germany
Posts: 447
OK, I updated the plugin:

- checks if xmltag.trim().length() !=0
- checks if xmltag != null

I updated the upload on post #1 for those who are interested. Works much better for me now if subtitle is empty.

Oliver
__________________
Oliver Kötter
------------
Check this thread for importing German TV Data into SageTV

Using SageTV 7.1.9, Java 1.6.0_24 Win7 Home Premium on an
Asus M4N78-AM Mainboard, AMD Athlon II X2 215, 4 GB RAM, 500 GB HDD, 2xTechnoTrend S-2400 as Network Encoder (LM DVB Smart Recorder), ATI Radeon HD 3450 with analog TV-Out on good old CRT TV (100Hz)
My avatar shows the world's best composer!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 09:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.