On Monday 08 August 2005 08:21, Hans Meine wrote:
> On Sunday 07 August 2005 21:55, Hans Meine wrote:
> > On Sunday 07 August 2005 20:30, Bjoern Franke wrote:
> > > You should use the CVS-version of xmltv. Some changes were made on the
> > > tvtoday-site and your version of xmltv is too old for it.
> >
> > Ah, thanks.  The XML did not look broken to me, and xmltv itself did not
> > give any error messages.  (That is - maybe freevo swallows/redirects
> > them?)
>
> Stupid me.  I even posted the error.  Forget that bull****.

Thinking about that again, the message could've been easier to see:
- xmltv just gives one line of perl error, no actual message.
- I was distracted by the expat error
- even after that, there was this favorites-updating stuff

I propose the attached patches (for both Freevo branches) which check the 
exitcode and give a more meaningful message.

-- 
Ciao, /  /                                                    .o.
     /--/                                                     ..o
    /  / ANS                                                  ooo
Index: src/helpers/tv_grab.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/helpers/tv_grab.py,v
retrieving revision 1.7
diff -u -3 -p -d -r1.7 tv_grab.py
--- src/helpers/tv_grab.py	10 Jul 2004 12:33:39 -0000	1.7
+++ src/helpers/tv_grab.py	8 Aug 2005 20:39:16 -0000
@@ -63,11 +63,11 @@ def grab():
 
     print 'Grabbing listings.'
     xmltvtmp = '/tmp/TV.xml.tmp'
-    os.system('%s --output %s --days %s' % ( config.XMLTV_GRABBER, 
-                                             xmltvtmp,
-                                             config.XMLTV_DAYS ))
+    ec = os.system('%s --output %s --days %s' % ( config.XMLTV_GRABBER, 
+                                                  xmltvtmp,
+                                                  config.XMLTV_DAYS ))
 
-    if os.path.exists(xmltvtmp):
+    if os.path.exists(xmltvtmp) and ec == 0:
         if os.path.isfile(config.XMLTV_SORT):
             print 'Sorting listings.'
             os.system('%s --output %s %s' % ( config.XMLTV_SORT,
@@ -84,7 +84,15 @@ def grab():
 
         import tv.epg_xmltv
         tv.epg_xmltv.get_guide(XMLTV_FILE=xmltvtmp)
-
+    else:
+        sys.stderr.write("ERROR: xmltv grabbing failed; "
+                         "%s returned exit code %d.\n" %
+                         (config.XMLTV_GRABBER, ec >> 8))
+        sys.stderr.write("  If you did not change your system, it's likely that "
+                         "the site being grabbed did.\n  You might want to try "
+                         "whether updating your xmltv helps in that case:\n"
+                         "    http://www.xmltv.org/\n";)
+        sys.exit(1)
 
 if __name__ == '__main__':
 
Index: src/helpers/tv_grab.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/helpers/tv_grab.py,v
retrieving revision 1.24
diff -u -3 -p -d -r1.24 tv_grab.py
--- src/helpers/tv_grab.py	17 Jul 2005 12:43:34 -0000	1.24
+++ src/helpers/tv_grab.py	8 Aug 2005 20:44:14 -0000
@@ -54,10 +54,10 @@ def grab_xmltv():
 
     print 'Grabbing listings using XMLTV.'
     xmltvtmp = '/tmp/TV.xml.tmp'
-    os.system('%s --output %s --days %s' % ( config.XMLTV_GRABBER, 
-                                             xmltvtmp,
-                                             config.XMLTV_DAYS ))
-    if os.path.exists(xmltvtmp):
+    ec = os.system('%s --output %s --days %s' % ( config.XMLTV_GRABBER, 
+                                                  xmltvtmp,
+                                                  config.XMLTV_DAYS ))
+    if os.path.exists(xmltvtmp) and ec == 0:
         if os.path.isfile(config.XMLTV_SORT):
             print 'Sorting listings.'
             os.system('%s --output %s %s' % ( config.XMLTV_SORT,
@@ -72,6 +72,15 @@ def grab_xmltv():
         print 'Loading data into epgdb, this may take a while'
 
         shutil.move(xmltvtmp, config.XMLTV_FILE)
+    else:
+        sys.stderr.write("ERROR: xmltv grabbing failed; "
+                         "%s returned exit code %d.\n" %
+                         (config.XMLTV_GRABBER, ec >> 8))
+        sys.stderr.write("  If you did not change your system, it's likely that "
+                         "the site being grabbed did.\n  You might want to try "
+                         "whether updating your xmltv helps in that case:\n"
+                         "    http://www.xmltv.org/\n";)
+        sys.exit(1)
 
     kaa.epg.update('xmltv', config.XMLTV_FILE)
 

Reply via email to