Ticket #8501: channelutil.cpp.diff
File channelutil.cpp.diff, 4.4 KB (added by , 14 years ago) |
---|
-
channelutil.cpp
28 28 uint transport_id, 29 29 // tsid exists with other sistandards, 30 30 // but we only trust it in dvb-land. 31 uint network_id) 31 uint network_id, 32 // must check polarity for dvb-s 33 signed char polarity) 32 34 { 35 VERBOSE(VB_CHANSCAN, QString( 36 "get_dtv_multiplex(db_source_id: %1, sistandard: '%2', " 37 "frequency: %3, transport_id: %4, network_id: %5, polarity: %6)") 38 .arg(db_source_id).arg(sistandard) 39 .arg(frequency).arg(transport_id) 40 .arg(network_id).arg(polarity)); 41 33 42 QString qstr = 34 43 "SELECT mplexid " 35 44 "FROM dtv_multiplex " … … 44 53 qstr += "AND networkid = :NETWORKID "; 45 54 } 46 55 56 // REMOVE THIS COMMENT: When using my Twinhan AD-SP400 (DVB-S2) using the alpha 57 // mantis driver with channels.conf scanning, it scans as "not dvb" mode even 58 // though it's a DVB card (i.e. sistandard is a blank string) so I've made 59 // it always check polarity if it's >0 60 // 61 // I'm not sure why an unsigned char is used for polarity, but I thought I'd 62 // better add checks if it's ever <0 - remove/modify if it's never <0! 63 if (polarity>0) 64 qstr += "AND polarity = :POLARITY "; 65 47 66 MSqlQuery query(MSqlQuery::InitCon()); 48 67 query.prepare(qstr); 49 68 … … 51 70 query.bindValue(":SISTANDARD", sistandard); 52 71 53 72 if (sistandard.toLower() != "dvb") 54 query.bindValue(":FREQUENCY", QString::number(frequency));73 query.bindValue(":FREQUENCY", QString::number(frequency)); 55 74 else 56 75 { 57 query.bindValue(":TRANSPORTID", 58 query.bindValue(":NETWORKID", 76 query.bindValue(":TRANSPORTID", transport_id); 77 query.bindValue(":NETWORKID", network_id); 59 78 } 60 79 80 // REMOVE THIS COMMENT: polarity needs to be converted to a string as passing 81 // a signed char will mean the integer is passed to the SQL query :-) 82 if (polarity>0) 83 query.bindValue(":POLARITY", QString(polarity)); 84 61 85 if (!query.exec() || !query.isActive()) 62 86 { 63 87 MythDB::DBError("get_dtv_multiplex", query); … … 89 113 uint mplex = get_dtv_multiplex( 90 114 db_source_id, sistandard, frequency, 91 115 // DVB specific 92 transport_id, network_id );116 transport_id, network_id, polarity); 93 117 94 118 VERBOSE(VB_CHANSCAN, QString( 95 "insert_dtv_multiplex(%1, '%2', %3, %4, %5, %6...) mplexid:%7") 119 "insert_dtv_multiplex(db_source_id: %1, sistandard: '%2', " 120 "frequency: %3, modulation: %4, transport_id: %5, " 121 "network_id: %6, polarity: %7...) mplexid:%8") 96 122 .arg(db_source_id).arg(sistandard) 97 123 .arg(frequency).arg(modulation) 98 124 .arg(transport_id).arg(network_id) 99 .arg( mplex));125 .arg(polarity).arg(mplex)); 100 126 101 127 bool isDVB = (sistandard.toLower() == "dvb"); 102 128 … … 141 167 "WHERE sourceid = :SOURCEID AND " 142 168 " sistandard = :SISTANDARD AND "; 143 169 170 // After inserting the channels, it UPDATEs ALL the items and replaces 171 // the polarity of both v and h DVB-S transponders with the new value 172 // without this line! 173 // HACK: I used :WHEREPOLARITY to prevent :POLARITY overtaking :POLARITY2 174 if (polarity > 0) 175 updateStr += " polarity = :WHEREPOLARITY AND "; 176 144 177 updateStr += (isDVB) ? 145 178 " transportid = :TRANSPORTID AND networkid = :NETWORKID " : 146 179 " frequency = :FREQUENCY2 "; … … 211 244 if (transport_id) 212 245 query.bindValue(":TRANSPORTID", transport_id); 213 246 } 247 248 if (polarity > 0) 249 query.bindValue(":WHEREPOLARITY", QString("%1").arg((char)polarity)); 214 250 } 215 251 else 216 252 { … … 263 299 mplex = get_dtv_multiplex( 264 300 db_source_id, sistandard, frequency, 265 301 // DVB specific 266 transport_id, network_id );302 transport_id, network_id, polarity); 267 303 268 304 VERBOSE(VB_CHANSCAN, QString("insert_dtv_multiplex -- ") + 269 305 QString("inserted %1").arg(mplex));