[mythtv-users] "watch recordings" menu -- 900 program limit?,
and slow to generate
David Engel
dlengel at attbi.com
Sat Nov 22 17:10:12 EST 2003
On Fri, Nov 21, 2003 at 03:51:41PM -0800, Eric Wemhoff wrote:
> As for the menu generation speed, it looks a tad faster with your
> patch. Running 0.12, It went from 9.5 to 9.0 seconds (I've got the
> stopwatch out now, that's plus or minus about .05 seconds). Call it
> a 5 percent improvement.
Here's another, more radical, patch against current CVS. It reduces
most processing delays, except for database queries and network
transfers, about as low as possible without doing a major redesign to
show partial results incrementally.
David
--
David Engel
dlengel at attbi.com
-------------- next part --------------
Index: programs/mythfrontend/playbackbox.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.cpp,v
retrieving revision 1.101
diff -u -r1.101 playbackbox.cpp
--- programs/mythfrontend/playbackbox.cpp 18 Nov 2003 04:14:50 -0000 1.101
+++ programs/mythfrontend/playbackbox.cpp 22 Nov 2003 21:57:07 -0000
@@ -134,6 +134,12 @@
delete curitem;
if (titleData)
delete [] titleData;
+ while (!showDateData.empty())
+ {
+ ProgramInfo *p = showDateData.back();
+ delete p;
+ showDateData.pop_back();
+ }
}
void PlaybackBox::LoadWindow(QDomElement &element)
@@ -544,7 +550,6 @@
int cnt = 0;
int h = 0;
- int pastSkip = (int)skipNum;
pageDowner = false;
QString tempTitle;
@@ -564,22 +569,13 @@
container = theme->GetSet("selector");
- typedef QMap<QString, ProgramInfo> ShowData;
+ vector<ProgramInfo*> *curList;
ProgramInfo *tempInfo;
- ShowData::Iterator it;
- ShowData::Iterator start;
- ShowData::Iterator end;
if (titleData && titleData[curTitle] != tr("All Programs"))
- {
- start = showData.begin();
- end = showData.end();
- }
+ curList = &showData[titleData[curTitle].lower()];
else
- {
- start = showDateData.begin();
- end = showDateData.end();
- }
+ curList = &showDateData;
int overrectime = gContext->GetNumSetting("RecordOverTime", 0);
int underrectime = gContext->GetNumSetting("RecordPreRoll", 0);
@@ -640,18 +636,13 @@
ltype->ResetList();
ltype->SetActive(!inTitle);
- titleitems = 0;
- for (it = start; it != end; ++it)
+ titleitems = (int)curList->size();
+ for (cnt = 0; cnt < listsize; cnt++)
{
- if (cnt < listsize)
- {
- match = (it.key()).left((it.key()).find("-!-"));
- if (match == (titleData[curTitle]).lower()
- || titleData[curTitle] == tr("All Programs"))
- {
- if (pastSkip <= 0)
- {
- tempInfo = &(it.data());
+ if (cnt + skipNum >= titleitems)
+ break;
+
+ tempInfo = curList->at(cnt + skipNum);
tempCurrent = RemoteGetRecordingStatus(tempInfo,
overrectime,
@@ -694,38 +685,13 @@
else if (tempCurrent > 1)
ltype->EnableForcedFont(cnt, "recording"); // FIXME: change to overunderrecording, fall back to recording.
- cnt++;
- }
- pastSkip--;
- titleitems++;
- pageDowner = false;
-
- } // match else
- //else
- // pageDowner = true;
- } // cnt < listsiz else
- else
- {
- match = (it.key()).left( (it.key()).find("-!-") );
- if (match == (titleData[curTitle]).lower() ||
- titleData[curTitle] == tr("All Programs"))
- {
- titleitems++;
- pageDowner = true;
- }
- }
- // end of cnt < listsize if
}
- // for (iterator)
}
// end of type check
+ pageDowner = (skipNum + listsize < titleitems);
+ ltype->SetUpArrow(skipNum > 0);
ltype->SetDownArrow(pageDowner);
- if (skipNum > 0)
- ltype->SetUpArrow(true);
- else
- ltype->SetUpArrow(false);
-
}
// end of container check
@@ -959,18 +925,17 @@
typedef QMap<QString,QString> ShowData;
int order = 1;
order = gContext->GetNumSetting("PlayBoxOrdering", 1);
- int cnt = 999;
- if (order == 0 && type != Delete)
- cnt = 100;
noUpdate = true;
- showData.clear();
- showDateData.clear();
- if (showList.count() > 0)
+ while (!showDateData.empty())
{
- showList.clear();
+ ProgramInfo *p = showDateData.back();
+ delete p;
+ showDateData.pop_back();
}
+ showData.clear();
+ showList.clear();
if (titleData)
delete [] titleData;
@@ -979,24 +944,19 @@
showList[""] = tr("All Programs");
vector<ProgramInfo *> *infoList;
- infoList = RemoteGetRecordedList(type == Delete);
+ infoList = RemoteGetRecordedList(type == Play && order == 1);
+
if (infoList)
{
QString temp;
- vector<ProgramInfo *>::iterator i = infoList->begin();
- for (; i != infoList->end(); i++)
+ showDateData = *infoList;
+
+ vector<ProgramInfo *>::iterator i = showDateData.begin();
+ for (; i != showDateData.end(); i++)
{
showList[((*i)->title).lower()] = (*i)->title;
- temp = QString("%1-!-%2").arg(((*i)->title).lower()).arg(cnt);
- showData[temp] = *(*i);
- temp = QString("%1").arg(cnt);
- showDateData[temp] = *(*i);
- if (order == 0 && type != Delete)
- cnt++;
- else
- cnt--;
- delete (*i);
+ showData[((*i)->title).lower()].push_back(*i);
}
delete infoList;
}
@@ -1015,7 +975,7 @@
else
titleData = new QString[showList.count() + 1];
- cnt = 0;
+ int cnt = 0;
ShowData::Iterator it;
for (it = showList.begin(); it != showList.end(); ++it)
Index: programs/mythfrontend/playbackbox.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.h,v
retrieving revision 1.33
diff -u -r1.33 playbackbox.h
--- programs/mythfrontend/playbackbox.h 15 Nov 2003 00:56:03 -0000 1.33
+++ programs/mythfrontend/playbackbox.h 22 Nov 2003 21:57:07 -0000
@@ -108,8 +108,8 @@
int curShowing;
QString *titleData;
QMap<QString, QString> showList;
- QMap<QString, ProgramInfo> showData;
- QMap<QString, ProgramInfo> showDateData;
+ QMap<QString, vector<ProgramInfo*> > showData;
+ vector<ProgramInfo*> showDateData;
BoxType type;
More information about the mythtv-users
mailing list