Ticket #541: videosource.2.patch

File videosource.2.patch, 9.3 KB (added by John Pullan <john.pullan@…>, 18 years ago)

Patch to force eit scan to be on for eitonly grabber

  • videosource.h

     
    1616
    1717class SignalTimeout;
    1818class ChannelTimeout;
     19class UseEIT;
    1920
    2021typedef QMap<int,QString> InputNames;
    2122
     
    105106    const VideoSource& parent;
    106107};
    107108
    108 class RegionSelector: public ComboBoxSetting, public TransientStorage {
    109     Q_OBJECT
    110 public:
    111     RegionSelector() {
    112         setLabel(QObject::tr("Region"));
    113         fillSelections();
    114     };
    115 
    116 public slots:
    117     void fillSelections();
    118 };
    119 
    120 class ProviderSelector: public ComboBoxSetting, public TransientStorage {
    121     Q_OBJECT
    122 public:
    123     ProviderSelector(const QString& _grabber) :
    124         grabber(_grabber) { setLabel(QObject::tr("Provider")); };
    125 
    126 public slots:
    127     void fillSelections(const QString& location);
    128 
    129 protected:
    130     QString grabber;
    131 };
    132 
    133109class FreqTableSelector: public ComboBoxSetting, public VSSetting {
    134110    Q_OBJECT
    135111public:
     
    185161    int source;
    186162};
    187163
    188 class XMLTV_uk_config: public VerticalConfigurationGroup {
     164class XMLTV_generic_config: public VerticalConfigurationGroup
     165{
    189166public:
    190     XMLTV_uk_config(const VideoSource& _parent);
     167    XMLTV_generic_config(const VideoSource& _parent, QString _grabber);
    191168
    192169    virtual void save();
    193170
    194171protected:
    195172    const VideoSource& parent;
    196     RegionSelector* region;
    197     ProviderSelector* provider;
     173    QString grabber;
    198174};
    199175
    200 class XMLTV_generic_config: public LabelSetting {
     176class EITOnly_config: public VerticalConfigurationGroup
     177{
    201178public:
    202     XMLTV_generic_config(const VideoSource& _parent, QString _grabber);
    203 
    204     virtual void load() {};
     179    EITOnly_config(const VideoSource& _parent);
    205180    virtual void save();
    206 
    207181protected:
    208     const VideoSource& parent;
    209     QString grabber;
     182    UseEIT *useeit;
    210183};
    211184
    212 class EITOnly_config: public LabelSetting
    213 {
    214   public:
    215     EITOnly_config();
    216 
    217     virtual void load() {};
    218     virtual void save() {};
    219 };
    220 
    221185class XMLTVConfig: public VerticalConfigurationGroup,
    222186                   public TriggeredConfigurationGroup {
    223187public:
  • videosource.cpp

     
    696696    addChild(lp);
    697697
    698698    addChild(lineupselector = new DataDirectLineupSelector(parent));
     699    addChild(new UseEIT(parent));
    699700
    700701    connect(button, SIGNAL(pressed()),
    701702            this,   SLOT(fillDataDirectLineupSelector()));
     
    707708        userid->getValue(), password->getValue(), source);
    708709}
    709710
    710 void RegionSelector::fillSelections()
    711 {
    712     clearSelections();
    713 
    714     QString command = QString("tv_grab_uk --configure --list-regions");
    715     FILE* fp = popen(command.ascii(), "r");
    716 
    717     if (fp == NULL)
    718     {
    719         perror(command.ascii());
    720         return;
    721     }
    722 
    723     QFile f;
    724     f.open(IO_ReadOnly, fp);
    725     for (QString line ; f.readLine(line, 1024) > 0 ; )
    726     {
    727         addSelection(line.stripWhiteSpace());
    728     }
    729 
    730     f.close();
    731     fclose(fp);
    732 }
    733 
    734 void ProviderSelector::fillSelections(const QString& location)
    735 {
    736     QString waitMsg = QString("Fetching providers for %1... Please be patient.")
    737                              .arg(location);
    738     VERBOSE(VB_GENERAL, waitMsg);
    739    
    740     MythProgressDialog pdlg(waitMsg, 2);
    741 
    742     clearSelections();
    743 
    744     // First let the final character show up...
    745     qApp->processEvents();   
    746    
    747     // Now show our progress dialog.
    748     pdlg.show();
    749 
    750     QString command = QString("%1 --configure --postalcode %2 --list-providers")
    751         .arg(grabber)
    752         .arg(location);
    753 
    754     FILE* fp = popen(command.ascii(), "r");
    755 
    756     if (fp == NULL)
    757     {
    758         pdlg.Close();
    759         VERBOSE(VB_GENERAL, "Failed to retrieve provider list");
    760 
    761         MythPopupBox::showOkPopup(gContext->GetMainWindow(),
    762                             QObject::tr("Failed to retrieve provider list"),
    763                             QObject::tr("You probably need to update XMLTV."));
    764         qApp->processEvents();
    765 
    766         perror(command.ascii());
    767         return;
    768     }
    769 
    770     // Update our progress
    771     pdlg.setProgress(1);
    772 
    773     QFile f;
    774     f.open(IO_ReadOnly, fp);
    775     for (QString line ; f.readLine(line, 1024) > 0 ; )
    776     {
    777         QStringList fields = QStringList::split(":", line.stripWhiteSpace());
    778         addSelection(fields.last(), fields.first());
    779     }
    780 
    781     pdlg.setProgress( 2 );
    782     pdlg.Close();
    783 
    784     f.close();
    785     fclose(fp);
    786 }
    787 
    788 XMLTV_uk_config::XMLTV_uk_config(const VideoSource& _parent)
    789   : VerticalConfigurationGroup(false, false), parent(_parent)
    790 {
    791     setLabel(QObject::tr("tv_grab_uk configuration"));
    792     region = new RegionSelector();
    793     addChild(region);
    794 
    795     provider = new ProviderSelector("tv_grab_uk");
    796     addChild(provider);
    797 
    798     connect(region, SIGNAL(valueChanged(const QString&)),
    799             provider, SLOT(fillSelections(const QString&)));
    800 }
    801 
    802 void XMLTV_uk_config::save()
    803 {
    804     QString waitMsg(QObject::tr("Please wait while MythTV retrieves the "
    805                                 "list of available channels\n.  You "
    806                                 "might want to check the output as it\n"
    807                                 "runs by switching to the terminal from "
    808                                 "which you started\nthis program."));
    809     MythProgressDialog pdlg( waitMsg, 2 );
    810     VERBOSE(VB_GENERAL, QString("Please wait while MythTV retrieves the "
    811                                 "list of available channels"));
    812     pdlg.show();
    813 
    814     QString filename = QString("%1/%2.xmltv")
    815         .arg(MythContext::GetConfDir()).arg(parent.getSourceName());
    816     QString command = QString(
    817         "tv_grab_uk --config-file '%1' --configure --retry-limit %2 "
    818         "--retry-delay %3 --postalcode %4 --provider %5 "
    819         "--auto-new-channels add")
    820         .arg(filename)
    821         .arg(2)
    822         .arg(30)
    823         .arg(region->getValue())
    824         .arg(provider->getValue());
    825 
    826     pdlg.setProgress(1);
    827 
    828     int ret = system(command);
    829     if (ret != 0)
    830     {
    831         VERBOSE(VB_GENERAL, command);
    832         VERBOSE(VB_GENERAL, QString("exited with status %1").arg(ret));
    833         MythPopupBox::showOkPopup(gContext->GetMainWindow(),
    834                                   QObject::tr("Failed to retrieve channel "
    835                                               "information."),
    836                                   QObject::tr("MythTV was unable to retrieve "
    837                                               "channel information for your "
    838                                               "provider.\nPlease check the "
    839                                               "terminal window for more "
    840                                               "information"));
    841     }
    842 
    843     pdlg.setProgress( 2 );
    844     pdlg.Close();
    845 }
    846 
    847711XMLTV_generic_config::XMLTV_generic_config(const VideoSource& _parent,
    848712                                           QString _grabber)
    849713                    : parent(_parent), grabber(_grabber)
    850714{
    851     setLabel(grabber);
    852     setValue(QObject::tr("Configuration will run in the terminal window"));
     715    setUseLabel(false);
     716    setUseFrame(false);
     717
     718    TransLabelSetting *label = new TransLabelSetting();
     719    label->setLabel(grabber);
     720    label->setValue(QObject::tr("Configuration will run in the terminal window"));
     721    addChild(label);
     722    addChild(new UseEIT(parent));
    853723}
    854724
    855725void XMLTV_generic_config::save()
    856726{
     727    VerticalConfigurationGroup::save();
    857728    QString waitMsg(QObject::tr("Please wait while MythTV retrieves the "
    858729                                "list of available channels.\nYou "
    859730                                "might want to check the output as it\n"
     
    918789    pdlg.Close();
    919790}
    920791
    921 EITOnly_config::EITOnly_config()
     792EITOnly_config::EITOnly_config(const VideoSource& _parent)
    922793{
    923     setLabel(tr("Use only the transmitted guide data."));
    924     setValue(tr("This will usually only work with ATSC or DVB channels, "
    925                 "and generally provides data only for the next few days."));
     794    setUseLabel(false);
     795    setUseFrame(false);
     796
     797    useeit = new UseEIT(_parent);
     798    useeit->setValue(true);
     799    useeit->setVisible(false);
     800    addChild(useeit);
     801
     802    TransLabelSetting *label;
     803    label=new TransLabelSetting();
     804    label->setValue(tr("Use only the transmitted guide data."));
     805    addChild(label);
     806    label=new TransLabelSetting();
     807    label->setValue(tr("This will usually only work with ATSC or DVB "
     808                       "channels,"));
     809    addChild(label);
     810    label=new TransLabelSetting();
     811    label->setValue(tr("and generally provides data only for the next "
     812                       "few days."));
     813    addChild(label);
    926814}
    927815
     816void EITOnly_config::save()
     817{
     818    // Force this value on
     819    useeit->setValue(true);
     820    useeit->save();
     821}
     822
    928823XMLTVConfig::XMLTVConfig(const VideoSource& parent)
    929824{
    930825    setUseLabel(false);
     
    943838    grabber->addSelection("LxM (United States)", "technovera");
    944839
    945840#ifdef USING_DVB_EIT
    946     addTarget("eitonly", new EITOnly_config());
     841    addTarget("eitonly", new EITOnly_config(parent));
    947842    grabber->addSelection("Transmitted guide only (EIT)", "eitonly");
    948843#endif
    949844
     
    1009904    group->addChild(name = new Name(*this));
    1010905    group->addChild(new XMLTVConfig(*this));
    1011906    group->addChild(new FreqTableSelector(*this));
    1012     group->addChild(new UseEIT(*this));
    1013907    addChild(group);
    1014908}
    1015909