Ticket #3842: 3842-head-v1.patch

File 3842-head-v1.patch, 12.9 KB (added by danielk, 17 years ago)

Patch against head for basic Schedules Direct support (portions by Greg Estabrooks), lightly tested.

  • libs/libmythtv/videosource.h

     
    110110{
    111111    Q_OBJECT
    112112  public:
    113     DataDirect_config(const VideoSource& _parent, int _source = DD_ZAP2IT);
     113    DataDirect_config(const VideoSource& _parent, int _ddsource);
    114114
    115115    virtual void load(void);
    116116
  • libs/libmythtv/datadirect.h

     
    1313
    1414enum DD_PROVIDERS
    1515{
    16     DD_ZAP2IT = 0,
    17     DD_PROVIDER_COUNT,
     16    DD_ZAP2IT           = 0,
     17    DD_SCHEDULES_DIRECT = 1,
     18    DD_PROVIDER_COUNT   = 2,
    1819};
    1920
    2021class DataDirectURLs
  • libs/libmythtv/datadirect.cpp

     
    542542        "http://datadirect.webservices.zap2it.com/tvlistings/xtvdService",
    543543        "http://labs.zap2it.com",
    544544        "/ztvws/ztvws_login/1,1059,TMS01-1,00.html");
     545    DataDirectURLs urls1(
     546        "Schedules Direct",
     547        "http://webservices.schedulesdirect.tmsdatadirect.com"
     548        "/schedulesdirect/tvlistings/xtvdService",
     549        "http://schedulesdirect.org",
     550        "/login/index.php");
    545551    providers.push_back(urls0);
     552    providers.push_back(urls1);
    546553
    547554    QString tmpDir = "/tmp";
    548555    tmpPostFile   = makeTempFile(tmpDir + "/mythtv_post_XXXXXX");
     
    10831090        "  channelMinor char(3) )";
    10841091
    10851092    dd_tables["dd_schedule"] =
    1086         "( programid char(12),           stationid char(12), "
     1093        "( programid char(40),           stationid char(12), "
    10871094        "  scheduletime datetime,        duration time,      "
    10881095        "  isrepeat bool,                stereo bool,        "
    10891096        "  subtitled bool,               hdtv bool,          "
     
    10931100        "INDEX progidx (programid) )";
    10941101
    10951102    dd_tables["dd_program"] =
    1096         "( programid char(12) NOT NULL,  seriesid char(12),     "
     1103        "( programid char(40) NOT NULL,  seriesid char(12),     "
    10971104        "  title varchar(120),           subtitle varchar(150), "
    10981105        "  description text,             mpaarating char(5),    "
    10991106        "  starrating char(5),           runtime time,          "
     
    11151122        "  partnumber int,               parttotal int,               "
    11161123        "  seriesid char(12),            originalairdate date,        "
    11171124        "  showtype varchar(30),         colorcode varchar(20),       "
    1118         "  syndicatedepisodenumber varchar(20), programid char(12),   "
     1125        "  syndicatedepisodenumber varchar(20), programid char(40),   "
    11191126        "  tvrating char(5),             mpaarating char(5),          "
    11201127        "INDEX progidx (programid))";
    11211128
    11221129    dd_tables["dd_productioncrew"] =
    1123         "( programid char(12),           role char(30),    "
     1130        "( programid char(40),           role char(30),    "
    11241131        "  givenname char(20),           surname char(20), "
    11251132        "  fullname char(41), "
    11261133        "INDEX progidx (programid), "
    11271134        "INDEX nameidx (fullname))";
    11281135
    11291136    dd_tables["dd_genre"] =
    1130         "( programid char(12) NOT NULL,  class char(30), "
     1137        "( programid char(40) NOT NULL,  class char(30), "
    11311138        "  relevance char(1), "
    11321139        "INDEX progidx (programid))";
    11331140
  • libs/libmythtv/videosource.cpp

     
    2020#include <qmap.h>
    2121#include <qdir.h>
    2222#include <qprocess.h>
     23#include <qdatetime.h>
    2324
    2425// MythTV headers
    2526#include "mythconfig.h"
     
    4445#include "videodev_myth.h"
    4546#endif
    4647
     48static bool is_grabber_external(const QString &grabber)
     49{
     50    return !(grabber == "datadirect" ||
     51             grabber == "eitonly" ||
     52             grabber == "schedulesdirect1" ||
     53             grabber == "/bin/true");
     54}
     55
    4756VideoSourceSelector::VideoSourceSelector(uint           _initial_sourceid,
    4857                                         const QString &_card_types,
    4958                                         bool           _must_have_mplexid) :
     
    295304{
    296305  public:
    297306    DataDirectPassword(const VideoSource &parent) :
    298         LineEditSetting(this), VideoSourceDBStorage(this, parent, "password")
     307        LineEditSetting(this, true),
     308        VideoSourceDBStorage(this, parent, "password")
    299309    {
     310        SetPasswordEcho(true);
    300311        setLabel(QObject::tr("Password"));
    301312    }
    302313};
     
    307318{
    308319    (void) uid;
    309320    (void) pwd;
    310     (void) _source;
    311321#ifdef USING_BACKEND
    312322    if (uid.isEmpty() || pwd.isEmpty())
    313323        return;
     
    348358void DataDirect_config::load()
    349359{
    350360    VerticalConfigurationGroup::load();
    351     if ((userid->getValue() != lastloadeduserid) ||
    352         (password->getValue() != lastloadedpassword))
     361    bool is_sd_userid = userid->getValue().contains("@") > 0;
     362    bool match = ((is_sd_userid  && (source == DD_SCHEDULES_DIRECT)) ||
     363                  (!is_sd_userid && (source == DD_ZAP2IT)));
     364    if (((userid->getValue() != lastloadeduserid) ||
     365         (password->getValue() != lastloadedpassword)) && match)
    353366    {
    354367        lineupselector->fillSelections(userid->getValue(),
    355368                                       password->getValue(),
     
    442455        "instead of just 'mythfilldatabase'.\nYour grabber does not provide "
    443456        "channel numbers, so you have to set them manually.");
    444457
    445     if (grabber != "datadirect" && grabber != "eitonly" &&
    446         grabber != "/bin/true")
     458    if (is_grabber_external(grabber))
    447459    {
    448460        VERBOSE(VB_IMPORTANT, "\n" << err_msg);
    449461        MythPopupBox::showOkPopup(
     
    508520    // only save settings for the selected grabber
    509521    setSaveAll(false);
    510522
    511     addTarget("datadirect", new DataDirect_config(parent));
    512     grabber->addSelection("North America (DataDirect) (Internal)", "datadirect");
     523    addTarget("schedulesdirect1",
     524              new DataDirect_config(parent, DD_SCHEDULES_DIRECT));
     525    grabber->addSelection("North America (SchedulesDirect.org) "
     526                          "(Internal)", "schedulesdirect1");
    513527
     528#if 1
     529    addTarget("datadirect", new DataDirect_config(parent, DD_ZAP2IT));
     530    grabber->addSelection(
     531        "North America (TMS Labs) (Internal)", "datadirect");
     532#endif
     533
    514534    addTarget("eitonly", new EITOnly_config(parent));
    515535    grabber->addSelection("Transmitted guide only (EIT)", "eitonly");
    516536
  • libs/libmyth/settings.cpp

     
    639639        connect(edit, SIGNAL(changeHelpText(QString)), cg,
    640640                SIGNAL(changeHelpText(QString)));
    641641
    642     edit->setRW(rw);
     642    setRW(rw);
     643    SetPasswordEcho(password_echo);
    643644
    644645    return widget;
    645646}
     
    664665    }
    665666}
    666667
     668void LineEditSetting::SetPasswordEcho(bool b)
     669{
     670    password_echo = b;
     671    if (edit)
     672        edit->setEchoMode(b ? QLineEdit::Password : QLineEdit::Normal);
     673}
     674
    667675QWidget* SliderSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,
    668676                                     const char* widgetName) {
    669677    QHBox* widget;
  • libs/libmyth/mythcontext.h

     
    208208
    209209/// Update this whenever the plug-in API changes.
    210210/// Including changes in the libmythtv class methods used by plug-ins.
    211 #define MYTH_BINARY_VERSION "0.20.20070717-1"
     211#define MYTH_BINARY_VERSION "0.20.20070816-1"
    212212
    213213/** \brief Increment this whenever the MythTV network protocol changes.
    214214 *
  • libs/libmyth/settings.h

     
    200200{
    201201  protected:
    202202    LineEditSetting(Storage *_storage, bool readwrite = true) :
    203         Setting(_storage), edit(NULL), rw(readwrite) { }
     203        Setting(_storage), edit(NULL), rw(readwrite), password_echo(false) { }
    204204
    205205  public:
    206206    virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent,
     
    217217
    218218    virtual void setEnabled(bool b);
    219219    virtual void setVisible(bool b);
     220    virtual void SetPasswordEcho(bool b);
    220221
    221222private:
    222223    MythLineEdit* edit;
    223224    bool rw;
     225    bool password_echo;
    224226};
    225227
    226228// TODO: set things up so that setting the value as a string emits
  • programs/mythfilldatabase/filldata.cpp

     
    2626// filldata headers
    2727#include "filldata.h"
    2828
     29bool is_grabber_external(const QString &grabber)
     30{
     31    return !(grabber == "datadirect" ||
     32             grabber == "eitonly" ||
     33             grabber == "schedulesdirect1" ||
     34             grabber == "/bin/true");
     35}
     36
     37bool is_grabber_datadirect(const QString &grabber)
     38{
     39    return (grabber == "datadirect") || (grabber == "schedulesdirect1");
     40}
     41
     42bool is_grabber_labs(const QString &grabber)
     43{
     44    return grabber == "datadirect";
     45}
     46
    2947// DataDirect stuff
    3048void FillData::DataDirectStationUpdate(Source source, bool update_icons)
    3149{
     
    4462        icon_data.UpdateSourceIcons(source.id);
    4563
    4664    // Unselect channels not in users lineup for DVB, HDTV
    47     if (!insert_channels && (new_channels > 0))
     65    if (!insert_channels && (new_channels > 0) &&
     66        is_grabber_labs(source.xmltvgrabber))
    4867    {
    4968        bool ok0 = (logged_in == source.userid);
    5069        bool ok1 = (raw_lineup == source.id);
     
    6988
    7089bool FillData::DataDirectUpdateChannels(Source source)
    7190{
     91    if (!is_grabber_labs(source.xmltvgrabber))
     92    {
     93        VERBOSE(VB_IMPORTANT, "FillData: We only support "
     94                "DataDirectUpdateChannels with TMS Labs channel editor");
     95        return false;
     96    }
     97
    7298    ddprocessor.SetListingsProvider(DD_ZAP2IT);
    7399    ddprocessor.SetUserID(source.userid);
    74100    ddprocessor.SetPassword(source.password);
     
    251277
    252278    if (xmltv_grabber == "datadirect")
    253279        return grabDDData(source, offset, *qCurrentDate, DD_ZAP2IT);
     280    if (xmltv_grabber == "schedulesdirect1")
     281        return grabDDData(source, offset, *qCurrentDate, DD_SCHEDULES_DIRECT);
    254282
    255283    char tempfilename[] = "/tmp/mythXXXXXX";
    256284    if (mkstemp(tempfilename) == -1)
     
    486514
    487515        bool hasprefmethod = false;
    488516
    489         if (xmltv_grabber != "datadirect")
     517        if (is_grabber_external(xmltv_grabber))
    490518        {
    491519
    492520            QProcess grabber_capabilities_proc(xmltv_grabber);
     
    584612            }
    585613        }
    586614
    587         need_post_grab_proc |= (xmltv_grabber != "datadirect");
     615        need_post_grab_proc |= !is_grabber_datadirect(xmltv_grabber);
    588616
    589         if ((xmltv_grabber == "datadirect") && dd_grab_all)
     617        if (is_grabber_labs(xmltv_grabber) && dd_grab_all)
    590618        {
    591619            if (only_update_channels)
    592620                DataDirectUpdateChannels(*it);
     
    601629            if (!grabData(*it, 0))
    602630                ++failures;
    603631        }
    604         else if ((*it).xmltvgrabber_baseline || xmltv_grabber == "datadirect")
     632        else if ((*it).xmltvgrabber_baseline ||
     633                 is_grabber_datadirect(xmltv_grabber))
    605634        {
    606635
    607636            QDate qCurrentDate = QDate::currentDate();
     
    612641
    613642            if (maxDays > 0) // passed with --max-days
    614643                grabdays = maxDays;
    615             else if (xmltv_grabber == "datadirect")
     644            else if (is_grabber_datadirect(xmltv_grabber))
    616645                grabdays = 14;
    617646
    618647            grabdays = (only_update_channels) ? 1 : grabdays;
     
    620649            if (grabdays == 1)
    621650                refresh_today = true;
    622651
    623             if ((xmltv_grabber == "datadirect") && only_update_channels)
     652            if (is_grabber_labs(xmltv_grabber) && only_update_channels)
    624653            {
    625654                DataDirectUpdateChannels(*it);
    626655                grabdays = 0;
  • programs/mythfilldatabase/main.cpp

     
    579579                       newsource.xmltvgrabber_prefmethod = "";
    580580
    581581                       sourcelist.append(newsource);
    582                        if (newsource.xmltvgrabber == "datadirect")
    583                            usingDataDirect = true;
     582                       usingDataDirect =
     583                           ((newsource.xmltvgrabber == "datadirect") ||
     584                            (newsource.xmltvgrabber == "schedulesdirect1"));
    584585                  }
    585586             }
    586587             else