Ticket #3842: 3842-remove-new-handling-fixes-v1.patch

File 3842-remove-new-handling-fixes-v1.patch, 4.3 KB (added by danielk, 18 years ago)
  • libs/libmythtv/datadirect.h

     
    215215{
    216216  public:
    217217    DDStructureParser(DataDirectProcessor& _ddparent) :
    218         parent(_ddparent), saw_repeat(false), saw_new(false) {}
     218        parent(_ddparent) {}
    219219
    220220    bool startElement(const QString &pnamespaceuri, const QString &plocalname,
    221221                      const QString &pqname, const QXmlAttributes &pxmlatts);
     
    240240    DataDirectProductionCrew curr_productioncrew;
    241241    DataDirectGenre          curr_genre;
    242242    QString                  lastprogramid;
    243     bool                     saw_repeat;
    244     bool                     saw_new;
    245243};
    246244
    247245
  • libs/libmythtv/datadirect.cpp

     
    168168        curr_schedule.duration = QTime(durstr.mid(2, 2).toInt(),
    169169                                       durstr.mid(5, 2).toInt(), 0, 0);
    170170
    171         QString isrepeat = pxmlatts.value("repeat");
    172         curr_schedule.repeat = (isrepeat == "true");
    173         saw_repeat |= !isrepeat.isEmpty();
    174 
    175         QString isnew = pxmlatts.value("new");
    176         curr_schedule.isnew = (isnew == "true");
    177         saw_new |= !isnew.isEmpty();
    178 
     171        curr_schedule.repeat = (pxmlatts.value("repeat") == "true");
     172        curr_schedule.isnew = (pxmlatts.value("new") == "true");
    179173        curr_schedule.stereo = (pxmlatts.value("stereo") == "true");
    180174        curr_schedule.subtitled = (pxmlatts.value("subtitled") == "true");
    181175        curr_schedule.hdtv = (pxmlatts.value("hdtv") == "true");
     
    420414
    421415bool DDStructureParser::endDocument()
    422416{
    423     MSqlQuery query(MSqlQuery::DDCon());
    424     query.prepare(
    425         "INSERT INTO dd_state (sawrepeat, sawnew) "
    426         "VALUES (:SAWREPEAT, :SAWNEW)");
    427     query.bindValue(":SAWREPEAT", saw_repeat);
    428     query.bindValue(":SAWNEW",    saw_new);
    429 
    430     if (!query.exec())
    431         MythContext::DBError("Inserting into dd_state", query);
    432 
    433417    return true;
    434418}
    435419 
     
    617601{
    618602    MSqlQuery query(MSqlQuery::DDCon());
    619603
    620     query.prepare(
    621         "SELECT sawrepeat, sawnew "
    622         "FROM dd_state");
    623 
    624     if (!query.exec())
    625     {
    626         MythContext::DBError("Querying into dd_state", query);
    627         return;
    628     }
    629 
    630     if (!query.next())
    631     {
    632         VERBOSE(VB_IMPORTANT, LOC_ERR + "UpdateProgramViewTable no dd_state!");
    633         return;
    634     }
    635 
    636     bool saw_repeat = query.value(0).toUInt(); (void) saw_repeat;
    637     bool saw_new    = query.value(1).toUInt(); (void) saw_new;
    638 
    639 //    VERBOSE(VB_GENERAL, LOC + QString("Saw new: %1, saw repeat: %2")
    640 //            .arg(saw_new).arg(saw_repeat));
    641 
    642604    if (!query.exec("TRUNCATE TABLE dd_v_program;"))
    643605        MythContext::DBError("Truncating temporary table dd_v_program", query);
    644606
     
    654616        "       tvrating,       mpaarating,      programid )      "
    655617        "SELECT chanid,         scheduletime,    endtime,         "
    656618        "       title,          subtitle,        description,     "
    657         "       year,           stars,           %1,              "
     619        "       year,           stars,           isrepeat,        "
    658620        "       stereo,         subtitled,       hdtv,            "
    659621        "       closecaptioned, partnumber,      parttotal,       "
    660622        "       seriesid,       originalairdate, showtype,        "
     
    665627        "       (channel.xmltvid       = dd_schedule.stationid) AND "
    666628        "       (channel.sourceid      = :SOURCEID))";
    667629
    668     QString repeat = (saw_new) ?
    669         "(not isnew) AND "
    670         "(SUBSTRING(dd_program.programid,1,2) IN ('EP', 'SH'))" :
    671         "isrepeat";
     630    query.prepare(qstr);
    672631
    673     query.prepare(qstr.arg(repeat));
    674 
    675632    query.bindValue(":SOURCEID", sourceid);
    676633
    677634    if (!query.exec())
     
    12441201{
    12451202    QMap<QString,QString> dd_tables;
    12461203
    1247     dd_tables["dd_state"] =
    1248         "( sawrepeat bool,               sawnew bool )";
    1249 
    12501204    dd_tables["dd_station"] =
    12511205        "( stationid char(12),           callsign char(10),     "
    12521206        "  stationname varchar(40),      affiliate varchar(25), "