[mythtv] Patch for mythfilldatabase to make tv_grab_sn work...

Magnus Hoglund mho at du.se
Sat Jul 19 23:37:33 EDT 2003


I've been using MythTV for a couple of weeks and think it's great!
Thanks to all developers contributing to the development!

There is however a problem with how xmltv's grabber, tv_grab_sn, works that
causes some problems in mythfilldatabase. The problem is that the site delivering
data to tv_grab_sn (dagenstv.com) "wraps" the day-listing at 06:00am.

This, as an example, means that a program starting at 05:59am on jul 19 gets
"grabbed" in the xmltv-file for july 18, but a program starting at 06:00am
gets "grabbed" in the file for july 19. This causes a series of problems, one
is that it skips whole days if the day before has programs starting after
midnight, which is true for most of the days, resulting in incomplete program-
listings for half the days grabbed...

I've prepared a patch for filldata.cpp that makes tv_grab_sn fetch 14 days of
program-data each time it is called, which is a simple solution to the problem.
You probably could fix the problem in several ways, but I have'nt investigated
the code enough to understand how to catch single days without rewriting the code
extensively... I hope you accept this simple patch...

Magnus Hoglund


--- mythtv/programs/mythfilldatabase/filldata.cpp	2003-07-18 20:10:58 -0000
+++ mythtv/programs/mythfilldatabase/filldata.cpp	2003-07-19 18:30:39 -0000
@@ -1272,6 +1272,11 @@
          command.sprintf("nice -19 %s --days=4 --offset %d --config-file '%s' 
--output %s",
                          xmltv_grabber.ascii(), offset,
                          configfile.ascii(), filename.ascii());
+    else if (xmltv_grabber == "tv_grab_sn")
+        // Use fixed interval of 14 days for Swedish/Norwegian grabber
+        command.sprintf("nice -19 %s --days 14 --config-file '%s' --output %s",
+                        xmltv_grabber.ascii(), configfile.ascii(),
+                        filename.ascii());
          isNorthAmerica = true;
@@ -1351,6 +1356,16 @@
              if (!grabData(*it, -1))
+        else if (xmltv_grabber == "tv_grab_sn")
+        {
+            // tv_grab_sn has problems grabbing one day at a time as the site
+            // (dagenstv.com) "wraps" the day-listings at 06:00am. This means
+            // that programs starting at 02:00am on jul 19 gets "grabbed" in
+            // the xmltv-file for jul 18, causing all sorts of trouble.
+            // The simple solution is to grab the full two weeks every time.
+            if (!grabData(*it, 0))
+                ++failures;
+        }
          else if (xmltv_grabber == "tv_grab_nz")
  	    // tv_grab_nz only supports a 7-day "grab".
@@ -1387,8 +1402,7 @@
          else if (xmltv_grabber == "tv_grab_na" ||
-                 xmltv_grabber == "tv_grab_aus" ||
-                 xmltv_grabber == "tv_grab_sn")
+                 xmltv_grabber == "tv_grab_aus")
              if (!grabData(*it, 1))

More information about the mythtv-dev mailing list