[mythtv] [PATCH] mythfilldatabase force refresh of any day

Charles Brej cb at cs.man.ac.uk
Sat May 15 13:36:36 EDT 2004


This patch allows you to refresh any day in advance (not just today/tomorrow and 
second). --refresh-other <offset> with <offset> being the number of days into 
the future (0 being today). You can specify more than one day to be refreshed by 
repeating the command. e.g "--refresh-other 5 refresh-other 9" works well to 
remove the TBAs on uk_rt.


-- 
         Charlie Brej
APT Group, Dept. Computer Science, University of Manchester
Web: http://www.cs.man.ac.uk/~brejc8/ Tel: +44 161 275 6844
Mail: IT302, Manchester University, Manchester, M13 9PL, UK



Index: filldata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.104
diff -u -r1.104 filldata.cpp
--- filldata.cpp	8 May 2004 00:46:15 -0000	1.104
+++ filldata.cpp	13 May 2004 21:26:53 -0000
@@ -41,6 +41,8 @@
  bool refresh_today = false;
  bool refresh_tomorrow = true;
  bool refresh_second = false;
+bool refresh_other[20] = 
{false,false,false,false,false,false,false,false,false,false,
+ 
false,false,false,false,false,false,false,false,false,false};
  bool refresh_tba = true;
  int listing_wrap_offset = 0;
  bool dd_grab_all = false;
@@ -2034,6 +2036,21 @@
                  if ((i == 0 && refresh_today) || (i == 1 && refresh_tomorrow) ||
                      (i == 2 && refresh_second))
                      continue;
+                if(refresh_other[i])
+                {
+                if (!quiet)
+                    cout << "Refreshing data for " << i << " days from today" 
<< endl;
+                if (!grabData(*it, i, &qCurrentDate))
+                    ++failures;
+                }
+            }
+
+
+            for (int i = 0; i < maxday; i++)
+            {
+                if ((i == 0 && refresh_today) || (i == 1 && refresh_tomorrow) ||
+                    (i == 2 && refresh_second) || refresh_other[i])
+                    continue;

                  // we need to check and see if the current date has changed
                  // since we started in this loop.  If it has, we need to adjust
@@ -2407,6 +2424,27 @@
          {
              refresh_second = true;
          }
+        else if (!strcmp(a.argv()[argpos], "--refresh-other"))
+        {
+            if (((argpos + 1) >= a.argc()))
+            {
+                printf("missing parameter for --refresh-other option\n");
+                return -1;
+            }
+
+            int refresh_other_index = atoi(a.argv()[++argpos]);
+            if (refresh_other_index <20 && refresh_other_index >=0)
+            {
+                refresh_other[refresh_other_index] = true;
+                if (!quiet)
+                     cout << "### forcing fetch of day "<< refresh_other_index 
<< " \n";
+            }
+            else
+            {
+                printf("--refresh-other offset out of range\n");
+                return -1;
+            }
+        }
          else if (!strcmp(a.argv()[argpos], "--dont-refresh-tba"))
          {
              refresh_tba = false;
@@ -2469,6 +2507,9 @@
              cout << "   Force a refresh today or two days from now, to catch 
the latest changes\n";
              cout << "--dont-refresh-tomorrow\n";
              cout << "   Tomorrow will be refreshed always unless this argument 
is used\n";
+            cout << "--refresh-other <offset>\n";
+            cout << "   Force a refresh <offset> days from now, to catch the 
latest changes\n";
+            cout << "   <offset> = days from now (0 is today)\n";
              cout << "--dont-refresh-tba\n";
              cout << "   \"To be announced\" progs will be refreshed always 
unless this argument is used\n";
  #if 0

-- 
         Charlie Brej
APT Group, Dept. Computer Science, University of Manchester
Web: http://www.cs.man.ac.uk/~brejc8/ Tel: +44 161 275 6844
Mail: IT302, Manchester University, Manchester, M13 9PL, UK


More information about the mythtv-dev mailing list