Ticket #1777: xmltv_capabilities_3.diff

File xmltv_capabilities_3.diff, 30.4 KB (added by stuartm, 17 years ago)

Final version of patch

  • mythtv/programs/mythfilldatabase/filldata.cpp

     
    1616#include <qdatetime.h>
    1717#include <qdir.h>
    1818#include <qfile.h>
     19#include <qprocess.h>
    1920
    2021// libmyth headers
    2122#include "exitcodes.h"
     
    215216
    216217    chan_data.handleChannels(id, &chanlist);
    217218    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    }
    219227    return true;
    220228}
    221229
     
    241249
    242250    if (xmltv_grabber == "datadirect")
    243251        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
    250253    char tempfilename[] = "/tmp/mythXXXXXX";
    251254    if (mkstemp(tempfilename) == -1)
    252255    {
     
    261264    QString home = QDir::homeDirPath();
    262265    QString configfile = QString("%1/%2.xmltv").arg(MythContext::GetConfDir())
    263266                                                       .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());
    265273
    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")
    302277    {
    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;
    308280    }
    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")
    351282    {
    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);
    356288    }
    357289
    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 
    383290    VERBOSE(VB_GENERAL,
    384291            "----------------- Start of XMLTV output -----------------");
    385292
     
    491398                                  .arg((*it).xmltvgrabber));
    492399
    493400        query.prepare(
    494             "SELECT COUNT(chanid) FROM channel WHERE sourceid = :SRCID");
     401            "SELECT COUNT(chanid) FROM channel WHERE sourceid = "
     402             ":SRCID AND xmltvid != ''");
    495403        query.bindValue(":SRCID", (*it).id);
    496404        query.exec();
    497405
    498406        if (query.isActive() && query.numRowsAffected() > 0) {
    499407            query.next();
    500408            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")
    502411                                        .arg(source_channels).arg((*it).id));
    503412        } else {
    504413            source_channels = 0;
     
    510419        QString xmltv_grabber = (*it).xmltvgrabber;
    511420        need_post_grab_proc |= (xmltv_grabber != "datadirect");
    512421
    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")
    520423        {
    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;
    525432        }
    526         else if ((xmltv_grabber == "datadirect") && dd_grab_all)
     433        else if (xmltv_grabber == "/bin/true" ||
     434                 xmltv_grabber == "none" ||
     435                 xmltv_grabber == "")
    527436        {
     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        {
    528587            if (only_update_channels)
    529588                DataDirectUpdateChannels(*it);
    530589            else
     
    533592                grabData(*it, 0, &qCurrentDate);
    534593            }
    535594        }
    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")
    546596        {
    547             // Grabbers supporting the --offset option
     597            if (!grabData(*it, 0))
     598                ++failures;
     599        }
     600        else if ((*it).xmltvgrabber_baseline || xmltv_grabber == "datadirect")
     601        {
    548602
    549             if (xmltv_grabber == "tv_grab_no")
    550                 prog_data.listing_wrap_offset = 6 * 3600;
    551 
    552603            QDate qCurrentDate = QDate::currentDate();
    553604
    554             int grabdays = 9;
     605            // We'll keep grabbing until it returns nothing
     606            // Max days currently supported is 21
     607            int grabdays = 21;
    555608
    556             // Grab different amount of days for the different grabbers,
    557             // often decided by the person maintaining the grabbers.
    558609            if (maxDays > 0) // passed with --max-days
    559610                grabdays = maxDays;
    560             else if (xmltv_grabber == "datadirect")
     611            else if (xmltv_grabber == "datadirect") {
    561612                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            }
    570614
    571615            grabdays = (only_update_channels) ? 1 : grabdays;
    572616
     
    612656                         (i == 2 && refresh_second))
    613657                {
    614658                    // 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                    }
    615671                    download_needed = true;
    616672                }
    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                 }
    626673                else
    627674                {
    628675                    // Check to see if we already downloaded data for this date.
     
    639686                                   "INTERVAL '%1' DAY), INTERVAL '20' HOUR) "
    640687                               "  AND starttime < DATE_ADD(CURRENT_DATE(), "
    641688                                   "INTERVAL '%2' DAY) "
    642                                "WHERE c.sourceid = %3 "
     689                               "WHERE c.sourceid = %3 AND c.xmltvid != '' "
    643690                               "GROUP BY c.chanid;";
    644  
     691
    645692                    if (query.exec(querystr.arg(i-1).arg(i).arg((*it).id)) &&
    646693                        query.isActive())
    647694                    {
     
    751798                                "offset day %2.").arg(i-1).arg(i));
    752799                        download_needed = true;
    753800                    }
    754                 } 
     801                }
    755802
    756803                if (download_needed)
    757804                {
     
    765812                            break;
    766813                        }
    767814                    }
     815
     816                    if (endofdata) {
     817                        VERBOSE(VB_GENERAL,
     818                            QString("Grabber is no longer returning program data, finishing"));
     819                        break;
     820                    }
    768821                }
    769822                else
    770823                {
     
    774827                }
    775828            }
    776829        }
    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         }
    799830        else
    800831        {
    801832            VERBOSE(VB_IMPORTANT,
    802833                    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.");
    804836        }
    805837
    806838        if (interrupted)
  • mythtv/programs/mythfilldatabase/main.cpp

     
    399399            cout << "--refresh-today\n";
    400400            cout << "--refresh-second\n";
    401401            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";
    403403            cout << "   Force a refresh today or two days (or every day) from now,\n";
    404404            cout << "   to catch the latest changes\n";
    405405            cout << "--dont-refresh-tomorrow\n";
     
    548548                                   "FROM videosource ") + where +
    549549                                   QString(" ORDER BY sourceid;");
    550550        sourcequery.exec(querystr);
    551        
     551
    552552        if (sourcequery.isActive())
    553553        {
    554554             if (sourcequery.size() > 0)
     
    556556                  while (sourcequery.next())
    557557                  {
    558558                       Source newsource;
    559            
     559
    560560                       newsource.id = sourcequery.value(0).toInt();
    561561                       newsource.name = sourcequery.value(1).toString();
    562562                       newsource.xmltvgrabber = sourcequery.value(2).toString();
     
    564564                       newsource.password = sourcequery.value(4).toString();
    565565                       newsource.lineupid = sourcequery.value(5).toString();
    566566
     567                       newsource.xmltvgrabber_baseline = false;
     568                       newsource.xmltvgrabber_manualconfig = false;
     569                       newsource.xmltvgrabber_cache = false;
     570                       newsource.xmltvgrabber_prefmethod = "";
     571
    567572                       sourcelist.append(newsource);
    568573                       if (newsource.xmltvgrabber == "datadirect")
    569574                           usingDataDirect = true;
  • mythtv/programs/mythfilldatabase/filldata.h

     
    2222    QString userid;
    2323    QString password;
    2424    QString lineupid;
     25    bool    xmltvgrabber_baseline;
     26    bool    xmltvgrabber_manualconfig;
     27    bool    xmltvgrabber_cache;
     28    QString xmltvgrabber_prefmethod;
    2529};
    2630
    2731class FillData
     
    3135        logged_in(""),
    3236        lastdduserid(QString::null),    graboptions(""),
    3337        raw_lineup(0),                  maxDays(0),
    34         interrupted(false),
     38        interrupted(false),             endofdata(false),
    3539        refresh_today(false),           refresh_tomorrow(true),
    3640        refresh_second(false),          refresh_all(false),
    3741        refresh_tba(true),              dd_grab_all(false),
     
    7377    int     maxDays;
    7478
    7579    bool    interrupted;
     80    bool    endofdata;
    7681    bool    refresh_today;
    7782    bool    refresh_tomorrow;
    7883    bool    refresh_second;
  • mythtv/programs/mythfilldatabase/xmltvparser.cpp

     
    5656    QString xmltvid = element.attribute("id", "");
    5757    QStringList split = QStringList::split(" ", xmltvid);
    5858
    59     bool xmltvisjunk = false;
     59    chaninfo->callsign = "";
     60    chaninfo->chanstr = "";
     61    chaninfo->xmltvid = xmltvid;
    6062
    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         else
    71         {
    72             chaninfo->xmltvid = split[0];
    73             chaninfo->chanstr = split[0];
    74             if (split.size() > 1)
    75                 chaninfo->callsign = split[1];
    76             else
    77                 chaninfo->callsign = "";
    78         }
    79     }
    80     else
    81     {
    82         chaninfo->callsign = "";
    83         chaninfo->chanstr = "";
    84         chaninfo->xmltvid = xmltvid;
    85     }
    86 
    8763    chaninfo->iconpath = "";
    8864    chaninfo->name = "";
    8965    chaninfo->finetune = "";
     
    10581                if (chaninfo->name.length() == 0)
    10682                {
    10783                    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                         else
    121                         {
    122                             chaninfo->old_xmltvid = split[0];
    123                             chaninfo->chanstr = split[0];
    124                             if (split.size() > 1)
    125                                 chaninfo->callsign = split[1];
    126                         }
    127                     }
    12884                }
    12985                else if (isJapan && chaninfo->callsign.length() == 0)
    13086                {
     
    377333            else if (info.tagName() == "category")
    378334            {
    379335                QString cat = getFirstText(info);
    380                
     336
    381337                if (cat == "movie" || cat == "series" ||
    382338                    cat == "sports" || cat == "tvshow")
    383339                {
     
    389345                    pginfo->category = cat;
    390346                }
    391347
    392                 if ((cat == "Film" || cat == "film") && !isNorthAmerica)
    393                 {
    394                     // Hack for tv_grab_uk_rt
    395                     pginfo->catType = "movie";
    396                 }
     348//                 if ((cat == "Film" || cat == "film") && !isNorthAmerica)
     349//                 {
     350//                     // Hack for tv_grab_uk_rt
     351//                     pginfo->catType = "movie";
     352//                 }
    397353            }
    398354            else if (info.tagName() == "date" && pginfo->airdate == "")
    399355            {
     
    517473
    518474    if (pginfo->category.isEmpty() && !pginfo->catType.isEmpty())
    519475        pginfo->category = pginfo->catType;
    520 
    521     /* Do what MythWeb does and assume that programmes with
    522        star-rating in America are movies. This allows us to
    523        unify app code with grabbers which explicitly deliver that
    524        info. */
    525     if (isNorthAmerica && pginfo->catType == "" &&
    526         pginfo->stars != "" && pginfo->airdate != "")
    527         pginfo->catType = "movie";
    528476   
    529477    /* Hack for teveblad grabber to do something with the content tag*/
    530478    if (pginfo->content != "")
  • mythtv/programs/mythfilldatabase/xmltvparser.h

     
    1414class XMLTVParser
    1515{
    1616  public:
    17     XMLTVParser() : isNorthAmerica(false), isJapan(false) {}
     17    XMLTVParser() : isJapan(false) {}
    1818
    1919    ChanInfo *parseChannel(QDomElement &element, QUrl baseUrl);
    2020    ProgInfo *parseProgram(QDomElement &element, int localTimezoneOffset);
     
    2424
    2525
    2626  public:
    27     bool isNorthAmerica;
    2827    bool isJapan;
    2928};
    3029