Skip to content

Commit

Permalink
Fix program finder to not show programs on invisible channels.
Browse files Browse the repository at this point in the history
Backport to fixes/0.24.  Fixes #9381.
  • Loading branch information
gigem committed Dec 29, 2010
1 parent 557f3de commit 2f3a2f8
Showing 1 changed file with 48 additions and 36 deletions.
84 changes: 48 additions & 36 deletions mythtv/programs/mythfrontend/progfind.cpp
Expand Up @@ -567,7 +567,8 @@ void ProgFinder::selectShowData(QString progTitle, int newCurShow)

MSqlBindings bindings;
QString querystr = "WHERE program.title = :TITLE "
" AND program.endtime > :ENDTIME ";
" AND program.endtime > :ENDTIME "
" AND channel.visible = 1 ";
bindings[":TITLE"] = progTitle;
bindings[":ENDTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");

Expand Down Expand Up @@ -602,12 +603,14 @@ void ProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings &bindings

if (searchChar.contains('@'))
{
where = "SELECT DISTINCT title FROM program WHERE ( "
"title NOT REGEXP '^[A-Z0-9]' AND "
"title NOT REGEXP '^The [A-Z0-9]' AND "
"title NOT REGEXP '^A [A-Z0-9]' AND "
"title NOT REGEXP '^An [A-Z0-9]' AND "
"starttime > :STARTTIME ) ";
where = "SELECT DISTINCT title FROM program "
"LEFT JOIN channel ON program.chanid = channel.chanid "
"WHERE channel.visible = 1 AND "
"( title NOT REGEXP '^[A-Z0-9]' AND "
" title NOT REGEXP '^The [A-Z0-9]' AND "
" title NOT REGEXP '^A [A-Z0-9]' AND "
" title NOT REGEXP '^An [A-Z0-9]' AND "
" starttime > :STARTTIME ) ";
if (!m_searchStr.isEmpty())
{
where += "AND title LIKE :SEARCH ";
Expand All @@ -625,11 +628,12 @@ void ProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings &bindings
QString three = QString("A ") + one;
QString four = QString("An ") + one;

where = "SELECT DISTINCT title "
"FROM program "
"WHERE ( title LIKE :ONE OR title LIKE :TWO "
" OR title LIKE :THREE "
" OR title LIKE :FOUR ) "
where = "SELECT DISTINCT title FROM program "
"LEFT JOIN channel ON program.chanid = channel.chanid "
"WHERE channel.visible = 1 "
"AND ( title LIKE :ONE OR title LIKE :TWO "
" OR title LIKE :THREE "
" OR title LIKE :FOUR ) "
"AND starttime > :STARTTIME ";
if (!m_searchStr.isEmpty())
where += "AND title LIKE :SEARCH ";
Expand Down Expand Up @@ -782,44 +786,46 @@ void JaProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings &bindin
QDateTime progStart = QDateTime::currentDateTime();
int charNum = m_alphabetList->GetCurrentPos();

where = "SELECT DISTINCT title FROM program ";
where = "SELECT DISTINCT title FROM program "
"LEFT JOIN channel ON program.chanid = channel.chanid "
"WHERE channel.visible = 1 ";

switch (charNum) {
case 0:
where += "WHERE ( title_pronounce >= 'あ' AND title_pronounce <= 'お') ";
where += "AND ( title_pronounce >= 'あ' AND title_pronounce <= 'お') ";
break;
case 1:
where += "WHERE ( title_pronounce >= 'か' AND title_pronounce <= 'ご') ";
where += "AND ( title_pronounce >= 'か' AND title_pronounce <= 'ご') ";
break;
case 2:
where += "WHERE ( title_pronounce >= 'さ' AND title_pronounce <= 'そ') ";
where += "AND ( title_pronounce >= 'さ' AND title_pronounce <= 'そ') ";
break;
case 3:
where += "WHERE ( title_pronounce >= 'た' AND title_pronounce <= 'ど') ";
where += "AND ( title_pronounce >= 'た' AND title_pronounce <= 'ど') ";
break;
case 4:
where += "WHERE ( title_pronounce >= 'な' AND title_pronounce <= 'の') ";
where += "AND ( title_pronounce >= 'な' AND title_pronounce <= 'の') ";
break;
case 5:
where += "WHERE ( title_pronounce >= 'は' AND title_pronounce <= 'ぽ') ";
where += "AND ( title_pronounce >= 'は' AND title_pronounce <= 'ぽ') ";
break;
case 6:
where += "WHERE ( title_pronounce >= 'ま' AND title_pronounce <= 'も') ";
where += "AND ( title_pronounce >= 'ま' AND title_pronounce <= 'も') ";
break;
case 7:
where += "WHERE ( title_pronounce >= 'や' AND title_pronounce <= 'よ') ";
where += "AND ( title_pronounce >= 'や' AND title_pronounce <= 'よ') ";
break;
case 8:
where += "WHERE ( title_pronounce >= 'ら' AND title_pronounce <= 'ろ') ";
where += "AND ( title_pronounce >= 'ら' AND title_pronounce <= 'ろ') ";
break;
case 9:
where += "WHERE ( title_pronounce >= 'わ' AND title_pronounce <= 'ん') ";
where += "AND ( title_pronounce >= 'わ' AND title_pronounce <= 'ん') ";
break;
case 10:
where += "WHERE ( title_pronounce >= 'A' AND title_pronounce <= 'z') ";
where += "AND ( title_pronounce >= 'A' AND title_pronounce <= 'z') ";
break;
case 11:
where += "WHERE ( title_pronounce >= '0' AND title_pronounce <= '9') ";
where += "AND ( title_pronounce >= '0' AND title_pronounce <= '9') ";
break;
}

Expand Down Expand Up @@ -890,21 +896,23 @@ void HeProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings &bindin
if (searchChar.isEmpty())
searchChar = searchChars[0];

where = "SELECT DISTINCT title FROM program ";
where = "SELECT DISTINCT title FROM program "
"LEFT JOIN channel ON program.chanid = channel.chanid "
"WHERE channel.visible = 1 ";

if (searchChar.contains('E'))
{
where += "WHERE ( title REGEXP '^[A-Z]') ";
where += "AND ( title REGEXP '^[A-Z]') ";
}
else if (searchChar.contains('#'))
{
where += "WHERE ( title REGEXP '^[0-9]') ";
where += "AND ( title REGEXP '^[0-9]') ";
}
else
{
QString one = searchChar + '%';
bindings[":ONE"] = one;
where += "WHERE ( title LIKE :ONE ) ";
where += "AND ( title LIKE :ONE ) ";
}

where += "AND starttime > :STARTTIME ";
Expand Down Expand Up @@ -982,7 +990,10 @@ void RuProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings

if (searchChar.contains('@'))
{
where = "SELECT DISTINCT title FROM program WHERE ( "
where = "SELECT DISTINCT title FROM program "
"LEFT JOIN channel ON program.chanid = channel.chanid "
"WHERE channel.visible = 1 AND "
"( "
"title NOT REGEXP '^[A-Z0-9]' AND "
"title NOT REGEXP '^The [A-Z0-9]' AND "
"title NOT REGEXP '^A [A-Z0-9]' AND "
Expand All @@ -1006,12 +1017,13 @@ void RuProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings
QString four = QString("An ") + one;
QString five = QString("\"") + one;

where = "SELECT DISTINCT title "
"FROM program "
"WHERE ( title LIKE :ONE OR title LIKE :TWO "
" OR title LIKE :THREE "
" OR title LIKE :FOUR "
" OR title LIKE :FIVE )"
where = "SELECT DISTINCT title FROM program "
"LEFT JOIN channel ON program.chanid = channel.chanid "
"WHERE channel.visible = 1 "
"AND ( title LIKE :ONE OR title LIKE :TWO "
" OR title LIKE :THREE "
" OR title LIKE :FOUR "
" OR title LIKE :FIVE )"
"AND starttime > :STARTTIME ";
if (!m_searchStr.isEmpty())
where += "AND title LIKE :SEARCH ";
Expand Down

0 comments on commit 2f3a2f8

Please sign in to comment.