Ticket #363: dbox2.patch

File dbox2.patch, 2.2 KB (added by juski, 19 years ago)

DBOX2 patch to selectively grab EPG

  • dbox2epg.cpp

    old new  
    6767        // Wait before processing
    6868        usleep(waitTime);
    6969
    70         RequestEPG(m_requestedChannel);
    71         m_pendingRequest = false;
     70        // Only grab the EPG for this channel if useonairguide is set to 1
     71        // Qstring::compare returns zero if both strings are equal
     72
     73        if (!QString::compare( CheckUseOnAirGuide(), "1") )
     74                {
     75                        RequestEPG(m_requestedChannel);
     76                        m_pendingRequest = false;
     77                }
     78
     79        else
     80                {
     81                 // do nothing
     82                printf (QString("Skipping EPG grab for channel %1 \n").arg(m_requestedChannel));
     83                EPGFinished();
     84                }
     85
    7286    }
    7387#ifdef DEBUG_DBOX2EPG
    7488    VERBOSE(VB_IMPORTANT, QString("DBOXEPG#%1: Exiting Thread....").arg(m_cardid));
     
    244258    }
    245259    return "";
    246260}
     261QString DBox2EPG::CheckUseOnAirGuide()
     262{
     263    MSqlQuery query(MSqlQuery::InitCon());
     264    query.prepare("SELECT useonairguide "
     265                  "FROM channel "
     266                  "WHERE "
     267                  "channel.channum = :CHANNUM");
     268    query.bindValue(":CHANNUM", m_requestedChannel);
    247269
     270   if (query.exec() && query.isActive() && query.size() > 0)
     271    {
     272        query.next();
     273        return query.value(0).toString();
     274    }
     275    return "";
     276}
  • dbox2epg.h

    old new  
    77#ifndef DBOX2EPG_H_
    88#define DBOX2EPG_H_
    99
    10 #include <map>
    11 using namespace std;
    12 
    13 #include <qhttp.h>
     10#include "qhttp.h"
    1411#include <qobject.h>
    1512#include <qthread.h>
    16 
    1713#include "mythcontext.h"
    1814#include "tv_rec.h"
    1915#include "dbox2channel.h"
     
    3026        void RequestEPG(const QString& channelNumber);
    3127        void ScheduleRequestEPG(const QString& channelNumber);
    3228        void Shutdown();
    33 
    3429    public slots:
    3530        void httpRequestFinished(int requestID, bool error);
    3631
     
    4237        void UpdateDataBase(QString* chanID, QDateTime* startTime, QDateTime* endTime, QString* title, QString *description, QString *category);
    4338        QString DBox2EPG::ParseNextLine(QByteArray buffer, int* index, int size);
    4439        QString GetChannelID(const QString& channelnumber) ;
     40        QString CheckUseOnAirGuide() ;
    4541        void run();
    4642
    4743        QHttp* http;