[mythtv] [PATCH] Movie filter in progfinder
Joel Feenstra
joelf at altelco.net
Fri Apr 11 20:05:57 EDT 2003
Ok, I've got a new patch that should make it easy for someone to put any
filter they want into the sql statments. I've put 3 in there to start. I
have no idea how to indicate on the screen which one is being used, and
I don't know how to make them configurable. But someone should be able
to use this as a good start. They can focus on the user end of things. I
also made this patch work by pressing '6' which is probably better for
those with remotes (Not me. I'm in a small dorm with no need for a
remote. Plus I haven't messed with it enough to get it to work.)
Joel Feenstra
Joel Feenstra wrote:
> It wouldn't be too hard. I just don't have a clue about how to present
> the options to the user. If you want to make it a no movie filter, the
> sql statements just need to be modified. I'd support making it be "6"
> which is consistent with how you filter out unwanted channels in the
> epg. I don't know anything about how the user interface code works, so
> I'll leave that up to someone who does. I can do ifs elses and whiles
> but much beyond that and I get lost. I suppose a string could be build
> dynamically which would determine exactly what is filtered, and a button
> could cycle throught those.
>
> Possible filter modes:
> All
> Movies only
> Shows only
>
> Ben Bucksch wrote:
>
>> Joel Feenstra wrote:
>>
>>> Does anybody else want it switched?
>>
>>
>>
>> Doesn't "m" mean "Menu"? For users of a remote control, the meaning
>> matters, and also for consistency. (I think that consistency and
>> simplicity (not overloading buttons) is extremely important for a
>> project like this, which has the potential to be used by grandma.)
>>
>> Personally, I sometimes wanted exactly *not* see movies, only series,
>> so it could be generalized to some filter selection.
-------------- next part --------------
? filterpatch.diff
? moviefilter.diff
Index: settings.pro
===================================================================
RCS file: /var/lib/cvs/MC/settings.pro,v
retrieving revision 1.18
diff -u -w -r1.18 settings.pro
--- settings.pro 5 Apr 2003 21:23:10 -0000 1.18
+++ settings.pro 11 Apr 2003 22:59:10 -0000
@@ -1,5 +1,5 @@
-#CONFIG += debug
-CONFIG += release
+CONFIG += debug
+#CONFIG += release
PREFIX = /usr/local
Index: libs/libmythtv/progfind.cpp
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmythtv/progfind.cpp,v
retrieving revision 1.21
diff -u -w -r1.21 progfind.cpp
--- libs/libmythtv/progfind.cpp 8 Apr 2003 17:45:51 -0000 1.21
+++ libs/libmythtv/progfind.cpp 11 Apr 2003 22:59:13 -0000
@@ -76,6 +76,7 @@
accel->connectItem(accel->insertItem(Key_9), this, SLOT(pageDown()));
accel->connectItem(accel->insertItem(Key_I), this, SLOT(getInfo()));
accel->connectItem(accel->insertItem(Key_4), this, SLOT(showGuide()));
+ accel->connectItem(accel->insertItem(Key_6), this, SLOT(filterSwitch()));
accel->connectItem(accel->insertItem(Key_Escape), this, SLOT(escape()));
connect(this, SIGNAL(killTheApp()), this, SLOT(accept()));
@@ -114,6 +115,10 @@
searchCount = 36;
recordingCount = 0;
+ curFilter = 0;
+ maxFilter = 0;
+ setFilters();
+
initData = new QString[(int)(searchCount*showsPerListing)];
gotInitData = new int[searchCount];
searchData = new QString[searchCount];
@@ -162,6 +167,8 @@
delete [] gotInitData;
+ delete [] filters;
+
delete update_Timer;
delete accel;
@@ -538,6 +545,64 @@
}
+void ProgFinder::filterSwitch()
+{
+ curFilter++;
+
+ if (curFilter > maxFilter)
+ curFilter = 0;
+
+ while (inSearch > 0)
+ {
+ if (inSearch == 1)
+ showSearchList();
+ else if (inSearch == 2)
+ {
+ showProgramList();
+ clearShowData();
+ }
+ inSearch--;
+ }
+
+ delete [] searchData;
+ delete [] initData;
+ delete [] gotInitData;
+
+
+ curSearch = 10;
+ progData = new QString[1];
+ listCount = 1;
+ if (showsPerListing < 1)
+ showsPerListing = 7;
+ if (showsPerListing % 2 == 0)
+ showsPerListing = showsPerListing + 1;
+
+ inSearch = 0;
+ pastInitial = false;
+ searchCount = 36;
+ recordingCount = 0;
+
+ initData = new QString[(int)(searchCount*showsPerListing)];
+ gotInitData = new int[searchCount];
+ searchData = new QString[searchCount];
+ int curLabel = 0;
+
+ for (int charNum = 48; charNum < 91; charNum++)
+ {
+ if (charNum == 58)
+ charNum = 65;
+
+ gotInitData[curLabel] = 0;
+ searchData[curLabel] = (char)charNum;
+
+ curLabel++;
+ }
+
+ getSearchData(10);
+ getInitialProgramData();
+}
+
+
void ProgFinder::cursorLeft()
{
inSearch--;
@@ -951,13 +1016,15 @@
thequery = QString("SELECT DISTINCT title "
"FROM program "
- "WHERE title LIKE '%1%' OR title LIKE 'The %2%' OR title LIKE 'A %3%' "
- "AND starttime > %4 "
+ "WHERE (title LIKE '%1%' OR title LIKE 'The %2%' OR title LIKE 'A %3%') "
+ "AND starttime > %4 %5 "
"ORDER BY title;")
.arg(searchData[curSearch])
.arg(searchData[curSearch])
.arg(searchData[curSearch])
- .arg(progStart.toString("yyyyMMddhhmm50"));
+ .arg(progStart.toString("yyyyMMddhhmm50"))
+ .arg(filters[curFilter]);
+
QSqlQuery query = m_db->exec(thequery);
@@ -1377,13 +1444,15 @@
thequery = QString("SELECT DISTINCT title "
"FROM program "
- "WHERE title LIKE '%1%' OR title LIKE 'The %2%' OR title LIKE 'A %3%' "
- "AND starttime > %4 "
+ "WHERE (title LIKE '%1%' OR title LIKE 'The %2%' OR title LIKE 'A %3%') "
+ "AND starttime > %4 %5 "
"ORDER BY title;")
.arg(searchData[charNum])
.arg(searchData[charNum])
.arg(searchData[charNum])
- .arg(progStart.toString("yyyyMMddhhmm50"));
+ .arg(progStart.toString("yyyyMMddhhmm50"))
+ .arg(filters[curFilter]);
+
QSqlQuery query = m_db->exec(thequery);
@@ -1505,6 +1574,16 @@
}
+void ProgFinder::setFilters()
+{
+ /* This function is begging to for allow user customization */
+ maxFilter = 2;
+ filters = new QString[maxFilter + 1];
+
+ filters[0] = "";
+ filters[1] = "AND stars > 0 AND endtime - starttime >= 13000";
+ filters[2] = "AND stars <= 0";
+}
QRect ProgFinder::listRect() const
{
Index: libs/libmythtv/progfind.h
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmythtv/progfind.h,v
retrieving revision 1.7
diff -u -w -r1.7 progfind.h
--- libs/libmythtv/progfind.h 8 Apr 2003 17:45:52 -0000 1.7
+++ libs/libmythtv/progfind.h 11 Apr 2003 22:59:13 -0000
@@ -79,6 +79,7 @@
void showGuide();
void pageUp();
void pageDown();
+ void filterSwitch();
protected:
void paintEvent(QPaintEvent *);
@@ -106,6 +107,8 @@
bool showInfo;
bool pastInitial;
bool running;
+ int curFilter;
+ int maxFilter;
int *gotInitData;
QTimer *update_Timer;
@@ -120,6 +123,7 @@
QString baseDir;
QString curDateTime;
QString curChannel;
+ QString *filters;
QString *searchData;
QString *initData;
QString *progData;
@@ -146,6 +150,7 @@
void getRecordingInfo();
void getSearchData(int);
void getInitialProgramData();
+ void setFilters();
QRect infoRect() const;
QRect listRect() const;
More information about the mythtv-dev
mailing list