Ticket #4110: fillday.patch
File fillday.patch, 8.0 KB (added by , 16 years ago) |
---|
-
programs/mythfilldatabase/filldata.cpp
684 684 685 685 // We'll keep grabbing until it returns nothing 686 686 // Max days currently supported is 21 687 int grabdays = 21;687 int grabdays = REFRESH_MAX; 688 688 689 689 if (maxDays > 0) // passed with --max-days 690 690 grabdays = maxDays; … … 694 694 grabdays = (only_update_channels) ? 1 : grabdays; 695 695 696 696 if (grabdays == 1) 697 refresh_ today= true;697 refresh_request[0] = true; 698 698 699 699 if (is_grabber_datadirect(xmltv_grabber) && only_update_channels) 700 700 { … … 725 725 726 726 bool download_needed = false; 727 727 728 if (refresh_ all)728 if (refresh_request[i]) 729 729 { 730 VERBOSE(VB_GENERAL, 731 "Data Refresh needed because of --refresh-all"); 732 download_needed = true; 733 } 734 else if ((i == 0 && refresh_today) || (i == 1 && refresh_tomorrow) || 735 (i == 2 && refresh_second)) 736 { 737 // Always refresh if the user specified today/tomorrow/second. 738 if (refresh_today) 730 if( i == 1 ) 739 731 { 740 741 "Data Refresh needed because user specified --refresh-today");732 VERBOSE(VB_GENERAL, 733 "Data Refresh always needed for tomorrow"); 742 734 } 743 else if (refresh_second) 744 { 745 VERBOSE(VB_GENERAL, 746 "Data Refresh needed because user specified --refresh-second"); 747 } 748 else 749 { 750 VERBOSE(VB_GENERAL, 751 "Data Refresh always needed for tomorrow"); 752 } 735 else 736 { 737 VERBOSE(VB_GENERAL, 738 "Data Refresh needed because of user request"); 739 } 753 740 download_needed = true; 754 741 } 755 742 else -
programs/mythfilldatabase/main.cpp
207 207 208 208 fill_data.maxDays = QString(a.argv()[++argpos]).toInt(); 209 209 210 if (fill_data.maxDays < 1 || fill_data.maxDays > 21)210 if (fill_data.maxDays < 1 || fill_data.maxDays > REFRESH_MAX) 211 211 { 212 212 printf("ignoring invalid parameter for --max-days\n"); 213 213 fill_data.maxDays = 0; … … 215 215 } 216 216 else if (!strcmp(a.argv()[argpos], "--refresh-today")) 217 217 { 218 fill_data.refresh_ today= true;218 fill_data.refresh_request[0] = true; 219 219 } 220 220 else if (!strcmp(a.argv()[argpos], "--dont-refresh-tomorrow")) 221 221 { 222 fill_data.refresh_ tomorrow= false;222 fill_data.refresh_request[1] = false; 223 223 } 224 224 else if (!strcmp(a.argv()[argpos], "--refresh-second")) 225 225 { 226 fill_data.refresh_ second= true;226 fill_data.refresh_request[2] = true; 227 227 } 228 228 else if (!strcmp(a.argv()[argpos], "--refresh-all")) 229 229 { 230 fill_data.refresh_all = true; 230 for( int i = 0; i < REFRESH_MAX; i++ ) 231 fill_data.refresh_request[i] = true; 231 232 } 233 else if (!strcmp(a.argv()[argpos], "--refresh-day")) 234 { 235 if (((argpos + 1) >= a.argc())) 236 { 237 printf("missing parameter for --refresh-day option\n"); 238 return FILLDB_EXIT_INVALID_CMDLINE; 239 } 240 241 int day = QString(a.argv()[++argpos]).toInt(); 242 243 if (day < 0 || day > REFRESH_MAX) 244 { 245 printf("ignoring invalid parameter for --refresh-day\n"); 246 } 247 else 248 { 249 fill_data.refresh_request[day] = true; 250 } 251 } 232 252 else if (!strcmp(a.argv()[argpos], "--dont-refresh-tba")) 233 253 { 234 254 fill_data.refresh_tba = false; … … 258 278 else if (!strcmp(a.argv()[argpos], "--dd-grab-all")) 259 279 { 260 280 fill_data.dd_grab_all = true; 261 fill_data.refresh_today = false; 262 fill_data.refresh_tomorrow = false; 263 fill_data.refresh_second = false; 281 for( int i = 0; i < REFRESH_MAX; i++ ) 282 fill_data.refresh_request[i] = false; 264 283 } 265 284 #endif 266 285 else if (!strcmp(a.argv()[argpos], "--quiet")) … … 416 435 cout << "--refresh-today\n"; 417 436 cout << "--refresh-second\n"; 418 437 cout << "--refresh-all\n"; 438 cout << "--refresh-day <number>"; 419 439 cout << " (Only valid for selected grabbers: e.g. DataDirect)\n"; 420 cout << " Force a refresh today or two days (or every day)from now,\n";440 cout << " Force a refresh today, two days, every day, or a specific day from now,\n"; 421 441 cout << " to catch the latest changes\n"; 422 442 cout << "--dont-refresh-tomorrow\n"; 423 443 cout << " Tomorrow will always be refreshed unless this argument is used\n"; -
programs/mythfilldatabase/filldata.h
14 14 #include "xmltvparser.h" 15 15 #include "icondata.h" 16 16 17 #define REFRESH_MAX 21 18 17 19 struct Source 18 20 { 19 21 int id; … … 37 39 lastdduserid(QString::null), graboptions(""), 38 40 raw_lineup(0), maxDays(0), 39 41 interrupted(false), endofdata(false), 40 refresh_today(false), refresh_tomorrow(true),41 refresh_second(false), refresh_all(false),42 42 refresh_tba(true), dd_grab_all(false), 43 43 dddataretrieved(false), 44 44 need_post_grab_proc(true), only_update_channels(false), 45 channel_update_run(false) {} 45 channel_update_run(false) { 46 for( int i = 0; i < REFRESH_MAX; i++ ) refresh_request[i] = false; 47 refresh_request[1] = true; 48 } 46 49 47 50 void DataDirectStationUpdate(Source source, bool update_icons = true); 48 51 bool DataDirectUpdateChannels(Source source); … … 71 74 72 75 bool interrupted; 73 76 bool endofdata; 74 bool refresh_today; 75 bool refresh_tomorrow; 76 bool refresh_second; 77 bool refresh_all; 77 bool refresh_request[REFRESH_MAX]; 78 78 bool refresh_tba; 79 79 bool dd_grab_all; 80 80 bool dddataretrieved; -
contrib/smartfill
1 #! /bin/sh 2 3 MFD=/var/log/MFD.out 4 5 # Have a rolling refresh one week from now, since one channel has a bunch 6 # of shows running one week late 7 arg="--refresh-day 7" 8 9 # Several shows are maybe re-broadcast on the weekend, so we want to force 10 # the weekend to refresh while we still have a chance to record them today 11 day=`date +%u` # %u day of week (1..7); 1 is Monday 12 saturday=`expr 6 - $day` 13 sunday=`expr 7 - $day` 14 if [ $day -le 4 ]; then 15 arg="$arg --refresh-day $saturday --refresh-day $sunday" 16 fi 17 18 # With the random start times sometimes when we run just past midnight it 19 # can mean that the data for today isn't refreshed with the default behaviour 20 hour=`date +%H` 21 if [ $hour -le 6 ]; then 22 arg="$arg --refresh-today" 23 fi 24 25 optimize_mythdb.pl 26 mythfilldatabase --remove-new-channels $arg | tee $MFD 27