Ticket #2416: ticket2416_copy_eit_2_other_source.patch

File ticket2416_copy_eit_2_other_source.patch, 4.1 KB (added by warped <warpme@…>, 14 months ago)

updated patch for 0.24-fixes

  • mythtv/libs/libmythtv/eithelper.cpp

    diff -Naur mythtv-0.24-20110321-old/mythtv/libs/libmythtv/eithelper.cpp mythtv-0.24-20110321-new/mythtv/libs/libmythtv/eithelper.cpp
    old new  
    3434                                uint atscmajor, uint atscminor); 
    3535static uint get_chan_id_from_db(uint sourceid,  uint serviceid, 
    3636                                uint networkid, uint transportid); 
     37static uint get_mapped_chan_id_from_db(uint serviceid); 
    3738static void init_fixup(QMap<uint64_t,uint> &fix); 
    3839static int calc_eit_utc_offset(void); 
    3940 
     
    485486            seriesId,  programId); 
    486487 
    487488        db_events.enqueue(event); 
     489 
     490        uint mapped_chanid = GetMappedChanID(eit->ServiceID()); 
     491 
     492        if (mapped_chanid > 0) 
     493        { 
     494            DBEventEIT *event = new DBEventEIT(mapped_chanid, 
     495                                         title,     subtitle,      description, 
     496                                         category,  category_type, 
     497                                         starttime, endtime,       fix, 
     498                                         subtitle_type, 
     499                                         audio_props, 
     500                                         video_props, stars, 
     501                                         seriesId,  programId); 
     502            db_events.enqueue(event); 
     503        } 
    488504    } 
    489505} 
    490506 
     
    692708 
    693709    uint chanid = get_chan_id_from_db(sourceid, serviceid, networkid, tsid); 
    694710    if (chanid) 
     711        { 
    695712        srv_to_chanid[key] = chanid; 
    696713 
     714        uint mapped_chanid = get_mapped_chan_id_from_db(serviceid); 
     715        if(mapped_chanid) 
     716            serviceid_to_mapped_chanid[serviceid] = mapped_chanid; 
     717    } 
     718 
    697719    return chanid; 
    698720} 
    699721 
     722uint EITHelper::GetMappedChanID(uint serviceid) 
     723{ 
     724    ServiceIDToMappedChanID::const_iterator it = serviceid_to_mapped_chanid.find(serviceid); 
     725    if (it != serviceid_to_mapped_chanid.end()) 
     726        return max(*it, 0); 
     727    return 0; 
     728}  
     729 
    700730static uint get_chan_id_from_db(uint sourceid, 
    701731                                uint atsc_major, uint atsc_minor) 
    702732{ 
     
    767797    return useOnAirGuide ? chanid : 0; 
    768798} 
    769799 
     800static uint get_mapped_chan_id_from_db(uint serviceid) 
     801{ 
     802    MSqlQuery query(MSqlQuery::InitCon()); 
     803 
     804    QString qstr = 
     805        "SELECT mapped_chanid " 
     806        "FROM eit_mapping " 
     807        "WHERE serviceid = :SERVICEID"; 
     808 
     809    query.prepare(qstr); 
     810    query.bindValue(":SERVICEID", serviceid); 
     811    if (!query.exec() || !query.isActive()) 
     812        MythDB::DBError("Looking up mapped chanID", query); 
     813 
     814    if (query.next()) 
     815    { 
     816        return query.value(0).toUInt(); 
     817    } 
     818 
     819    return 0; 
     820} 
     821 
    770822static void init_fixup(QMap<uint64_t,uint> &fix) 
    771823{ 
    772824    /////////////////////////////////////////////////////////////////////////// 
  • mythtv/libs/libmythtv/eithelper.h

    diff -Naur mythtv-0.24-20110321-old/mythtv/libs/libmythtv/eithelper.h mythtv-0.24-20110321-new/mythtv/libs/libmythtv/eithelper.h
    old new  
    4545typedef QMap<uint,EventIDToATSCEvent>      ATSCSRCToEvents; 
    4646typedef QMap<uint,EventIDToETT>            ATSCSRCToETTs; 
    4747typedef QMap<unsigned long long,int>       ServiceToChanID; 
     48typedef QMap<int,int>                      ServiceIDToMappedChanID; 
    4849 
    4950class DBEventEIT; 
    5051class EITFixUp; 
     
    9293  private: 
    9394    uint GetChanID(uint atsc_major, uint atsc_minor); 
    9495    uint GetChanID(uint serviceid, uint networkid, uint transportid); 
     96        uint GetMappedChanID(uint serviceid); 
    9597 
    9698    void CompleteEvent(uint atsc_major, uint atsc_minor, 
    9799                       const ATSCEvent &event, 
     
    100102        //QListList_Events  eitList;      ///< Event Information Tables List 
    101103    mutable QMutex    eitList_lock; ///< EIT List lock 
    102104    mutable ServiceToChanID srv_to_chanid; 
     105    mutable ServiceIDToMappedChanID serviceid_to_mapped_chanid; 
    103106 
    104107    EITFixUp               *eitfixup; 
    105108    static EITCache        *eitcache;