Ticket #1056: myth_eit-bev-dn2_r8925.diff
File myth_eit-bev-dn2_r8925.diff, 19.6 KB (added by , 18 years ago) |
---|
-
setup/backendsettings.cpp
diff -rup mythtv.8922.orig/mythtv/libs/libmythtv/dbcheck.cpp mythtv.8922/mythtv/libs/libmythtv/dbcheck.cpp
old new 223 224 return gc; 224 225 }; 225 226 227 static GlobalSpinBox *EITCrawIdleStart() 228 { 229 GlobalSpinBox *gc = new GlobalSpinBox("EITCrawIdleStart", 1, 120, 1); 230 gc->setLabel(QObject::tr("Backend Idle Before EIT Craw (mins)")); 231 gc->setValue(1); 232 QString helpText = QObject::tr( 233 "The amount of time to wait after the backend becomes idle for a given " 234 "capture card before the EIT craw starts."); 235 gc->setHelpText(helpText); 236 return gc; 237 } 238 239 static GlobalCheckBox *EITCrawLimitTransports() 240 { 241 GlobalCheckBox *gc = new GlobalCheckBox("EITCrawLimitTransports"); 242 gc->setLabel(QObject::tr("EIT Craw Limits Transports")); 243 gc->setValue(false); 244 gc->setHelpText(QObject::tr("If set, EIT craw will scan only " 245 "those transports which have either " 246 "standard_guide_tid or extended_guide_tid " 247 "entries defined in dtv_privatetypes.")); 248 return gc; 249 }; 250 226 251 static GlobalSpinBox *EITTransportTimeout() 227 252 { 228 253 GlobalSpinBox *gc = new GlobalSpinBox("EITTransportTimeout", 1, 15, 1); … … 637 662 group2->addChild(VbiFormat()); 638 663 group2->addChild(FreqTable()); 639 664 group2->addChild(TimeOffset()); 640 group2->addChild(EITTransportTimeout());641 665 group2->addChild(MasterBackendOverride()); 642 666 group2->addChild(DeletesFollowLinks()); 643 667 addChild(group2); 644 668 669 VerticalConfigurationGroup* group2a1 = new VerticalConfigurationGroup(false); 670 group2a1->setLabel(QObject::tr("EIT Scanner Options")); 671 group2a1->addChild(EITTransportTimeout()); 672 group2a1->addChild(EITCrawIdleStart()); 673 group2a1->addChild(EITCrawLimitTransports()); 674 addChild(group2a1); 675 645 676 VerticalConfigurationGroup* group3 = new VerticalConfigurationGroup(false); 646 677 group3->setLabel(QObject::tr("Shutdown/Wakeup Options")); 647 678 group3->addChild(startupCommand()); -
libs/libmythtv/eitscanner.cpp
old new 192 192 parser = NULL; 193 193 } 194 194 195 void EITScanner::StartActiveScan(TVRec *_rec, uint max_seconds_per_source) 195 void EITScanner::StartActiveScan(TVRec *_rec, uint max_seconds_per_source, 196 bool limit_transports) 196 197 { 197 198 rec = _rec; 198 199 199 200 if (!activeScanChannels.size()) 200 201 { 201 202 MSqlQuery query(MSqlQuery::InitCon()); 202 query.prepare( 203 "SELECT channum, mplexid " 204 "FROM channel, cardinput, capturecard, videosource " 205 "WHERE cardinput.sourceid = channel.sourceid AND " 206 " videosource.sourceid = channel.sourceid AND " 207 " capturecard.cardid = cardinput.cardid AND " 208 " channel.mplexid IS NOT NULL AND " 209 " useonairguide = 1 AND " 210 " useeit = 1 AND " 211 " cardinput.cardid = :CARDID " 212 "ORDER BY cardinput.sourceid, atscsrcid"); 203 204 if (limit_transports) 205 query.prepare( 206 "SELECT MIN(channum), channel.mplexid " 207 "FROM channel, dtv_multiplex, dtv_privatetypes, videosource, " 208 "cardinput, capturecard " 209 "WHERE dtv_multiplex.networkid = dtv_privatetypes.networkid " 210 "AND videosource.sourceid = channel.sourceid " 211 "AND cardinput.sourceid = channel.sourceid " 212 "AND capturecard.cardid = cardinput.cardid " 213 "AND (private_type = 'extended_guide_tid' " 214 "OR private_type = 'standard_guide_tid') " 215 "AND private_value = transportid " 216 "AND channel.mplexid = dtv_multiplex.mplexid " 217 "AND useonairguide = 1 " 218 "AND useeit = 1 " 219 "AND cardinput.cardid = :CARDID " 220 "GROUP BY transportid"); 221 else 222 query.prepare( 223 "SELECT MIN(channum), channel.mplexid " 224 "FROM channel,videosource,cardinput,capturecard,dtv_multiplex " 225 "LEFT JOIN dtv_privatetypes " 226 "ON dtv_multiplex.networkid = dtv_privatetypes.networkid " 227 "AND (private_type = 'extended_guide_tid' " 228 "OR private_type = 'standard_guide_tid') " 229 "AND private_value = transportid " 230 "WHERE videosource.sourceid = channel.sourceid " 231 "AND cardinput.sourceid = channel.sourceid " 232 "AND capturecard.cardid = cardinput.cardid " 233 "AND channel.mplexid = dtv_multiplex.mplexid " 234 "AND useonairguide = 1 " 235 "AND useeit = 1 " 236 "AND cardinput.cardid = :CARDID " 237 "GROUP BY transportid"); 238 213 239 query.bindValue(":CARDID", rec->GetCaptureCardNum()); 214 240 215 241 if (!query.exec() || !query.isActive()) -
libs/libmythtv/tv_rec.cpp
old new 74 74 #define LOC QString("TVRec(%1): ").arg(cardid) 75 75 #define LOC_ERR QString("TVRec(%1) Error: ").arg(cardid) 76 76 77 /// How many seconds after entering kState_None should we start EIT Scanner78 const uint TVRec::kEITScanStartTimeout = 60; /* 1 minute */79 80 77 /// How many milliseconds the signal monitor should wait between checks 81 78 const uint TVRec::kSignalMonitoringRate = 50; /* msec */ 82 79 … … 750 747 { 751 748 // Add some randomness to avoid all cards starting 752 749 // EIT scanning at nearly the same time. 753 uint timeout = kEITScanStartTimeout + random() % 59; 750 uint idle_start = gContext->GetNumSetting("EITCrawIdleStart", 1); 751 uint timeout = (idle_start * 60) + random() % 59; 754 752 eitScanStartTime = eitScanStartTime.addSecs(timeout); 755 753 } 756 754 else … … 1160 1158 1161 1159 // Add some randomness to avoid all cards starting 1162 1160 // EIT scanning at nearly the same time. 1163 uint timeout = kEITScanStartTimeout + random() % 59; 1161 uint idle_start = gContext->GetNumSetting("EITCrawIdleStart", 1); 1162 uint timeout = (idle_start * 60) + random() % 59; 1164 1163 eitScanStartTime = QDateTime::currentDateTime().addSecs(timeout); 1165 1164 1166 1165 while (HasFlags(kFlagRunMainLoop)) … … 1295 1294 else 1296 1295 { 1297 1296 uint ttMin = gContext->GetNumSetting("EITTransportTimeout", 5); 1298 scanner->StartActiveScan(this, ttMin * 60); 1297 uint tid_limit = gContext->GetNumSetting("EITCrawLimitTransports", 0); 1298 scanner->StartActiveScan(this, ttMin * 60, (tid_limit ? true : false)); 1299 1299 SetFlags(kFlagEITScannerRunning); 1300 1300 eitScanStartTime = QDateTime::currentDateTime().addYears(1); 1301 1301 } -
libs/libmythtv/tv_rec.h
old new 363 363 QString rbFileExt; 364 364 365 365 public: 366 static const uint kEITScanStartTimeout;367 366 static const uint kSignalMonitoringRate; 368 367 369 368 // General State flags -
libs/libmythtv/siparser.cpp
old new 346 346 VERBOSE(VB_SIPARSER, LOC + "Forcing Guide Present"); 347 347 } 348 348 } 349 if (QString(query.value(0).toString()) == "guide_on_single_tid") 350 { 351 if (query.value(1).toString() == "yes") 352 { 353 PrivateTypes.GuideOnSingleTransport = true; 354 VERBOSE(VB_SIPARSER, LOC + "Guide is on single transport"); 355 } 356 } 357 if (QString(query.value(0).toString()) == "extended_guide_tid") 358 { 359 PrivateTypes.ExtendedGuideOnTransport = query.value(1).toInt(); 360 VERBOSE(VB_SIPARSER, LOC + 361 QString("Dish Network Extended Guide Present on Transport %1") 362 .arg(PrivateTypes.ExtendedGuideOnTransport)); 363 } 349 364 if (QString(query.value(0).toString()) == "guide_fixup") 350 365 { 351 366 PrivateTypes.EITFixUp = query.value(1).toInt(); … … 1267 1282 emit TableLoaded(); 1268 1283 1269 1284 int CurrentTransport = 0; 1285 PrivateTypes.ForceExtendedGuidePresent = false; 1270 1286 1271 1287 uint16_t network_id = buffer[0] << 8 | buffer[1]; 1272 1288 // TODO: Handle Network Specifics here if they aren't set … … 1274 1290 //TODO : Make this configurable. 1275 1291 PrivateTypes.ForceGuidePresent = true; 1276 1292 1293 if (PrivateTypes.GuideOnSingleTransport) 1294 PrivateTypes.GuideTransportID = PrivateTypes.CurrentTransportID; 1295 1296 if (PrivateTypes.CurrentTransportID == PrivateTypes.ExtendedGuideOnTransport) 1297 { 1298 PrivateTypes.ForceExtendedGuidePresent = true; 1299 1300 VERBOSE(VB_SIPARSER, LOC + 1301 QString("SDT: Extended guide present on this TID: %1") 1302 .arg(head->table_id_ext)); 1303 } 1304 1305 1277 1306 if (PrivateTypesLoaded == false) 1278 1307 LoadPrivateTypes(network_id); 1279 1308 … … 1391 1420 1392 1421 // TODO: This is temp 1393 1422 Table[EVENTS]->DependencyMet(SERVICES); 1394 //Table[EVENTS]->AddPid(0x12,0x00,0x00,true); // see ticket #7551395 Table[EVENTS]->AddPid(0x12,0x7F,0x80,0x12); // see ticket #7551396 1423 1397 // This should only be added based on the user enabling 7-9day dishnet 1398 // EIT events 1399 Table[EVENTS]->AddPid(0x300,0x00,0x00,true); 1424 // TODO: Handle BEV extended guide 1425 if (PrivateTypes.ForceExtendedGuidePresent) 1426 { 1427 Table[EVENTS]->AddPid(0x300,0x00,0x00,true); // Dish 9-day 1428 } 1429 else 1430 { 1431 // Handle everything else.. 1432 Table[EVENTS]->AddPid(0x12,0x00,0x00,true); // see ticket #755 1433 Table[EVENTS]->AddPid(0x12,0x7F,0x80,0x12); // see ticket #755 1434 } 1400 1435 } 1401 1436 1402 1437 /** \fn SIParser::GetLanguagePriority(const QString&) -
libs/libmythtv/sitypes.h
old new 125 125 bool CustomGuidePID; 126 126 uint16_t GuidePID; 127 127 bool GuideOnSingleTransport; 128 bool ForceExtendedGuidePresent; 129 uint16_t ExtendedGuideOnTransport; 128 130 uint16_t GuideTransportID; 129 131 /* List of ServiceID:s for which to parse out subtitle from the description. 130 132 Used in EITFixUpStyle4() */ -
libs/libmythtv/dbcheck.cpp
old new 12 12 /// This is the DB schema version expected by the running MythTV instance. 13 13 const QString currentDatabaseVersion = "1123"; 14 14 15 /// This is the DB schema minor version used by supplementary patches 16 const QString currentDatabaseVersionMinor = "2"; 17 15 18 static bool UpdateDBVersionNumber(const QString &newnumber); 19 static bool UpdateDBVersionMinor( const QString &newminor); 16 20 static bool performActualUpdate(const QString updates[], QString version, 17 21 QString &dbver); 22 static bool performMinorUpdate(const QString updates[], QString minor, 23 QString &dbminor); 18 24 static bool InitializeDatabase(void); 19 25 static bool doUpgradeTVDatabaseSchema(void); 26 static bool dbMinorUpdate(void); 20 27 21 28 /** \defgroup db_schema MythTV Database Schema 22 29 … … 353 360 return true; 354 361 } 355 362 363 static bool UpdateDBVersionMinor(const QString &newminor) 364 { 365 // delete old schema version 366 MSqlQuery query(MSqlQuery::InitCon()); 367 368 QString thequery = "DELETE FROM settings WHERE value='DBSchemaVerMinor';"; 369 query.prepare(thequery); 370 query.exec(); 371 372 if (query.lastError().type() != QSqlError::None) 373 { 374 QString msg = 375 QString("DB Error (Deleting old DB minor version number): \n" 376 "Query was: %1 \nError was: %2 \nnew version: %3") 377 .arg(thequery) 378 .arg(MythContext::DBErrorMessage(query.lastError())) 379 .arg(newminor); 380 VERBOSE(VB_IMPORTANT, msg); 381 return false; 382 } 383 384 // set new schema minor 385 thequery = QString("INSERT INTO settings (value, data, hostname) " 386 "VALUES ('DBSchemaVerMinor', %1, NULL);").arg(newminor); 387 query.prepare(thequery); 388 query.exec(); 389 390 if (query.lastError().type() != QSqlError::None) 391 { 392 QString msg = 393 QString("DB Error (Setting new DB minor version number): \n" 394 "Query was: %1 \nError was: %2 \nnew minor version: %3") 395 .arg(thequery) 396 .arg(MythContext::DBErrorMessage(query.lastError())) 397 .arg(newminor); 398 VERBOSE(VB_IMPORTANT, msg); 399 return false; 400 } 401 402 return true; 403 } 404 356 405 /** \fn performActualUpdate(const QString updates[], QString, QString&) 357 406 * \brief Runs a number of SQL commands, and updates the schema version. 358 407 * … … 400 449 return true; 401 450 } 402 451 452 static bool performMinorUpdate(const QString updates[], QString minor, 453 QString &dbminor) 454 { 455 MSqlQuery query(MSqlQuery::InitCon()); 456 457 VERBOSE(VB_IMPORTANT, QString("Upgrading to schema minor ") + minor); 458 459 int counter = 0; 460 QString thequery = updates[counter]; 461 462 while (thequery != "") 463 { 464 query.prepare(thequery); 465 query.exec(); 466 467 if (query.lastError().type() != QSqlError::None) 468 { 469 QString msg = 470 QString("DB Error (Performing database upgrade): \n" 471 "Query was: %1 \nError was: %2 \nnew minor: %3") 472 .arg(thequery) 473 .arg(MythContext::DBErrorMessage(query.lastError())) 474 .arg(minor); 475 VERBOSE(VB_IMPORTANT, msg); 476 return false; 477 } 478 479 counter++; 480 thequery = updates[counter]; 481 } 482 483 if (!UpdateDBVersionMinor(minor)) 484 return false; 485 486 dbminor = minor; 487 return true; 488 } 489 403 490 /** \fn UpgradeTVDatabaseSchema(void) 404 491 * \brief This is the function called from outside dbcheck.cpp to update the schema. 405 492 * … … 417 504 { 418 505 QString dbver = gContext->GetSetting("DBSchemaVer"); 419 506 420 VERBOSE(VB_IMPORTANT, QString("Current Schema Version: %1").arg(dbver));507 QString dbminor = gContext->GetSetting("DBSchemaVerMinor"); 421 508 422 if (dbver == currentDatabaseVersion) 509 VERBOSE(VB_IMPORTANT, QString("Current Schema Version: %1.%2").arg(dbver) 510 .arg(dbminor)); 511 512 if ((dbver == currentDatabaseVersion) && 513 (dbminor == currentDatabaseVersionMinor)) 423 514 return true; 424 515 425 516 MSqlQuery chartype(MSqlQuery::InitCon()); 426 517 chartype.prepare("ALTER DATABASE mythconverg DEFAULT CHARACTER SET latin1;"); 427 518 chartype.exec(); 428 519 429 VERBOSE(VB_IMPORTANT, QString("Newest Schema Version : %1") 430 .arg(currentDatabaseVersion)); 520 VERBOSE(VB_IMPORTANT, QString("Newest Schema Version : %1.%2") 521 .arg(currentDatabaseVersion) 522 .arg(currentDatabaseVersionMinor)); 431 523 432 524 MSqlQuery lockquery(MSqlQuery::InitCon()); 433 525 … … 459 551 460 552 bool ret = doUpgradeTVDatabaseSchema(); 461 553 554 // Database version minor updates 555 if (ret) 556 ret = dbMinorUpdate(); 557 462 558 if (ret) 463 559 VERBOSE(VB_IMPORTANT, "Database Schema upgrade complete, unlocking."); 464 560 else … … 2012 2108 return true; 2013 2109 } 2014 2110 2111 static bool dbMinorUpdate(void) 2112 { 2113 QString dbminor = gContext->GetSetting("DBSchemaVerMinor"); 2114 if (dbminor == currentDatabaseVersionMinor) 2115 return true; 2116 if ((dbminor == "") || (dbminor == "0")) 2117 { 2118 const QString updates[] = { 2119 // Dish Network 2120 "INSERT INTO dtv_privatetypes (sitype, networkid, private_type, private_value)" 2121 " VALUES('dvb', 4102, 'force_guide_present', 'yes');", 2122 "INSERT INTO dtv_privatetypes (sitype, networkid, private_type, private_value)" 2123 " VALUES('dvb', 4102, 'extended_guide_tid', '229');", 2124 // Bell ExpressVu 2125 "INSERT INTO dtv_privatetypes (sitype, networkid, private_type, private_value)" 2126 " VALUES('dvb', 256, 'force_guide_present', 'yes');", 2127 "INSERT INTO dtv_privatetypes (sitype, networkid, private_type, private_value)" 2128 " VALUES('dvb', 256, 'guide_on_single_tid', 'yes');", 2129 "INSERT INTO dtv_privatetypes (sitype, networkid, private_type, private_value)" 2130 " VALUES('dvb', 257, 'force_guide_present', 'yes');", 2131 "INSERT INTO dtv_privatetypes (sitype, networkid, private_type, private_value)" 2132 " VALUES('dvb', 257, 'guide_on_single_tid', 'yes');", 2133 "" 2134 }; 2135 if (!performMinorUpdate(updates, "1", dbminor)) 2136 return false; 2137 } 2138 2139 if ((dbminor == "1")) 2140 { 2141 const QString updates[] = { 2142 // Bell ExpressVu 2143 "INSERT INTO dtv_privatetypes (sitype, networkid, private_type, private_value)" 2144 " VALUES('dvb', 256, 'standard_guide_tid', '4');", 2145 "INSERT INTO dtv_privatetypes (sitype, networkid, private_type, private_value)" 2146 " VALUES('dvb', 257, 'standard_guide_tid', '102');", 2147 "" 2148 }; 2149 if (!performMinorUpdate(updates, "2", dbminor)) 2150 return false; 2151 } 2152 2153 return true; 2154 } 2015 2155 2016 2156 2017 2157 bool InitializeDatabase(void) -
libs/libmythtv/eitscanner.h
old new 28 28 void StartPassiveScan(DVBChannel*, DVBSIParser*); 29 29 void StopPassiveScan(void); 30 30 31 void StartActiveScan(TVRec*, uint max_seconds_per_source); 31 void StartActiveScan(TVRec*, uint max_seconds_per_source, 32 bool limit_transport=false); 32 33 void StopActiveScan(void); 33 34 34 35 public slots: