Ticket #1777: xmltv_capabilities_3.diff
File xmltv_capabilities_3.diff, 30.4 KB (added by , 17 years ago) |
---|
-
mythtv/programs/mythfilldatabase/filldata.cpp
16 16 #include <qdatetime.h> 17 17 #include <qdir.h> 18 18 #include <qfile.h> 19 #include <qprocess.h> 19 20 20 21 // libmyth headers 21 22 #include "exitcodes.h" … … 215 216 216 217 chan_data.handleChannels(id, &chanlist); 217 218 icon_data.UpdateSourceIcons(id); 218 prog_data.handlePrograms(id, &proglist); 219 if (proglist.count() == 0) { 220 VERBOSE(VB_GENERAL, 221 QString("No programs found in data.")); 222 endofdata = true; 223 } 224 else { 225 prog_data.handlePrograms(id, &proglist); 226 } 219 227 return true; 220 228 } 221 229 … … 241 249 242 250 if (xmltv_grabber == "datadirect") 243 251 return grabDDData(source, offset, *qCurrentDate, DD_ZAP2IT); 244 else if (xmltv_grabber == "technovera") 245 { 246 VERBOSE(VB_ALL, "This grabber is no longer supported"); 247 exit(FILLDB_EXIT_INVALID_CMDLINE); 248 } 249 252 250 253 char tempfilename[] = "/tmp/mythXXXXXX"; 251 254 if (mkstemp(tempfilename) == -1) 252 255 { … … 261 264 QString home = QDir::homeDirPath(); 262 265 QString configfile = QString("%1/%2.xmltv").arg(MythContext::GetConfDir()) 263 266 .arg(source.name); 264 QString command; 267 QString cachefile = QString("%1/%2.cache").arg(MythContext::GetConfDir()) 268 .arg(source.name); 269 QString command = QString("nice %1 --config-file '%2' --output %3") 270 .arg(xmltv_grabber.ascii()) 271 .arg(configfile.ascii()) 272 .arg(filename.ascii()); 265 273 266 if (xmltv_grabber == "tv_grab_uk") 267 command.sprintf("nice %s --days 7 --config-file '%s' --output %s", 268 xmltv_grabber.ascii(), configfile.ascii(), 269 filename.ascii()); 270 else if (xmltv_grabber == "tv_grab_uk_rt") 271 command.sprintf("nice %s --days 14 --config-file '%s' --output %s", 272 xmltv_grabber.ascii(), 273 configfile.ascii(), filename.ascii()); 274 else if (xmltv_grabber == "tv_grab_au") 275 command.sprintf("nice %s --days 7 --config-file '%s' --output %s", 276 xmltv_grabber.ascii(), configfile.ascii(), 277 filename.ascii()); 278 else if (xmltv_grabber == "tv_grab_de_tvtoday") 279 command.sprintf("nice %s --slow --days 1 --config-file '%s' --offset %d --output %s", 280 xmltv_grabber.ascii(), configfile.ascii(), 281 offset, filename.ascii()); 282 else if (xmltv_grabber == "tv_grab_fr") 283 command.sprintf("nice %s --days 7 --config-file '%s' --output %s", 284 xmltv_grabber.ascii(), configfile.ascii(), 285 filename.ascii()); 286 else if (xmltv_grabber == "tv_grab_nl") 287 command.sprintf("nice %s --output %s", 288 xmltv_grabber.ascii(), 289 filename.ascii()); 290 else if (xmltv_grabber == "tv_grab_fi") 291 // Use the default of 10 days for Finland's grabber 292 command.sprintf("nice %s --config-file '%s' --output %s", 293 xmltv_grabber.ascii(), configfile.ascii(), 294 filename.ascii()); 295 else if (xmltv_grabber == "tv_grab_es" || 296 xmltv_grabber == "tv_grab_es_laguiatv") 297 // Use fixed interval of 3 days for Spanish grabber 298 command.sprintf("nice %s --days=4 --config-file '%s' --output %s", 299 xmltv_grabber.ascii(), 300 configfile.ascii(), filename.ascii()); 301 else if (xmltv_grabber == "tv_grab_jp") 274 // The one concession to grabber specific behaviour. 275 // Will be removed when the grabber allows. 276 if (xmltv_grabber == "tv_grab_jp") 302 277 { 303 // Use fixed interval of 7 days for Japanese grabber 304 command.sprintf("nice %s --days 7 --enable-readstr --config-file '%s' --output %s", 305 xmltv_grabber.ascii(), configfile.ascii(), 306 filename.ascii()); 307 xmltv_parser.isJapan = true; 278 command += QString(" --enable-readstr"); 279 xmltv_parser.isJapan = true; 308 280 } 309 else if (xmltv_grabber == "tv_grab_no") 310 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s", 311 xmltv_grabber.ascii(), offset, configfile.ascii(), 312 filename.ascii()); 313 else if (xmltv_grabber == "tv_grab_se_swedb") 314 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s", 315 xmltv_grabber.ascii(), offset, configfile.ascii(), 316 filename.ascii()); 317 else if (xmltv_grabber == "tv_grab_dk") 318 // Use fixed interval of 7 days for Danish grabber 319 command.sprintf("nice %s --days 7 --config-file '%s' --output %s", 320 xmltv_grabber.ascii(), configfile.ascii(), 321 filename.ascii()); 322 else if (xmltv_grabber == "tv_grab_pt") 323 // Use fixed interval of 3 days for Portuguese grabber 324 command.sprintf("nice %s --days=4 --config-file '%s' --output %s", 325 xmltv_grabber.ascii(), 326 configfile.ascii(), filename.ascii()); 327 else if (xmltv_grabber == "tv_grab_be_tvb") 328 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s", 329 xmltv_grabber.ascii(), offset, configfile.ascii(), 330 filename.ascii()); 331 else if (xmltv_grabber == "tv_grab_be_tlm") 332 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' --output %s", 333 xmltv_grabber.ascii(), offset, configfile.ascii(), 334 filename.ascii()); 335 else if (xmltv_grabber == "tv_grab_ee") 336 // Estonian grabber returns all known data by default 337 command.sprintf("nice %s --output %s", 338 xmltv_grabber.ascii(), 339 filename.ascii()); 340 else if (xmltv_grabber == "tv_grab_il") 341 // Israeli grabber returns all known data by default 342 command.sprintf("nice %s --config-file '%s' --output %s", 343 xmltv_grabber.ascii(), configfile.ascii(), 344 filename.ascii()); 345 else if (xmltv_grabber == "tv_grab_ru") 346 // Russian grabber returns all known data by default 347 command.sprintf("nice %s --config-file '%s' --output %s", 348 xmltv_grabber.ascii(), configfile.ascii(), 349 filename.ascii()); 350 else 281 else if (source.xmltvgrabber_prefmethod != "allatonce") 351 282 { 352 xmltv_parser.isNorthAmerica = true; 353 command.sprintf("nice %s --days 1 --offset %d --config-file '%s' " 354 "--output %s", xmltv_grabber.ascii(), 355 offset, configfile.ascii(), filename.ascii()); 283 // XMLTV Docs don't recommend grabbing one day at a 284 // time but the current myth code is heavily geared 285 // that way so until it is re-written behave as 286 // we always have done. 287 command += QString(" --days 1 --offset %1").arg(offset); 356 288 } 357 289 358 if (((print_verbose_messages & VB_GENERAL) == 0) &&359 (xmltv_grabber == "tv_grab_na" ||360 xmltv_grabber == "tv_grab_de_tvtoday" ||361 xmltv_grabber == "tv_grab_fi" ||362 xmltv_grabber == "tv_grab_es" ||363 xmltv_grabber == "tv_grab_es_laguiatv" ||364 xmltv_grabber == "tv_grab_se_swedb" ||365 xmltv_grabber == "tv_grab_no" ||366 xmltv_grabber == "tv_grab_dk" ||367 xmltv_grabber == "tv_grab_uk" ||368 xmltv_grabber == "tv_grab_uk_rt" ||369 xmltv_grabber == "tv_grab_nl" ||370 xmltv_grabber == "tv_grab_fr" ||371 xmltv_grabber == "tv_grab_fi" ||372 xmltv_grabber == "tv_grab_jp" ||373 xmltv_grabber == "tv_grab_pt" ||374 xmltv_grabber == "tv_grab_be_tvb" ||375 xmltv_grabber == "tv_grab_be_tlm" ||376 xmltv_grabber == "tv_grab_ee" ||377 xmltv_grabber == "tv_grab_ru"))378 command += " --quiet";379 380 381 command += graboptions;382 383 290 VERBOSE(VB_GENERAL, 384 291 "----------------- Start of XMLTV output -----------------"); 385 292 … … 491 398 .arg((*it).xmltvgrabber)); 492 399 493 400 query.prepare( 494 "SELECT COUNT(chanid) FROM channel WHERE sourceid = :SRCID"); 401 "SELECT COUNT(chanid) FROM channel WHERE sourceid = " 402 ":SRCID AND xmltvid != ''"); 495 403 query.bindValue(":SRCID", (*it).id); 496 404 query.exec(); 497 405 498 406 if (query.isActive() && query.numRowsAffected() > 0) { 499 407 query.next(); 500 408 source_channels = query.value(0).toInt(); 501 VERBOSE(VB_GENERAL, QString("Found %1 channels for source %2") 409 VERBOSE(VB_GENERAL, QString("Found %1 channels for source %2 " 410 "using xmltv") 502 411 .arg(source_channels).arg((*it).id)); 503 412 } else { 504 413 source_channels = 0; … … 510 419 QString xmltv_grabber = (*it).xmltvgrabber; 511 420 need_post_grab_proc |= (xmltv_grabber != "datadirect"); 512 421 513 if (xmltv_grabber == "tv_grab_uk" || xmltv_grabber == "tv_grab_uk_rt" || 514 xmltv_grabber == "tv_grab_fi" || xmltv_grabber == "tv_grab_es" || 515 xmltv_grabber == "tv_grab_es_laguiatv" || 516 xmltv_grabber == "tv_grab_nl" || xmltv_grabber == "tv_grab_au" || 517 xmltv_grabber == "tv_grab_fr" || xmltv_grabber == "tv_grab_jp" || 518 xmltv_grabber == "tv_grab_pt" || xmltv_grabber == "tv_grab_ee" || 519 xmltv_grabber == "tv_grab_dk") 422 if (xmltv_grabber == "eitonly") 520 423 { 521 // These don't support the --offset option, so just grab the max. 522 // TODO: tv_grab_fi/dk/is seems to support --offset, maybe more. Needs verification. 523 if (!grabData(*it, 0)) 524 ++failures; 424 VERBOSE(VB_IMPORTANT, "Source configured to use only the " 425 "broadcasted guide data. Skipping."); 426 externally_handled++; 427 query.exec(QString("UPDATE settings SET data ='%1' " 428 "WHERE value='mythfilldatabaseLastRunStart' OR " 429 "value = 'mythfilldatabaseLastRunEnd'") 430 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm"))); 431 continue; 525 432 } 526 else if ((xmltv_grabber == "datadirect") && dd_grab_all) 433 else if (xmltv_grabber == "/bin/true" || 434 xmltv_grabber == "none" || 435 xmltv_grabber == "") 527 436 { 437 VERBOSE(VB_IMPORTANT, 438 "Source configured with no grabber. Nothing to do."); 439 externally_handled++; 440 query.exec(QString("UPDATE settings SET data ='%1' " 441 "WHERE value='mythfilldatabaseLastRunStart' OR " 442 "value = 'mythfilldatabaseLastRunEnd'") 443 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm"))); 444 continue; 445 } 446 447 bool hasprefmethod = false; 448 449 if (xmltv_grabber != "datadirect") { 450 451 QProcess grabber_capabilities_proc(xmltv_grabber); 452 grabber_capabilities_proc.addArgument(QString("--capabilities")); 453 if ( grabber_capabilities_proc.start() ) 454 { 455 456 int i=0; 457 // Assume it shouldn't take more than 10 seconds 458 // Broken versions of QT cause QProcess::start 459 // and QProcess::isRunning to return true even 460 // when the executable doesn't exist 461 while (grabber_capabilities_proc.isRunning() && i < 100) 462 { 463 usleep(100000); 464 ++i; 465 } 466 467 if (grabber_capabilities_proc.normalExit()) 468 { 469 QString capabilites = ""; 470 471 while (grabber_capabilities_proc.canReadLineStdout()) 472 { 473 QString capability 474 = grabber_capabilities_proc.readLineStdout(); 475 capabilites += capability + " "; 476 477 if (capability == "baseline") 478 (*it).xmltvgrabber_baseline = true; 479 480 if (capability == "manualconfig") 481 (*it).xmltvgrabber_manualconfig = true; 482 483 if (capability == "cache") 484 (*it).xmltvgrabber_cache = true; 485 486 if (capability == "preferredmethod") 487 hasprefmethod = true; 488 } 489 490 VERBOSE(VB_GENERAL, QString("Grabber has capabilities: %1") 491 .arg(capabilites)); 492 } 493 else { 494 VERBOSE(VB_IMPORTANT, "%1 --capabilities failed or we " 495 "timed out waiting. You may need to upgrade your " 496 "xmltv grabber"); 497 } 498 } 499 else { 500 QString error = grabber_capabilities_proc.readLineStdout(); 501 VERBOSE(VB_IMPORTANT, QString("Failed to run %1 " 502 "--capabilities").arg(xmltv_grabber)); 503 } 504 } 505 506 507 if (hasprefmethod) 508 { 509 510 QProcess grabber_method_proc(xmltv_grabber); 511 grabber_method_proc.addArgument("--preferredmethod"); 512 if ( grabber_method_proc.start() ) 513 { 514 int i=0; 515 // Assume it shouldn't take more than 10 seconds 516 // Broken versions of QT cause QProcess::start 517 // and QProcess::isRunning to return true even 518 // when the executable doesn't exist 519 while (grabber_method_proc.isRunning() && i < 100) 520 { 521 usleep(100000); 522 ++i; 523 } 524 525 if (grabber_method_proc.normalExit()) 526 { 527 (*it).xmltvgrabber_prefmethod = 528 grabber_method_proc.readLineStdout(); 529 } 530 else { 531 VERBOSE(VB_IMPORTANT, "%1 --preferredmethod failed or we " 532 "timed out waiting. You may need to upgrade your " 533 "xmltv grabber"); 534 } 535 536 VERBOSE(VB_GENERAL, QString("Grabber prefers method: %1") 537 .arg((*it).xmltvgrabber_prefmethod)); 538 } 539 else { 540 QString error = grabber_method_proc.readLineStdout(); 541 VERBOSE(VB_IMPORTANT, QString("Failed to run %1 --preferredmethod") 542 .arg(xmltv_grabber)); 543 } 544 } 545 546 #ifdef XMLTV_CACHE 547 if ((*it).xmltvgrabber_cache) 548 { 549 QString cachefile = QString("%1/%2_cache.conf") 550 .arg(MythContext::GetConfDir()) 551 .arg((*it).name); 552 553 QFile file(cachefile); 554 if (!file.exists()) 555 { 556 QString cachedir = QString("%1/%2_cache") 557 .arg(MythContext::GetConfDir()) 558 .arg((*it).name); 559 560 if (file.open(IO_WriteOnly)) 561 { 562 QTextStream stream(&file); 563 stream << "BasePath " << cachedir << "\n"; 564 stream << "Verbose 1" << "\n"; 565 file.close(); 566 } 567 else 568 { 569 VERBOSE(VB_IMPORTANT, QString("Creating cache config, " 570 "%1, failed.").arg(cachedir)); 571 (*it).xmltvgrabber_cache = false; 572 } 573 574 QDir dir(cachedir); 575 if (!dir.exists() && !dir.mkdir(dir.path())) 576 { 577 VERBOSE(VB_IMPORTANT, QString("Creating cache directory, " 578 "%1, failed.").arg(cachedir)); 579 (*it).xmltvgrabber_cache = false; 580 } 581 } 582 } 583 #endif // XMLTV_CACHE 584 585 if ((xmltv_grabber == "datadirect") && dd_grab_all) 586 { 528 587 if (only_update_channels) 529 588 DataDirectUpdateChannels(*it); 530 589 else … … 533 592 grabData(*it, 0, &qCurrentDate); 534 593 } 535 594 } 536 else if (xmltv_grabber == "datadirect" || 537 xmltv_grabber == "tv_grab_se_swedb" || 538 xmltv_grabber == "tv_grab_no" || 539 xmltv_grabber == "tv_grab_de_tvtoday" || 540 xmltv_grabber == "tv_grab_be_tvb" || 541 xmltv_grabber == "tv_grab_be_tlm" || 542 xmltv_grabber == "tv_grab_is" || 543 xmltv_grabber == "tv_grab_br" || 544 xmltv_grabber == "tv_grab_cz" || 545 xmltv_grabber == "tv_grab_ru") 595 else if ((*it).xmltvgrabber_prefmethod == "allatonce") 546 596 { 547 // Grabbers supporting the --offset option 597 if (!grabData(*it, 0)) 598 ++failures; 599 } 600 else if ((*it).xmltvgrabber_baseline || xmltv_grabber == "datadirect") 601 { 548 602 549 if (xmltv_grabber == "tv_grab_no")550 prog_data.listing_wrap_offset = 6 * 3600;551 552 603 QDate qCurrentDate = QDate::currentDate(); 553 604 554 int grabdays = 9; 605 // We'll keep grabbing until it returns nothing 606 // Max days currently supported is 21 607 int grabdays = 21; 555 608 556 // Grab different amount of days for the different grabbers,557 // often decided by the person maintaining the grabbers.558 609 if (maxDays > 0) // passed with --max-days 559 610 grabdays = maxDays; 560 else if (xmltv_grabber == "datadirect") 611 else if (xmltv_grabber == "datadirect") { 561 612 grabdays = 14; 562 else if (xmltv_grabber == "tv_grab_se_swedb") 563 grabdays = 10; 564 else if (xmltv_grabber == "tv_grab_no" || 565 xmltv_grabber == "tv_grab_de_tvtoday") 566 grabdays = 7; 567 else if (xmltv_grabber == "tv_grab_be_tvb" || 568 xmltv_grabber == "tv_grab_be_tlm") 569 grabdays = 5; 613 } 570 614 571 615 grabdays = (only_update_channels) ? 1 : grabdays; 572 616 … … 612 656 (i == 2 && refresh_second)) 613 657 { 614 658 // Always refresh if the user specified today/tomorrow/second. 659 if (refresh_today) { 660 VERBOSE(VB_GENERAL, 661 "Data Refresh needed because user specified --refresh-today"); 662 } 663 else if (refresh_second) { 664 VERBOSE(VB_GENERAL, 665 "Data Refresh needed because user specified --refresh-second"); 666 } 667 else { 668 VERBOSE(VB_GENERAL, 669 "Data Refresh always needed for tomorrow"); 670 } 615 671 download_needed = true; 616 672 } 617 else if (xmltv_grabber == "tv_grab_se_swedb")618 {619 // Since tv_grab_se_swedb handles caching internally,620 // let it do its job and always grab new data.621 VERBOSE(VB_GENERAL,622 "Data Refresh needed because the grabber relies on "623 "internal caching.");624 download_needed = true;625 }626 673 else 627 674 { 628 675 // Check to see if we already downloaded data for this date. … … 639 686 "INTERVAL '%1' DAY), INTERVAL '20' HOUR) " 640 687 " AND starttime < DATE_ADD(CURRENT_DATE(), " 641 688 "INTERVAL '%2' DAY) " 642 "WHERE c.sourceid = %3 "689 "WHERE c.sourceid = %3 AND c.xmltvid != '' " 643 690 "GROUP BY c.chanid;"; 644 691 645 692 if (query.exec(querystr.arg(i-1).arg(i).arg((*it).id)) && 646 693 query.isActive()) 647 694 { … … 751 798 "offset day %2.").arg(i-1).arg(i)); 752 799 download_needed = true; 753 800 } 754 } 801 } 755 802 756 803 if (download_needed) 757 804 { … … 765 812 break; 766 813 } 767 814 } 815 816 if (endofdata) { 817 VERBOSE(VB_GENERAL, 818 QString("Grabber is no longer returning program data, finishing")); 819 break; 820 } 768 821 } 769 822 else 770 823 { … … 774 827 } 775 828 } 776 829 } 777 else if (xmltv_grabber == "eitonly")778 {779 VERBOSE(VB_IMPORTANT, "Source configured to use only the "780 "broadcasted guide data. Skipping.");781 externally_handled++;782 query.exec(QString("UPDATE settings SET data ='%1' "783 "WHERE value='mythfilldatabaseLastRunStart' OR "784 "value = 'mythfilldatabaseLastRunEnd'")785 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm")));786 }787 else if (xmltv_grabber == "/bin/true" ||788 xmltv_grabber == "none" ||789 xmltv_grabber == "")790 {791 VERBOSE(VB_IMPORTANT,792 "Source configured with no grabber. Nothing to do.");793 externally_handled++;794 query.exec(QString("UPDATE settings SET data ='%1' "795 "WHERE value='mythfilldatabaseLastRunStart' OR "796 "value = 'mythfilldatabaseLastRunEnd'")797 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm")));798 }799 830 else 800 831 { 801 832 VERBOSE(VB_IMPORTANT, 802 833 QString("Grabbing XMLTV data using ") + xmltv_grabber + 803 " is not verified as working."); 834 " is not supported. You may need to upgrade to" 835 " the latest version of XMLTV."); 804 836 } 805 837 806 838 if (interrupted) -
mythtv/programs/mythfilldatabase/main.cpp
399 399 cout << "--refresh-today\n"; 400 400 cout << "--refresh-second\n"; 401 401 cout << "--refresh-all\n"; 402 cout << " (Only valid for grabbers: DataDirect, se_swedb, no, ee, de_tvtoday)\n";402 cout << " (Only valid for selected grabbers: e.g. DataDirect)\n"; 403 403 cout << " Force a refresh today or two days (or every day) from now,\n"; 404 404 cout << " to catch the latest changes\n"; 405 405 cout << "--dont-refresh-tomorrow\n"; … … 548 548 "FROM videosource ") + where + 549 549 QString(" ORDER BY sourceid;"); 550 550 sourcequery.exec(querystr); 551 551 552 552 if (sourcequery.isActive()) 553 553 { 554 554 if (sourcequery.size() > 0) … … 556 556 while (sourcequery.next()) 557 557 { 558 558 Source newsource; 559 559 560 560 newsource.id = sourcequery.value(0).toInt(); 561 561 newsource.name = sourcequery.value(1).toString(); 562 562 newsource.xmltvgrabber = sourcequery.value(2).toString(); … … 564 564 newsource.password = sourcequery.value(4).toString(); 565 565 newsource.lineupid = sourcequery.value(5).toString(); 566 566 567 newsource.xmltvgrabber_baseline = false; 568 newsource.xmltvgrabber_manualconfig = false; 569 newsource.xmltvgrabber_cache = false; 570 newsource.xmltvgrabber_prefmethod = ""; 571 567 572 sourcelist.append(newsource); 568 573 if (newsource.xmltvgrabber == "datadirect") 569 574 usingDataDirect = true; -
mythtv/programs/mythfilldatabase/filldata.h
22 22 QString userid; 23 23 QString password; 24 24 QString lineupid; 25 bool xmltvgrabber_baseline; 26 bool xmltvgrabber_manualconfig; 27 bool xmltvgrabber_cache; 28 QString xmltvgrabber_prefmethod; 25 29 }; 26 30 27 31 class FillData … … 31 35 logged_in(""), 32 36 lastdduserid(QString::null), graboptions(""), 33 37 raw_lineup(0), maxDays(0), 34 interrupted(false), 38 interrupted(false), endofdata(false), 35 39 refresh_today(false), refresh_tomorrow(true), 36 40 refresh_second(false), refresh_all(false), 37 41 refresh_tba(true), dd_grab_all(false), … … 73 77 int maxDays; 74 78 75 79 bool interrupted; 80 bool endofdata; 76 81 bool refresh_today; 77 82 bool refresh_tomorrow; 78 83 bool refresh_second; -
mythtv/programs/mythfilldatabase/xmltvparser.cpp
56 56 QString xmltvid = element.attribute("id", ""); 57 57 QStringList split = QStringList::split(" ", xmltvid); 58 58 59 bool xmltvisjunk = false; 59 chaninfo->callsign = ""; 60 chaninfo->chanstr = ""; 61 chaninfo->xmltvid = xmltvid; 60 62 61 if (isNorthAmerica)62 {63 if (xmltvid.contains("zap2it"))64 {65 xmltvisjunk = true;66 chaninfo->chanstr = "";67 chaninfo->xmltvid = xmltvid;68 chaninfo->callsign = "";69 }70 else71 {72 chaninfo->xmltvid = split[0];73 chaninfo->chanstr = split[0];74 if (split.size() > 1)75 chaninfo->callsign = split[1];76 else77 chaninfo->callsign = "";78 }79 }80 else81 {82 chaninfo->callsign = "";83 chaninfo->chanstr = "";84 chaninfo->xmltvid = xmltvid;85 }86 87 63 chaninfo->iconpath = ""; 88 64 chaninfo->name = ""; 89 65 chaninfo->finetune = ""; … … 105 81 if (chaninfo->name.length() == 0) 106 82 { 107 83 chaninfo->name = info.text(); 108 if (xmltvisjunk)109 {110 QStringList split = QStringList::split(" ",111 chaninfo->name);112 113 if (split[0] == "Channel")114 {115 chaninfo->old_xmltvid = split[1];116 chaninfo->chanstr = split[1];117 if (split.size() > 2)118 chaninfo->callsign = split[2];119 }120 else121 {122 chaninfo->old_xmltvid = split[0];123 chaninfo->chanstr = split[0];124 if (split.size() > 1)125 chaninfo->callsign = split[1];126 }127 }128 84 } 129 85 else if (isJapan && chaninfo->callsign.length() == 0) 130 86 { … … 377 333 else if (info.tagName() == "category") 378 334 { 379 335 QString cat = getFirstText(info); 380 336 381 337 if (cat == "movie" || cat == "series" || 382 338 cat == "sports" || cat == "tvshow") 383 339 { … … 389 345 pginfo->category = cat; 390 346 } 391 347 392 if ((cat == "Film" || cat == "film") && !isNorthAmerica)393 {394 // Hack for tv_grab_uk_rt395 pginfo->catType = "movie";396 }348 // if ((cat == "Film" || cat == "film") && !isNorthAmerica) 349 // { 350 // // Hack for tv_grab_uk_rt 351 // pginfo->catType = "movie"; 352 // } 397 353 } 398 354 else if (info.tagName() == "date" && pginfo->airdate == "") 399 355 { … … 517 473 518 474 if (pginfo->category.isEmpty() && !pginfo->catType.isEmpty()) 519 475 pginfo->category = pginfo->catType; 520 521 /* Do what MythWeb does and assume that programmes with522 star-rating in America are movies. This allows us to523 unify app code with grabbers which explicitly deliver that524 info. */525 if (isNorthAmerica && pginfo->catType == "" &&526 pginfo->stars != "" && pginfo->airdate != "")527 pginfo->catType = "movie";528 476 529 477 /* Hack for teveblad grabber to do something with the content tag*/ 530 478 if (pginfo->content != "") -
mythtv/programs/mythfilldatabase/xmltvparser.h
14 14 class XMLTVParser 15 15 { 16 16 public: 17 XMLTVParser() : is NorthAmerica(false), isJapan(false) {}17 XMLTVParser() : isJapan(false) {} 18 18 19 19 ChanInfo *parseChannel(QDomElement &element, QUrl baseUrl); 20 20 ProgInfo *parseProgram(QDomElement &element, int localTimezoneOffset); … … 24 24 25 25 26 26 public: 27 bool isNorthAmerica;28 27 bool isJapan; 29 28 }; 30 29