Ticket #3842: 3842-isnew-head-v1.patch
File 3842-isnew-head-v1.patch, 7.0 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/datadirect.h
98 98 QDateTime time; 99 99 QTime duration; 100 100 bool repeat; 101 bool isnew; 101 102 bool stereo; 102 103 bool subtitled; 103 104 bool hdtv; … … 215 216 class DDStructureParser: public QXmlDefaultHandler 216 217 { 217 218 public: 218 DDStructureParser(DataDirectProcessor& _ddparent): parent(_ddparent) {} 219 DDStructureParser(DataDirectProcessor& _ddparent) : 220 parent(_ddparent), saw_repeat(false), saw_new(false) {} 219 221 220 222 bool startElement(const QString &pnamespaceuri, const QString &plocalname, 221 223 const QString &pqname, const QXmlAttributes &pxmlatts); … … 240 242 DataDirectProductionCrew curr_productioncrew; 241 243 DataDirectGenre curr_genre; 242 244 QString lastprogramid; 245 bool saw_repeat; 246 bool saw_new; 243 247 }; 244 248 249 245 250 typedef QMap<QString,DataDirectStation> DDStationList; // stationid -> 246 251 typedef vector<DataDirectLineup> DDLineupList; 247 252 typedef vector<DataDirectLineupMap> DDLineupChannels; -
libs/libmythtv/datadirect.cpp
68 68 DataDirectSchedule::DataDirectSchedule() : 69 69 programid(""), stationid(""), 70 70 time(QDateTime()), duration(QTime()), 71 repeat(false), stereo(false), 72 subtitled(false), hdtv(false), 73 closecaptioned(false), tvrating(""), 71 repeat(false), isnew(false), 72 stereo(false), subtitled(false), 73 hdtv(false), closecaptioned(false), 74 tvrating(""), 74 75 partnumber(0), parttotal(0) 75 76 { 76 77 } … … 167 168 curr_schedule.duration = QTime(durstr.mid(2, 2).toInt(), 168 169 durstr.mid(5, 2).toInt(), 0, 0); 169 170 170 curr_schedule.repeat = (pxmlatts.value("repeat") == "true"); 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 179 curr_schedule.stereo = (pxmlatts.value("stereo") == "true"); 172 180 curr_schedule.subtitled = (pxmlatts.value("subtitled") == "true"); 173 181 curr_schedule.hdtv = (pxmlatts.value("hdtv") == "true"); … … 278 286 " duration, isrepeat, stereo, " 279 287 " subtitled, hdtv, closecaptioned, " 280 288 " tvrating, partnumber, parttotal, " 281 " endtime ) "289 " endtime, isnew) " 282 290 "VALUES " 283 291 " (:PROGRAMID, :STATIONID, :TIME, " 284 292 " :DURATION, :ISREPEAT, :STEREO, " 285 293 " :SUBTITLED, :HDTV, :CAPTIONED, " 286 294 " :TVRATING, :PARTNUMBER, :PARTTOTAL, " 287 " :ENDTIME )");295 " :ENDTIME, :ISNEW)"); 288 296 289 297 query.bindValue(":PROGRAMID", curr_schedule.programid); 290 298 query.bindValue(":STATIONID", curr_schedule.stationid); … … 299 307 query.bindValue(":PARTNUMBER", curr_schedule.partnumber); 300 308 query.bindValue(":PARTTOTAL", curr_schedule.parttotal); 301 309 query.bindValue(":ENDTIME", endtime); 310 query.bindValue(":ISNEW", curr_schedule.isnew); 302 311 303 312 if (!query.exec()) 304 313 MythContext::DBError("Inserting into dd_schedule", query); … … 411 420 412 421 bool DDStructureParser::endDocument() 413 422 { 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 414 433 return true; 415 434 } 416 435 … … 597 616 void DataDirectProcessor::UpdateProgramViewTable(uint sourceid) 598 617 { 599 618 MSqlQuery query(MSqlQuery::DDCon()); 600 619 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 601 642 if (!query.exec("TRUNCATE TABLE dd_v_program;")) 602 643 MythContext::DBError("Truncating temporary table dd_v_program", query); 603 644 604 query.prepare(645 QString qstr = 605 646 "INSERT INTO dd_v_program " 606 647 " ( chanid, starttime, endtime, " 607 648 " title, subtitle, description, " … … 613 654 " tvrating, mpaarating, programid ) " 614 655 "SELECT chanid, scheduletime, endtime, " 615 656 " title, subtitle, description, " 616 " year, stars, isrepeat,"657 " year, stars, %1, " 617 658 " stereo, subtitled, hdtv, " 618 659 " closecaptioned, partnumber, parttotal, " 619 660 " seriesid, originalairdate, showtype, " … … 622 663 "FROM channel, dd_schedule, dd_program " 623 664 "WHERE ((dd_schedule.programid = dd_program.programid) AND " 624 665 " (channel.xmltvid = dd_schedule.stationid) AND " 625 " (channel.sourceid = :SOURCEID))" );666 " (channel.sourceid = :SOURCEID))"; 626 667 668 query.prepare(qstr.arg((saw_new) ? "not isnew" : "isrepeat")); 669 627 670 query.bindValue(":SOURCEID", sourceid); 628 671 629 672 if (!query.exec()) … … 1208 1251 { 1209 1252 QMap<QString,QString> dd_tables; 1210 1253 1254 dd_tables["dd_state"] = 1255 "( sawrepeat bool, sawnew bool )"; 1256 1211 1257 dd_tables["dd_station"] = 1212 1258 "( stationid char(12), callsign char(10), " 1213 1259 " stationname varchar(40), affiliate varchar(25), " … … 1236 1282 " subtitled bool, hdtv bool, " 1237 1283 " closecaptioned bool, tvrating char(5), " 1238 1284 " partnumber int, parttotal int, " 1239 " endtime datetime, "1285 " endtime datetime, isnew bool, " 1240 1286 "INDEX progidx (programid) )"; 1241 1287 1242 1288 dd_tables["dd_program"] =