Ticket #2992: 2992_fix.diff

File 2992_fix.diff, 4.5 KB (added by stuartm, 17 years ago)

Updated version

  • mythtv/programs/mythfilldatabase/filldata.cpp

     
    382382    int total_sources = sourcelist.size();
    383383    int source_channels = 0;
    384384
    385     query.exec(QString("SELECT MAX(endtime) FROM program WHERE manualid=0;"));
    386     if (query.isActive() && query.size() > 0)
    387     {
    388         query.next();
    389 
    390         if (!query.isNull(0))
    391             GuideDataBefore = QDateTime::fromString(query.value(0).toString(),
    392                                                     Qt::ISODate);
    393     }
    394 
    395385    QString sidStr = QString("Updating source #%1 (%2) with grabber %3");
    396386
    397387    need_post_grab_proc = false;
     388    int nonewdata = 0;
    398389
    399390    for (it = sourcelist.begin(); it != sourcelist.end(); ++it)
    400391    {
     392
     393        query.prepare("SELECT MAX(endtime) FROM program p LEFT JOIN channel c ON p.chanid=c.chanid WHERE c.sourceid= :SRCID AND manualid = 0;");
     394        query.bindValue(":SRCID", (*it).id);
     395        query.exec();
     396        if (query.isActive() && query.size() > 0)
     397        {
     398            query.next();
     399
     400            if (!query.isNull(0))
     401                GuideDataBefore = QDateTime::fromString(query.value(0).toString(),
     402                                                        Qt::ISODate);
     403        }
     404
    401405        channel_update_run = false;
    402406        endofdata = false;
    403407
     
    818822        {
    819823            break;
    820824        }
     825
     826        query.prepare("SELECT MAX(endtime) FROM program p LEFT JOIN channel c ON p.chanid=c.chanid WHERE c.sourceid= :SRCID AND manualid = 0;");
     827        query.bindValue(":SRCID", (*it).id);
     828        query.exec();
     829        if (query.isActive() && query.size() > 0)
     830        {
     831            query.next();
     832
     833            if (!query.isNull(0))
     834                GuideDataAfter = QDateTime::fromString(query.value(0).toString(),
     835                                                    Qt::ISODate);
     836        }
     837
     838        if (GuideDataAfter == GuideDataBefore)
     839        {
     840            nonewdata++;
     841        }
    821842    }
    822843
    823844    if (only_update_channels && !need_post_grab_proc)
    824845        return true;
    825846
    826     query.exec(QString("SELECT MAX(endtime) FROM program WHERE manualid=0;"));
    827     if (query.isActive() && query.size() > 0)
    828     {
    829         query.next();
    830 
    831         if (!query.isNull(0))
    832             GuideDataAfter = QDateTime::fromString(query.value(0).toString(),
    833                                                    Qt::ISODate);
    834     }
    835 
    836847    if (failures == 0)
    837848    {
    838         if ((GuideDataAfter == GuideDataBefore) &&
     849        if (nonewdata > 0 &&
    839850            (total_sources != externally_handled))
    840             status = "mythfilldatabase ran, but did not insert "
    841                      "any new data into the Guide.  This can indicate a "
    842                      "potential grabber failure.";
     851            status = QString("mythfilldatabase ran, but did not insert "
     852                     "any new data into the Guide for %1 of %2 sources.  This can indicate a "
     853                     "potential grabber failure.").arg(nonewdata).arg(total_sources);
    843854        else
    844855            status = "Successful.";
    845856
  • mythtv/programs/mythfilldatabase/main.cpp

     
    482482                           "WHERE value='mythfilldatabaseLastRunStatus'")
    483483                           .arg(status));
    484484
    485         query.exec("SELECT MAX(endtime) FROM program WHERE manualid = 0;");
     485        query.prepare("SELECT MAX(endtime) FROM program p LEFT JOIN channel c ON p.chanid=c.chanid WHERE c.sourceid= :SRCID AND manualid = 0;");
     486        query.bindValue(":SRCID", fromfile_id);
     487        query.exec();
    486488        if (query.isActive() && query.size() > 0)
    487489        {
    488490            query.next();
     
    501503                           "WHERE value='mythfilldatabaseLastRunEnd'")
    502504                          .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm")));
    503505
    504         query.exec("SELECT MAX(endtime) FROM program WHERE manualid = 0;");
     506        query.prepare("SELECT MAX(endtime) FROM program p LEFT JOIN channel c ON p.chanid=c.chanid WHERE c.sourceid= :SRCID AND manualid = 0;");
     507        query.bindValue(":SRCID", fromfile_id);
     508        query.exec();
    505509        if (query.isActive() && query.size() > 0)
    506510        {
    507511            query.next();