Ticket #981: 981-v1.patch
File 981-v1.patch, 11.5 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/tv_play.cpp
3315 3315 if (!chan.isEmpty() && do_smart) 3316 3316 { 3317 3317 // Look for channel in line-up 3318 bool unique = false; 3319 bool ok = activerecorder->CheckChannelPrefix(chan, unique); 3318 QString mod = chan; 3319 bool unique = false, other_rec = false; 3320 bool ok = activerecorder->CheckChannelPrefix(chan, unique, other_rec); 3320 3321 3321 // If pure channel not in line-up, try adding a spacer 3322 QString mod = chan; 3323 for (uint i=0; (spacers[i] != NULL) && !ok; ++i) 3322 VERBOSE(VB_IMPORTANT, "channum("<<chan<<") unique("<<unique 3323 <<") other_rec("<<other_rec<<")"); 3324 3325 // If channel not in line-up on this card, try adding a spacer 3326 bool xok = false; 3327 for (uint i=0; (spacers[i] != NULL) && !xok && !other_rec; ++i) 3324 3328 { 3325 3329 mod = chan.left(chan.length()-1) + spacers[i] + chan.right(1); 3326 ok = activerecorder->CheckChannelPrefix(mod, unique);3330 xok = activerecorder->CheckChannelPrefix(mod, unique, other_rec); 3327 3331 } 3328 3332 3333 // If channel with spacer not in line-up on this card, 3334 // try other recorders 3335 mod = chan; 3336 for (uint i=0; (spacers[i] != NULL) && !xok; ++i) 3337 { 3338 mod = chan.left(chan.length()-1) + spacers[i] + chan.right(1); 3339 xok = activerecorder->CheckChannelPrefix(mod, unique, other_rec); 3340 } 3341 if (!xok) 3342 mod = chan; 3343 3344 VERBOSE(VB_IMPORTANT, "ChanNum("<<chan<<") Unique("<<unique 3345 <<") Other_Rec("<<other_rec<<")"); 3346 3329 3347 // Use valid channel if it is there, otherwise reset... 3330 3348 queuedChanNum = (ok) ? mod : chan.right(1); 3331 3349 do_smart &= unique; … … 3391 3409 if (activenvp == nvp && GetOSD()) 3392 3410 GetOSD()->HideSet("channel_number"); 3393 3411 } 3394 else if (GetQueuedChanID() || 3395 (!channum.isEmpty() && activerecorder->CheckChannel(channum))) 3412 else if (GetQueuedChanID() || !channum.isEmpty()) 3396 3413 ChangeChannel(GetQueuedChanID(), channum); 3397 else if (!GetQueuedInput().isEmpty())3398 ChangeChannel(GetQueuedChanID(), GetQueuedInput());3399 3414 } 3400 3415 3401 3416 ClearInputQueues(true); … … 3406 3421 VERBOSE(VB_PLAYBACK, LOC + QString("ChangeChannel(%1, '%2') ") 3407 3422 .arg(chanid).arg(channum)); 3408 3423 3424 if (!chanid && channum.isEmpty()) 3425 return; 3426 3409 3427 QStringList reclist; 3410 3428 bool muted = false; 3411 3429 3412 3430 if (activerecorder) 3413 3431 { 3414 bool getit = false, unique = false ;3432 bool getit = false, unique = false, other_rec = false; 3415 3433 if (chanid) 3416 3434 getit = activerecorder->ShouldSwitchToAnotherCard( 3417 3435 QString::number(chanid)); 3418 3436 else 3419 getit = !activerecorder->CheckChannelPrefix(channum, unique); 3437 getit = !activerecorder->CheckChannelPrefix( 3438 channum, unique, other_rec); 3420 3439 3421 if (getit )3440 if (getit || (unique && other_rec)) 3422 3441 reclist = GetValidRecorderList(chanid, channum); 3423 3442 } 3424 3443 -
libs/libmythtv/remoteencoder.h
50 50 int SetSignalMonitoringRate(int msec, bool notifyFrontend = true); 51 51 bool CheckChannel(QString channel); 52 52 bool ShouldSwitchToAnotherCard(QString channelid); 53 bool CheckChannelPrefix(QString channel, bool &unique );53 bool CheckChannelPrefix(QString channel, bool &unique, bool &other_rec); 54 54 void GetNextProgram(int direction, 55 55 QString &title, QString &subtitle, QString &desc, 56 56 QString &category, QString &starttime, QString &endtime, -
libs/libmythtv/remoteencoder.cpp
503 503 return retval; 504 504 } 505 505 506 bool RemoteEncoder::CheckChannelPrefix(QString channel, bool &unique) 506 bool RemoteEncoder::CheckChannelPrefix( 507 QString channel, bool &unique, bool &other_rec) 507 508 { 508 509 QStringList strlist = QString("QUERY_RECORDER %1").arg(recordernum); 509 510 strlist << "CHECK_CHANNEL_PREFIX"; … … 512 513 SendReceiveStringList(strlist); 513 514 514 515 bool retval = strlist[0].toInt(); 515 unique = strlist[1].toInt(); 516 unique = strlist[1].toInt(); 517 other_rec = strlist[2].toInt(); 516 518 517 519 return retval; 518 520 } -
libs/libmythtv/tv_rec.cpp
1973 1973 return ret; 1974 1974 } 1975 1975 1976 /** \fn TVRec::CheckChannelPrefix(QString name, bool &unique)1976 /** \fn TVRec::CheckChannelPrefix(QString, bool&, bool&) 1977 1977 * \brief Returns true if the numbers in prefix_num match the first digits 1978 1978 * of any channel, if it unquely identifies a channel the unique 1979 1979 * parameter is set. … … 1989 1989 * \param prefix_num Channel number prefix to check 1990 1990 * \param unique This is set to true if prefix uniquely identifies 1991 1991 * channel, false otherwise. 1992 * \param other_rec This channel is on another recorder 1992 1993 * \return true if the prefix matches any channels. 1993 1994 * 1994 1995 */ 1995 bool TVRec::CheckChannelPrefix(QString name, bool &unique )1996 bool TVRec::CheckChannelPrefix(QString name, bool &unique, bool &other_rec) 1996 1997 { 1997 1998 if (!channel) 1998 1999 return false; 1999 2000 2000 2001 bool ret = false; 2001 2002 unique = false; 2003 other_rec = false; 2002 2004 2003 2005 QString channelinput = channel->GetCurrentInput(); 2004 2006 … … 2007 2009 if (!query.isConnected()) 2008 2010 return true; 2009 2011 2010 QString querystr= QString(2011 "SELECT channel.chanid "2012 QString basequery = QString( 2013 "SELECT channel.chanid, channel.channum " 2012 2014 "FROM channel, capturecard, cardinput " 2013 2015 "WHERE channel.channum LIKE '%1%%' AND " 2014 2016 " channel.sourceid = cardinput.sourceid AND " 2015 " cardinput.cardid = capturecard.cardid AND " 2016 " capturecard.cardid = '%2' AND " 2017 " capturecard.hostname = '%3'") 2018 .arg(name) 2019 .arg(cardid) 2020 .arg(gContext->GetHostName()); 2017 " cardinput.cardid = capturecard.cardid").arg(name); 2021 2018 2022 query.prepare(querystr);2019 QString cardquery = QString(" AND capturecard.cardid = '%2'").arg(cardid); 2023 2020 2021 // Check for any input on this card.. 2022 VERBOSE(VB_IMPORTANT, "QUERY: "<<basequery + cardquery); 2023 query.prepare(basequery + cardquery); 2024 2024 2025 if (!query.exec() || !query.isActive()) 2025 2026 { 2026 2027 MythContext::DBError("checkchannel", query); 2027 2028 } 2028 else if (query.size() > 0)2029 else if (query.size() && query.next()) 2029 2030 { 2030 if (query.size() == 1) 2031 unique = ((query.size() == 1) && 2032 (query.value(1).toString() == name)); 2033 return true; 2034 } 2035 else 2036 { 2037 // Check any card.. 2038 VERBOSE(VB_IMPORTANT, "QUERY2: "<<basequery); 2039 query.prepare(basequery); 2040 if (!query.exec() || !query.isActive()) 2041 MythContext::DBError("checkchannel -- any rec", query); 2042 else if (query.size() && query.next()) 2031 2043 { 2032 unique = CheckChannel(name); 2044 unique = ((query.size() == 1) && 2045 (query.value(1).toString() == name)); 2046 VERBOSE(VB_IMPORTANT, "val(1): '"<<query.value(1).toString() 2047 <<"' name: '"<<name<<"'"); 2048 other_rec = true; 2049 return true; 2033 2050 } 2034 return true;2035 2051 } 2036 2052 2053 // No idea what this is for -- dtk 1/2006 2037 2054 query.prepare("SELECT NULL FROM channel"); 2038 2055 query.exec(); 2039 2056 2040 2057 if (query.size() == 0) 2041 2058 { 2059 VERBOSE(VB_IMPORTANT, "null query returned nothing"); 2042 2060 unique = true; 2043 2061 ret = true; 2044 2062 } -
libs/libmythtv/tv_rec.h
200 200 int ChangeHue(bool direction); 201 201 bool CheckChannel(QString name); 202 202 bool ShouldSwitchToAnotherCard(QString chanid); 203 bool CheckChannelPrefix(QString name, bool &unique );203 bool CheckChannelPrefix(QString name, bool &unique, bool &other_rec); 204 204 void GetNextProgram(int direction, 205 205 QString &title, QString &subtitle, 206 206 QString &desc, QString &category, -
programs/mythbackend/encoderlink.h
85 85 int ChangeHue(bool direction); 86 86 bool CheckChannel(const QString &name); 87 87 bool ShouldSwitchToAnotherCard(const QString &channelid); 88 bool CheckChannelPrefix(const QString &name, bool &unique );88 bool CheckChannelPrefix(const QString &name, bool &unique, bool &other); 89 89 void GetNextProgram(int direction, 90 90 QString &title, QString &subtitle, QString &desc, 91 91 QString &category, QString &starttime, -
programs/mythbackend/mainserver.cpp
2535 2535 } 2536 2536 else if (command == "CHECK_CHANNEL_PREFIX") 2537 2537 { 2538 bool unique ;2538 bool unique, other_rec; 2539 2539 QString name = slist[2]; 2540 retlist << QString::number((int)(enc->CheckChannelPrefix(name,2541 unique)));2540 bool match = enc->CheckChannelPrefix(name, unique, other_rec); 2541 retlist << QString::number((int)match); 2542 2542 retlist << QString::number((int)unique); 2543 retlist << QString::number((int)other_rec); 2543 2544 } 2544 2545 else if (command == "GET_NEXT_PROGRAM_INFO") 2545 2546 { -
programs/mythbackend/encoderlink.cpp
814 814 return false; 815 815 } 816 816 817 /** \fn EncoderLink::CheckChannelPrefix(const QString&,bool& )817 /** \fn EncoderLink::CheckChannelPrefix(const QString&,bool&,bool&) 818 818 * \brief Returns true if the numbers in prefix_num match the first digits 819 819 * of any channel, if it unquely identifies a channel the unique 820 820 * parameter is set. … … 823 823 * \param prefix_num Channel number prefix to check 824 824 * \param unique This is set to true if prefix uniquely identifies 825 825 * channel, false otherwise. 826 * \param other_rec This channel is on another recorder 826 827 * \return true if the prefix matches any channels. 827 828 */ 828 bool EncoderLink::CheckChannelPrefix(const QString &prefix_num, bool &unique) 829 bool EncoderLink::CheckChannelPrefix(const QString &prefix_num, 830 bool &unique, bool &other_rec) 829 831 { 830 832 if (local) 831 return tv->CheckChannelPrefix(prefix_num, unique );833 return tv->CheckChannelPrefix(prefix_num, unique, other_rec); 832 834 833 835 VERBOSE(VB_IMPORTANT, "Should be local only query: CheckChannelPrefix"); 834 836 unique = false;