Ticket #1777: mythfilldatabase_capabilities_backport.2.diff
File mythfilldatabase_capabilities_backport.2.diff, 28.5 KB (added by , 17 years ago) |
---|
-
mythtv/programs/mythfilldatabase/filldata.cpp
12 12 #include <qsqldatabase.h> 13 13 #include <qsqlquery.h> 14 14 #include <qurl.h> 15 #include <qprocess.h> 15 16 16 17 #include <unistd.h> 17 18 #include <signal.h> … … 54 55 bool isNorthAmerica = false; 55 56 bool isJapan = false; 56 57 bool interrupted = false; 58 bool endofdata = false; 57 59 bool refresh_today = false; 58 60 bool refresh_tomorrow = true; 59 61 bool refresh_second = false; … … 212 214 QString userid; 213 215 QString password; 214 216 QString lineupid; 217 bool xmltvgrabber_baseline; 218 bool xmltvgrabber_manualconfig; 219 bool xmltvgrabber_cache; 220 QString xmltvgrabber_prefmethod; 215 221 }; 216 222 217 223 … … 2505 2511 return false; 2506 2512 2507 2513 handleChannels(id, &chanlist); 2508 handlePrograms(id, &proglist); 2514 if (proglist.count() == 0) { 2515 VERBOSE(VB_GENERAL, 2516 QString("No programs found in data.")); 2517 endofdata = true; 2518 } 2519 else { 2520 handlePrograms(id, &proglist); 2521 } 2522 2509 2523 return true; 2510 2524 } 2511 2525 … … 2533 2547 return grabDDData(source, offset, *qCurrentDate, DD_ZAP2IT); 2534 2548 else if (xmltv_grabber == "technovera") 2535 2549 { 2536 VERBOSE(VB_ ALL, "Thisgrabber is no longer supported");2550 VERBOSE(VB_IMPORTANT, "The technovera grabber is no longer supported"); 2537 2551 exit(FILLDB_EXIT_INVALID_CMDLINE); 2538 2552 } 2539 2553 2540 2554 char tempfilename[] = "/tmp/mythXXXXXX"; 2541 2555 if (mkstemp(tempfilename) == -1) 2542 2556 { … … 2551 2565 QString home = QDir::homeDirPath(); 2552 2566 QString configfile = QString("%1/%2.xmltv").arg(MythContext::GetConfDir()) 2553 2567 .arg(source.name); 2554 QString command;2555 2568 2556 if (xmltv_grabber == "tv_grab_uk") 2557 command.sprintf("nice %s --days 7 --config-file '%s' --output %s", 2558 xmltv_grabber.ascii(), configfile.ascii(), 2559 filename.ascii()); 2560 else if (xmltv_grabber == "tv_grab_uk_rt") 2561 command.sprintf("nice %s --days 14 --config-file '%s' --output %s", 2562 xmltv_grabber.ascii(), 2563 configfile.ascii(), filename.ascii()); 2564 else if (xmltv_grabber == "tv_grab_au") 2565 command.sprintf("nice %s --days 7 --config-file '%s' --output %s", 2566 xmltv_grabber.ascii(), configfile.ascii(), 2567 filename.ascii()); 2568 else if (xmltv_grabber == "tv_grab_de_tvtoday") 2569 command.sprintf("nice %s --slow --days 1 --config-file '%s' --offset %d --output %s", 2570 xmltv_grabber.ascii(), configfile.ascii(), 2571 offset, filename.ascii()); 2572 else if (xmltv_grabber == "tv_grab_fr") 2573 command.sprintf("nice %s --days 7 --config-file '%s' --output %s", 2574 xmltv_grabber.ascii(), configfile.ascii(), 2575 filename.ascii()); 2576 else if (xmltv_grabber == "tv_grab_nl") 2577 command.sprintf("nice %s --config-file '%s' --output %s", 2578 xmltv_grabber.ascii(), configfile.ascii(), 2579 filename.ascii()); 2580 else if (xmltv_grabber == "tv_grab_fi") 2581 // Use the default of 10 days for Finland's grabber 2582 command.sprintf("nice %s --config-file '%s' --output %s", 2583 xmltv_grabber.ascii(), configfile.ascii(), 2584 filename.ascii()); 2585 else if (xmltv_grabber == "tv_grab_es" || 2586 xmltv_grabber == "tv_grab_es_laguiatv") 2587 // Use fixed interval of 3 days for Spanish grabber 2588 command.sprintf("nice %s --days=4 --config-file '%s' --output %s", 2589 xmltv_grabber.ascii(), 2590 configfile.ascii(), filename.ascii()); 2591 else if (xmltv_grabber == "tv_grab_jp") 2569 QString command = QString("nice %1 --config-file '%2' --output %3") 2570 .arg(xmltv_grabber.ascii()) 2571 .arg(configfile.ascii()) 2572 .arg(filename.ascii()); 2573 2574 // The one concession to grabber specific behaviour. 2575 // Will be removed when the grabber allows. 2576 if (xmltv_grabber == "tv_grab_jp") 2592 2577 { 2593 // Use fixed interval of 7 days for Japanese grabber 2594 command.sprintf("nice %s --days 7 --enable-readstr --config-file '%s' --output %s", 2595 xmltv_grabber.ascii(), configfile.ascii(), 2596 filename.ascii()); 2597 isJapan = true; 2578 command += QString(" --enable-readstr"); 2579 isJapan = true; 2598 2580 } 2599 else if (xmltv_grabber == "tv_grab_no") 2600 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s", 2601 xmltv_grabber.ascii(), offset, configfile.ascii(), 2602 filename.ascii()); 2603 else if (xmltv_grabber == "tv_grab_se_swedb") 2604 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s", 2605 xmltv_grabber.ascii(), offset, configfile.ascii(), 2606 filename.ascii()); 2607 else if (xmltv_grabber == "tv_grab_dk") 2608 // Use fixed interval of 7 days for Danish grabber 2609 command.sprintf("nice %s --days 7 --config-file '%s' --output %s", 2610 xmltv_grabber.ascii(), configfile.ascii(), 2611 filename.ascii()); 2612 else if (xmltv_grabber == "tv_grab_pt") 2613 // Use fixed interval of 3 days for Portuguese grabber 2614 command.sprintf("nice %s --days=4 --config-file '%s' --output %s", 2615 xmltv_grabber.ascii(), 2616 configfile.ascii(), filename.ascii()); 2617 else if (xmltv_grabber == "tv_grab_be_tvb") 2618 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s", 2619 xmltv_grabber.ascii(), offset, configfile.ascii(), 2620 filename.ascii()); 2621 else if (xmltv_grabber == "tv_grab_be_tlm") 2622 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s", 2623 xmltv_grabber.ascii(), offset, configfile.ascii(), 2624 filename.ascii()); 2625 else if (xmltv_grabber == "tv_grab_ee") 2626 // Estonian grabber returns all known data by default 2627 command.sprintf("nice %s --output %s", 2628 xmltv_grabber.ascii(), 2629 filename.ascii()); 2630 else if (xmltv_grabber == "tv_grab_il") 2631 // Israeli grabber returns all known data by default 2632 command.sprintf("nice %s --config-file '%s' --output %s", 2633 xmltv_grabber.ascii(), configfile.ascii(), 2634 filename.ascii()); 2635 else if (xmltv_grabber == "tv_grab_ru") 2636 // Russian grabber returns all known data by default 2637 command.sprintf("nice %s --config-file '%s' --output %s", 2638 xmltv_grabber.ascii(), configfile.ascii(), 2639 filename.ascii()); 2640 else 2581 else if (source.xmltvgrabber_prefmethod != "allatonce") 2641 2582 { 2642 isNorthAmerica = true; 2643 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' " 2644 "--output %s", xmltv_grabber.ascii(), 2645 offset, configfile.ascii(), filename.ascii()); 2583 // XMLTV Docs don't recommend grabbing one day at a 2584 // time but the current myth code is heavily geared 2585 // that way so until it is re-written behave as 2586 // we always have done. 2587 command += QString(" --days 1 --offset %1").arg(offset); 2646 2588 } 2647 2589 2648 if (((print_verbose_messages & VB_GENERAL) == 0) &&2649 (xmltv_grabber == "tv_grab_na" ||2650 xmltv_grabber == "tv_grab_de_tvtoday" ||2651 xmltv_grabber == "tv_grab_fi" ||2652 xmltv_grabber == "tv_grab_es" ||2653 xmltv_grabber == "tv_grab_es_laguiatv" ||2654 xmltv_grabber == "tv_grab_se_swedb" ||2655 xmltv_grabber == "tv_grab_no" ||2656 xmltv_grabber == "tv_grab_dk" ||2657 xmltv_grabber == "tv_grab_uk" ||2658 xmltv_grabber == "tv_grab_uk_rt" ||2659 xmltv_grabber == "tv_grab_nl" ||2660 xmltv_grabber == "tv_grab_fr" ||2661 xmltv_grabber == "tv_grab_fi" ||2662 xmltv_grabber == "tv_grab_jp" ||2663 xmltv_grabber == "tv_grab_pt" ||2664 xmltv_grabber == "tv_grab_be_tvb" ||2665 xmltv_grabber == "tv_grab_be_tlm" ||2666 xmltv_grabber == "tv_grab_ee" ||2667 xmltv_grabber == "tv_grab_ru"))2668 command += " --quiet";2669 2670 2671 2590 command += graboptions; 2672 2591 2673 VERBOSE(VB_GENERAL,2674 "----------------- Start of XMLTV output -----------------");2592 if (! (print_verbose_messages & VB_GENERAL)) 2593 command += " --quiet"; 2675 2594 2676 2595 QDateTime qdtNow = QDateTime::currentDateTime(); 2677 2596 MSqlQuery query(MSqlQuery::InitCon()); … … 2685 2604 "WHERE value='mythfilldatabaseLastRunStatus'") 2686 2605 .arg(status)); 2687 2606 2607 VERBOSE(VB_GENERAL, QString("Grabber Command: %1").arg(command)); 2608 2609 VERBOSE(VB_GENERAL, 2610 "----------------- Start of XMLTV output -----------------"); 2611 2688 2612 int systemcall_status = system(command.ascii()); 2689 2613 bool succeeded = WIFEXITED(systemcall_status) && 2690 2614 WEXITSTATUS(systemcall_status) == 0; 2691 2615 2616 VERBOSE(VB_GENERAL, 2617 "------------------ End of XMLTV output ------------------"); 2618 2692 2619 qdtNow = QDateTime::currentDateTime(); 2693 2620 query.exec(QString("UPDATE settings SET data ='%1' " 2694 2621 "WHERE value='mythfilldatabaseLastRunEnd'") … … 2704 2631 query.exec(QString("UPDATE settings SET data ='%1' " 2705 2632 "WHERE value='mythfilldatabaseLastRunStatus'") 2706 2633 .arg(status)); 2634 2635 VERBOSE(VB_GENERAL, status); 2636 2707 2637 if (WIFSIGNALED(systemcall_status) && 2708 2638 (WTERMSIG(systemcall_status) == SIGINT || WTERMSIG(systemcall_status) == SIGQUIT)) 2709 2639 interrupted = true; 2710 2640 } 2711 2712 VERBOSE(VB_GENERAL,2713 "------------------ End of XMLTV output ------------------");2714 2641 2715 2642 grabDataFromFile(source.id, filename); 2716 2643 … … 2834 2761 int failures = 0; 2835 2762 int externally_handled = 0; 2836 2763 int total_sources = sourcelist.size(); 2764 int source_channels = 0; 2837 2765 2838 query.exec(QString("SELECT MAX(endtime) FROM program WHERE manualid=0;"));2839 if (query.isActive() && query.size() > 0)2840 {2841 query.next();2842 2843 if (!query.isNull(0))2844 GuideDataBefore = QDateTime::fromString(query.value(0).toString(),2845 Qt::ISODate);2846 }2847 2848 2766 QString sidStr = QString("Updating source #%1 (%2) with grabber %3"); 2849 2767 2850 2768 need_post_grab_proc = false; 2769 int nonewdata = 0; 2851 2770 2852 2771 for (it = sourcelist.begin(); it != sourcelist.end(); ++it) 2853 2772 { 2773 2774 query.prepare("SELECT MAX(endtime) FROM program p LEFT JOIN channel c " 2775 "ON p.chanid=c.chanid WHERE c.sourceid= :SRCID " 2776 "AND manualid = 0;"); 2777 query.bindValue(":SRCID", (*it).id); 2778 query.exec(); 2779 if (query.isActive() && query.size() > 0) 2780 { 2781 query.next(); 2782 2783 if (!query.isNull(0)) 2784 GuideDataBefore = QDateTime::fromString(query.value(0).toString(), 2785 Qt::ISODate); 2786 } 2787 2854 2788 channel_update_run = false; 2789 endofdata = false; 2790 2791 QString xmltv_grabber = (*it).xmltvgrabber; 2792 2793 if (xmltv_grabber == "eitonly") 2794 { 2795 VERBOSE(VB_IMPORTANT, "Source configured to use only the " 2796 "broadcasted guide data. Skipping."); 2797 externally_handled++; 2798 query.exec(QString("UPDATE settings SET data ='%1' " 2799 "WHERE value='mythfilldatabaseLastRunStart' OR " 2800 "value = 'mythfilldatabaseLastRunEnd'") 2801 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm"))); 2802 continue; 2803 } 2804 else if (xmltv_grabber == "/bin/true" || 2805 xmltv_grabber == "none" || 2806 xmltv_grabber == "") 2807 { 2808 VERBOSE(VB_IMPORTANT, 2809 "Source configured with no grabber. Nothing to do."); 2810 externally_handled++; 2811 query.exec(QString("UPDATE settings SET data ='%1' " 2812 "WHERE value='mythfilldatabaseLastRunStart' OR " 2813 "value = 'mythfilldatabaseLastRunEnd'") 2814 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm"))); 2815 continue; 2816 } 2817 2855 2818 VERBOSE(VB_GENERAL, sidStr.arg((*it).id) 2856 2819 .arg((*it).name) 2857 .arg( (*it).xmltvgrabber));2820 .arg(xmltv_grabber)); 2858 2821 2859 QString xmltv_grabber = (*it).xmltvgrabber; 2860 need_post_grab_proc |= (xmltv_grabber != "datadirect"); 2822 query.prepare( 2823 "SELECT COUNT(chanid) FROM channel WHERE sourceid = " 2824 ":SRCID AND xmltvid != ''"); 2825 query.bindValue(":SRCID", (*it).id); 2826 query.exec(); 2861 2827 2862 if (xmltv_grabber == "tv_grab_uk" || xmltv_grabber == "tv_grab_uk_rt" || 2863 xmltv_grabber == "tv_grab_fi" || xmltv_grabber == "tv_grab_es" || 2864 xmltv_grabber == "tv_grab_es_laguiatv" || 2865 xmltv_grabber == "tv_grab_nl" || xmltv_grabber == "tv_grab_au" || 2866 xmltv_grabber == "tv_grab_fr" || xmltv_grabber == "tv_grab_jp" || 2867 xmltv_grabber == "tv_grab_pt" || xmltv_grabber == "tv_grab_ee" || 2868 xmltv_grabber == "tv_grab_dk") 2828 if (query.isActive() && query.size() > 0) { 2829 query.next(); 2830 source_channels = query.value(0).toInt(); 2831 if (source_channels > 0) 2832 { 2833 VERBOSE(VB_GENERAL, QString("Found %1 channels for " 2834 "source %2 which use grabber") 2835 .arg(source_channels).arg((*it).id)); 2836 } 2837 else 2838 { 2839 VERBOSE(VB_GENERAL, QString("No channels are " 2840 "configured to use grabber.")); 2841 } 2842 } 2843 else { 2844 source_channels = 0; 2845 VERBOSE(VB_GENERAL, 2846 QString("Can't get a channel count for source id %1") 2847 .arg((*it).id)); 2848 } 2849 2850 bool hasprefmethod = false; 2851 2852 if (xmltv_grabber != "datadirect") { 2853 2854 QProcess grabber_capabilities_proc(xmltv_grabber); 2855 grabber_capabilities_proc.addArgument(QString("--capabilities")); 2856 if ( grabber_capabilities_proc.start() ) 2857 { 2858 2859 int i=0; 2860 // Assume it shouldn't take more than 10 seconds 2861 // Broken versions of QT cause QProcess::start 2862 // and QProcess::isRunning to return true even 2863 // when the executable doesn't exist 2864 while (grabber_capabilities_proc.isRunning() && i < 100) 2865 { 2866 usleep(100000); 2867 ++i; 2868 } 2869 2870 if (grabber_capabilities_proc.normalExit()) 2871 { 2872 QString capabilites = ""; 2873 2874 while (grabber_capabilities_proc.canReadLineStdout()) 2875 { 2876 QString capability 2877 = grabber_capabilities_proc.readLineStdout(); 2878 capabilites += capability + " "; 2879 2880 if (capability == "baseline") 2881 (*it).xmltvgrabber_baseline = true; 2882 2883 if (capability == "manualconfig") 2884 (*it).xmltvgrabber_manualconfig = true; 2885 2886 if (capability == "cache") 2887 (*it).xmltvgrabber_cache = true; 2888 2889 if (capability == "preferredmethod") 2890 hasprefmethod = true; 2891 } 2892 2893 VERBOSE(VB_GENERAL, QString("Grabber has capabilities: %1") 2894 .arg(capabilites)); 2895 } 2896 else { 2897 VERBOSE(VB_IMPORTANT, "%1 --capabilities failed or we " 2898 "timed out waiting. You may need to upgrade your " 2899 "xmltv grabber"); 2900 } 2901 } 2902 else { 2903 QString error = grabber_capabilities_proc.readLineStdout(); 2904 VERBOSE(VB_IMPORTANT, QString("Failed to run %1 " 2905 "--capabilities").arg(xmltv_grabber)); 2906 } 2907 } 2908 2909 2910 if (hasprefmethod) 2869 2911 { 2870 // These don't support the --offset option, so just grab the max. 2871 // TODO: tv_grab_fi/dk/is seems to support --offset, maybe more. Needs verification. 2872 if (!grabData(*it, 0)) 2873 ++failures; 2912 2913 QProcess grabber_method_proc(xmltv_grabber); 2914 grabber_method_proc.addArgument("--preferredmethod"); 2915 if ( grabber_method_proc.start() ) 2916 { 2917 int i=0; 2918 // Assume it shouldn't take more than 10 seconds 2919 // Broken versions of QT cause QProcess::start 2920 // and QProcess::isRunning to return true even 2921 // when the executable doesn't exist 2922 while (grabber_method_proc.isRunning() && i < 100) 2923 { 2924 usleep(100000); 2925 ++i; 2926 } 2927 2928 if (grabber_method_proc.normalExit()) 2929 { 2930 (*it).xmltvgrabber_prefmethod = 2931 grabber_method_proc.readLineStdout(); 2932 } 2933 else { 2934 VERBOSE(VB_IMPORTANT, "%1 --preferredmethod failed or we " 2935 "timed out waiting. You may need to upgrade your " 2936 "xmltv grabber"); 2937 } 2938 2939 VERBOSE(VB_GENERAL, QString("Grabber prefers method: %1") 2940 .arg((*it).xmltvgrabber_prefmethod)); 2941 } 2942 else { 2943 QString error = grabber_method_proc.readLineStdout(); 2944 VERBOSE(VB_IMPORTANT, QString("Failed to run %1 --preferredmethod") 2945 .arg(xmltv_grabber)); 2946 } 2874 2947 } 2875 else if ((xmltv_grabber == "datadirect") && dd_grab_all) 2948 2949 need_post_grab_proc |= (xmltv_grabber != "datadirect"); 2950 2951 if ((xmltv_grabber == "datadirect") && dd_grab_all) 2876 2952 { 2877 2953 if (only_update_channels) 2878 2954 DataDirectUpdateChannels(*it); … … 2882 2958 grabData(*it, 0, &qCurrentDate); 2883 2959 } 2884 2960 } 2885 else if (xmltv_grabber == "datadirect" || 2886 xmltv_grabber == "tv_grab_se_swedb" || 2887 xmltv_grabber == "tv_grab_no" || 2888 xmltv_grabber == "tv_grab_de_tvtoday" || 2889 xmltv_grabber == "tv_grab_be_tvb" || 2890 xmltv_grabber == "tv_grab_be_tlm" || 2891 xmltv_grabber == "tv_grab_is" || 2892 xmltv_grabber == "tv_grab_br" || 2893 xmltv_grabber == "tv_grab_cz" || 2894 xmltv_grabber == "tv_grab_ru") 2961 else if ((*it).xmltvgrabber_prefmethod == "allatonce") 2895 2962 { 2896 // Grabbers supporting the --offset option 2963 if (!grabData(*it, 0)) 2964 ++failures; 2965 } 2966 else if ((*it).xmltvgrabber_baseline || xmltv_grabber == "datadirect") 2967 { 2897 2968 2898 if (xmltv_grabber == "tv_grab_no")2899 listing_wrap_offset = 6 * 3600;2900 2901 2969 QDate qCurrentDate = QDate::currentDate(); 2902 2970 2903 int grabdays = 9; 2971 // We'll keep grabbing until it returns nothing 2972 // Max days currently supported is 21 2973 int grabdays = 21; 2904 2974 2905 // Grab different amount of days for the different grabbers,2906 // often decided by the person maintaining the grabbers.2907 2975 if (maxDays > 0) // passed with --max-days 2908 2976 grabdays = maxDays; 2909 2977 else if (xmltv_grabber == "datadirect") 2910 2978 grabdays = 14; 2911 else if (xmltv_grabber == "tv_grab_se_swedb")2912 grabdays = 10;2913 else if (xmltv_grabber == "tv_grab_no" ||2914 xmltv_grabber == "tv_grab_de_tvtoday")2915 grabdays = 7;2916 else if (xmltv_grabber == "tv_grab_be_tvb" ||2917 xmltv_grabber == "tv_grab_be_tlm")2918 grabdays = 5;2919 2979 2920 2980 grabdays = (only_update_channels) ? 1 : grabdays; 2921 2981 … … 2961 3021 (i == 2 && refresh_second)) 2962 3022 { 2963 3023 // Always refresh if the user specified today/tomorrow/second. 2964 download_needed = true; 3024 if (refresh_today) { 3025 VERBOSE(VB_GENERAL, 3026 "Data Refresh needed because user specified --refresh-today"); 3027 } 3028 else if (refresh_second) { 3029 VERBOSE(VB_GENERAL, 3030 "Data Refresh needed because user specified --refresh-second"); 3031 } 3032 else { 3033 VERBOSE(VB_GENERAL, 3034 "Data Refresh always needed for tomorrow"); 3035 } 2965 3036 } 2966 else if (xmltv_grabber == "tv_grab_se_swedb")2967 {2968 // Since tv_grab_se_swedb handles caching internally,2969 // let it do its job and always grab new data.2970 VERBOSE(VB_GENERAL,2971 "Data Refresh needed because the grabber relies on "2972 "internal caching.");2973 download_needed = true;2974 }2975 3037 else 2976 3038 { 2977 3039 // Check to see if we already downloaded data for this date. … … 2987 3049 "INTERVAL '%1' DAY), INTERVAL '18' HOUR) " 2988 3050 " AND starttime < DATE_ADD(CURRENT_DATE(), " 2989 3051 "INTERVAL '%2' DAY) " 2990 "WHERE c.sourceid = %3 "3052 "WHERE c.sourceid = %3 AND c.xmltvid != '' " 2991 3053 "GROUP BY c.chanid;"; 2992 3054 2993 3055 if (query.exec(querystr.arg(i-1).arg(i).arg((*it).id)) && 2994 3056 query.isActive()) 2995 3057 { … … 3086 3148 "offset day %2.").arg(i-1).arg(i)); 3087 3149 download_needed = true; 3088 3150 } 3089 } 3151 } 3090 3152 3091 3153 if (download_needed) 3092 3154 { … … 3100 3162 break; 3101 3163 } 3102 3164 } 3165 3166 if (endofdata) { 3167 VERBOSE(VB_GENERAL, 3168 QString("Grabber is no longer returning program data, finishing")); 3169 break; 3170 } 3171 3103 3172 } 3104 3173 else 3105 3174 { … … 3109 3178 } 3110 3179 } 3111 3180 } 3112 else if (xmltv_grabber == "eitonly")3113 {3114 VERBOSE(VB_IMPORTANT, "Source configured to use only the "3115 "broadcasted guide data. Skipping.");3116 externally_handled++;3117 query.exec(QString("UPDATE settings SET data ='%1' "3118 "WHERE value='mythfilldatabaseLastRunStart' OR "3119 "value = 'mythfilldatabaseLastRunEnd'")3120 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm")));3121 }3122 else if (xmltv_grabber == "/bin/true" ||3123 xmltv_grabber == "none" ||3124 xmltv_grabber == "")3125 {3126 VERBOSE(VB_IMPORTANT,3127 "Source configured with no grabber. Nothing to do.");3128 externally_handled++;3129 query.exec(QString("UPDATE settings SET data ='%1' "3130 "WHERE value='mythfilldatabaseLastRunStart' OR "3131 "value = 'mythfilldatabaseLastRunEnd'")3132 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm")));3133 }3134 3181 else 3135 3182 { 3136 3183 VERBOSE(VB_IMPORTANT, 3137 3184 QString("Grabbing XMLTV data using ") + xmltv_grabber + 3138 " is not verified as working."); 3185 " is not supported. You may need to upgrade to" 3186 " the latest version of XMLTV."); 3139 3187 } 3140 3188 3141 3189 if (interrupted) 3142 3190 { 3143 3191 break; 3144 3192 } 3193 3194 query.prepare("SELECT MAX(endtime) FROM program p LEFT JOIN channel c " 3195 "ON p.chanid=c.chanid WHERE c.sourceid= :SRCID " 3196 "AND manualid = 0;"); 3197 query.bindValue(":SRCID", (*it).id); 3198 query.exec(); 3199 if (query.isActive() && query.size() > 0) 3200 { 3201 query.next(); 3202 3203 if (!query.isNull(0)) 3204 GuideDataAfter = QDateTime::fromString(query.value(0).toString(), 3205 Qt::ISODate); 3206 } 3207 3208 if (GuideDataAfter == GuideDataBefore) 3209 { 3210 nonewdata++; 3211 } 3145 3212 } 3146 3213 3147 3214 if (only_update_channels && !need_post_grab_proc) 3148 3215 return true; 3149 3216 3150 query.exec(QString("SELECT MAX(endtime) FROM program WHERE manualid=0;"));3151 if (query.isActive() && query.size() > 0)3152 {3153 query.next();3154 3155 if (!query.isNull(0))3156 GuideDataAfter = QDateTime::fromString(query.value(0).toString(),3157 Qt::ISODate);3158 }3159 3160 3217 if (failures == 0) 3161 3218 { 3162 if ( (GuideDataAfter == GuideDataBefore)&&3219 if (nonewdata > 0 && 3163 3220 (total_sources != externally_handled)) 3164 status = "mythfilldatabase ran, but did not insert " 3165 "any new data into the Guide. This can indicate a " 3166 "potential grabber failure."; 3221 status = QString("mythfilldatabase ran, but did not insert " 3222 "any new data into the Guide for %1 of %2 sources. " 3223 "This can indicate a potential grabber failure.") 3224 .arg(nonewdata) 3225 .arg(total_sources); 3167 3226 else 3168 3227 status = "Successful."; 3169 3228 … … 3694 3753 cout << "--refresh-today\n"; 3695 3754 cout << "--refresh-second\n"; 3696 3755 cout << "--refresh-all\n"; 3697 cout << " (Only valid for grabbers: DataDirect, se_swedb, no, ee, de_tvtoday)\n";3756 cout << " (Only valid for selected grabbers: e.g. DataDirect)\n"; 3698 3757 cout << " Force a refresh today or two days (or every day) from now,\n"; 3699 3758 cout << " to catch the latest changes\n"; 3700 3759 cout << "--dont-refresh-tomorrow\n"; … … 3843 3902 "FROM videosource ") + where + 3844 3903 QString(" ORDER BY sourceid;"); 3845 3904 sourcequery.exec(querystr); 3846 3905 3847 3906 if (sourcequery.isActive()) 3848 3907 { 3849 3908 if (sourcequery.size() > 0) … … 3851 3910 while (sourcequery.next()) 3852 3911 { 3853 3912 Source newsource; 3854 3913 3855 3914 newsource.id = sourcequery.value(0).toInt(); 3856 3915 newsource.name = sourcequery.value(1).toString(); 3857 3916 newsource.xmltvgrabber = sourcequery.value(2).toString(); … … 3859 3918 newsource.password = sourcequery.value(4).toString(); 3860 3919 newsource.lineupid = sourcequery.value(5).toString(); 3861 3920 3921 newsource.xmltvgrabber_baseline = false; 3922 newsource.xmltvgrabber_manualconfig = false; 3923 newsource.xmltvgrabber_cache = false; 3924 newsource.xmltvgrabber_prefmethod = ""; 3925 3862 3926 sourcelist.append(newsource); 3863 3927 if (newsource.xmltvgrabber == "datadirect") 3864 3928 usingDataDirect = true;