Ticket #494: eitcrawl-num-events-added.diff

File eitcrawl-num-events-added.diff, 2.6 KB (added by Stuart Auchterlonie, 14 years ago)

Print summary of events added once they've all been added.

  • libs/libmythtv/eithelper.cpp

    old new  
    6565        eitList.pop_front();
    6666
    6767        eitList_lock.unlock();
    68         UpdateEITList(mplexid, *events);
     68        eitCount += UpdateEITList(mplexid, *events);
    6969        QList_Events::iterator it = events->begin();
    7070        for (; it != events->end(); ++it)
    7171            delete *it;
    7272        delete events;
    7373        eitList_lock.lock();
     74        if (eitCount != 0)
     75        {
     76            VERBOSE(VB_IMPORTANT, QString ("EITHelper: Added %1 events")
     77                    .arg(eitCount));
     78        }
     79        eitCount = 0;
    7480    }
    7581    else
    7682    {
     
    8389        events->erase(events->begin(), subset_end);
    8490       
    8591        eitList_lock.unlock();
    86         UpdateEITList(mplexid, subset);
     92        eitCount += UpdateEITList(mplexid, subset);
    8793        QList_Events::iterator it = subset.begin();
    8894        for (; it != subset.end(); ++it)
    8995            delete *it;
     
    102108    return chanid;
    103109}
    104110
    105 void EITHelper::UpdateEITList(int mplexid, const QList_Events &events)
     111uint EITHelper::UpdateEITList(int mplexid, const QList_Events &events)
    106112{
    107113    MSqlQuery query1(MSqlQuery::InitCon());
    108114    MSqlQuery query2(MSqlQuery::InitCon());
     
    122128        VERBOSE(VB_SCHEDULE, QString("EITHelper: Added %1 events in this pass")
    123129                .arg(counter));
    124130    }
     131    eitCount += counter;
     132    return counter;
    125133}
    126134
    127135static int get_chan_id_from_db(int mplexid, const Event &event)
  • libs/libmythtv/eithelper.h

    old new  
    2020{
    2121    Q_OBJECT
    2222  public:
    23     EITHelper() : QObject(NULL, "EITHelper") { ; }
     23    EITHelper() : QObject(NULL, "EITHelper"), eitCount(0) { ; }
    2424
    2525    void ClearList(void);
    2626    uint GetListSize(void) const;
     
    3131
    3232  private:
    3333    int GetChanID(int tid_db, const Event &event) const;
    34     static void UpdateEITList(int mplexid, const QList_Events &events);
     34    uint UpdateEITList(int mplexid, const QList_Events &events);
    3535
    3636    QListList_Events  eitList;      ///< Event Information Tables List
    3737    mutable QMutex    eitList_lock; ///< EIT List lock
     
    3939
    4040    /// Maximum number of DB inserts per ProcessEvents call.
    4141    static const uint kChunkSize;
     42    uint eitCount;
    4243};
    4344
    4445#endif // USING_DVB