[mythtv] [PATCH] mythfilldatabase force refresh of any day (repost)

Charlie Brej brejc8 at vu.a.la
Sat May 22 11:12:48 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. (filldata.cpp.patch.1)
This is a resend because I inlined it reather than attaching. (doh)

The filldata.cpp.patch.2 also contains the first patch along with 
another feature to disable the fetch of new days (Apply the first XOR 
the second). This allows the fetching of several days in paralel. This 
is an example from my daily cron job.

/usr/bin/mythfilldatabase --update --graboptions "--slow" \
	--dont-refresh-tomorrow --dont-fetch-new --refresh-other 0&
/usr/bin/mythfilldatabase --update --graboptions "--slow" \
	--dont-refresh-tomorrow --dont-fetch-new --refresh-other 1&
/usr/bin/mythfilldatabase --update --graboptions "--slow" \
	--dont-refresh-tomorrow --dont-fetch-new --refresh-other 2&
/usr/bin/mythfilldatabase --update --graboptions "--slow" \
	--dont-refresh-tomorrow --dont-fetch-new --refresh-other 5&
/usr/bin/mythfilldatabase --update --graboptions "--slow" \
	--dont-refresh-tomorrow --dont-fetch-new --refresh-other 10&
/usr/bin/mythfilldatabase --update --graboptions "--slow" \
	--dont-refresh-tomorrow &
-------------- next part --------------
Index: programs/mythfilldatabase/filldata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.109
diff -u -r1.109 filldata.cpp
--- programs/mythfilldatabase/filldata.cpp	22 May 2004 05:30:20 -0000	1.109
+++ programs/mythfilldatabase/filldata.cpp	22 May 2004 14:53:24 -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;
@@ -2047,6 +2049,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
@@ -2420,6 +2437,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;
@@ -2482,6 +2520,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
-------------- next part --------------
Index: programs/mythfilldatabase/filldata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.109
diff -u -r1.109 filldata.cpp
--- programs/mythfilldatabase/filldata.cpp	22 May 2004 05:30:20 -0000	1.109
+++ programs/mythfilldatabase/filldata.cpp	22 May 2004 14:47:21 -0000
@@ -41,6 +41,9 @@
 bool refresh_today = false;
 bool refresh_tomorrow = true;
 bool refresh_second = false;
+bool fetch_new = true;
+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;
@@ -2047,6 +2050,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;
+                }
+            }
+
+            if (fetch_new)
+            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
@@ -2420,6 +2438,31 @@
         {
             refresh_second = true;
         }
+        else if (!strcmp(a.argv()[argpos], "--dont-fetch-new"))
+        {
+            fetch_new = false;
+        }
+        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;
@@ -2482,8 +2525,13 @@
             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";
+            cout << "--dont-fetch-new\n";
+            cout << "   New days will be fetched unless this argument is used\n";
 #if 0
             cout << "--dd-grab-all\n";
             cout << "   The DataDirect grabber will grab all available data\n";


More information about the mythtv-dev mailing list