45 extern QMap<int, EncoderLink *>
tvList;
57 QString(), QString(), QString() );
63 const QString &sTitleRegEx,
64 const QString &sRecGroup,
65 const QString &sStorageGroup )
67 QMap< QString, ProgramInfo* > recMap;
83 QMap< QString, ProgramInfo* >::iterator mit = recMap.begin();
85 for (; mit != recMap.end(); mit = recMap.erase(mit))
95 if ((sTitleRegEx.isEmpty()) &&
96 (sRecGroup.isEmpty()) &&
97 (sStorageGroup.isEmpty()))
99 nStartIndex = min( nStartIndex, (
int)progList.
size() );
100 nCount = (nCount > 0) ? min( nCount, (
int)progList.
size() ) : progList.
size();
101 int nEndIndex = min((nStartIndex + nCount), (
int)progList.
size() );
102 nCount = nEndIndex - nStartIndex;
104 nAvailable = progList.
size();
106 for(
int n = nStartIndex;
n < nEndIndex;
n++)
124 QRegExp rTitleRegEx = QRegExp(sTitleRegEx, Qt::CaseInsensitive);
126 for(
unsigned int n = 0;
n < progList.
size();
n++)
130 if ((!sTitleRegEx.isEmpty() && !pInfo->
GetTitle().contains(rTitleRegEx)) ||
132 (!sStorageGroup.isEmpty() && sStorageGroup != pInfo->
GetStorageGroup()))
137 if ((nAvailable < nStartIndex) ||
151 pPrograms->setStartIndex ( nStartIndex );
152 pPrograms->setCount ( nCount );
153 pPrograms->setTotalAvailable( nAvailable );
155 pPrograms->setVersion ( MYTH_BINARY_VERSION );
156 pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
167 if (chanid <= 0 || !recstarttsRaw.isValid())
168 throw QString(
"Channel ID or StartTime appears invalid.");
184 if (chanid <= 0 || !recstarttsRaw.isValid())
185 throw QString(
"Channel ID or StartTime appears invalid.");
189 if (pi.GetChanID() && pi.HasPathname())
191 QString cmd = QString(
"DELETE_RECORDING %1 %2")
221 nStartIndex = min( nStartIndex, (
int)infoList.size() );
222 nCount = (nCount > 0) ? min( nCount, (
int)infoList.size() ) : infoList.size();
223 int nEndIndex = min((nStartIndex + nCount), (
int)infoList.size() );
225 for(
int n = nStartIndex;
n < nEndIndex;
n++)
241 pPrograms->setStartIndex ( nStartIndex );
242 pPrograms->setCount ( nCount );
243 pPrograms->setTotalAvailable( infoList.size() );
245 pPrograms->setVersion ( MYTH_BINARY_VERSION );
246 pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
259 QMap<int, EncoderLink *>::Iterator iter =
tvList.begin();
261 for (; iter !=
tvList.end(); ++iter)
270 pEncoder->setState ( elink->
GetState() );
271 pEncoder->setLocal ( elink->
IsLocal() );
276 if (pEncoder->
Local())
281 switch ( pEncoder->
State() )
317 QString querystr = QString(
"SELECT DISTINCT recgroup FROM record");
329 result << query.
value(0).toString();
331 querystr = QString(
"SELECT DISTINCT recgroup FROM recorded");
343 QString value = query.
value(0).toString();
345 if (!result.contains(value))
362 QString querystr = QString(
"SELECT DISTINCT title FROM recorded");
374 result << query.
value(0).toString();
396 for(; it < tmpList.
end(); ++it)
398 if (!bShowAll && ((*it)->GetRecordingStatus() <=
rsWillRecord) &&
416 nStartIndex = min( nStartIndex, (
int)recordingList.
size() );
417 nCount = (nCount > 0) ? min( nCount, (
int)recordingList.
size() ) : recordingList.
size();
418 int nEndIndex = min((nStartIndex + nCount), (
int)recordingList.
size() );
420 for(
int n = nStartIndex;
n < nEndIndex;
n++)
431 pPrograms->setStartIndex ( nStartIndex );
432 pPrograms->setCount ( nCount );
433 pPrograms->setTotalAvailable( recordingList.
size() );
435 pPrograms->setVersion ( MYTH_BINARY_VERSION );
436 pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
455 for(; it < tmpList.
end(); ++it)
457 if (((*it)->GetRecordingStatus() ==
rsConflict) &&
470 nStartIndex = min( nStartIndex, (
int)recordingList.
size() );
471 nCount = (nCount > 0) ? min( nCount, (
int)recordingList.
size() ) : recordingList.
size();
472 int nEndIndex = min((nStartIndex + nCount), (
int)recordingList.
size() );
474 for(
int n = nStartIndex;
n < nEndIndex;
n++)
485 pPrograms->setStartIndex ( nStartIndex );
486 pPrograms->setCount ( nCount );
487 pPrograms->setTotalAvailable( recordingList.
size() );
489 pPrograms->setVersion ( MYTH_BINARY_VERSION );
490 pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
498 QString sDescription,
500 QDateTime recstarttsRaw,
501 QDateTime recendtsRaw,
516 uint nPreferredInput,
524 QString sStorageGroup,
531 bool bAutoMetaLookup,
538 QDateTime recstartts = recstarttsRaw.toUTC();
539 QDateTime recendts = recendtsRaw.toUTC();
546 if (sSearchType.isEmpty())
547 sSearchType =
"none";
549 if (sDupMethod.isEmpty())
550 sDupMethod =
"subtitleanddescription";
552 if (sDupIn.isEmpty())
564 if (sRecProfile.isEmpty())
565 sRecProfile =
"Default";
567 if (sRecGroup.isEmpty())
568 sRecGroup =
"Default";
570 if (sStorageGroup.isEmpty())
571 sStorageGroup =
"Default";
573 if (sPlayGroup.isEmpty())
574 sPlayGroup =
"Default";
632 QString sDescription,
634 QDateTime dStartTimeRaw,
635 QDateTime dEndTimeRaw,
649 uint nPreferredInput,
657 QString sStorageGroup,
664 bool bAutoMetaLookup,
672 throw QString(
"Record ID is invalid.");
679 throw QString(
"Record ID does not exist.");
681 QDateTime recstartts = dStartTimeRaw.toUTC();
682 QDateTime recendts = dEndTimeRaw.toUTC();
688 if (sSearchType.isEmpty())
689 sSearchType =
"none";
691 if (sDupMethod.isEmpty())
692 sDupMethod =
"subtitleanddescription";
694 if (sDupIn.isEmpty())
702 if (sRecProfile.isEmpty())
703 sRecProfile =
"Default";
705 if (sRecGroup.isEmpty())
706 sRecGroup =
"Default";
708 if (sStorageGroup.isEmpty())
709 sStorageGroup =
"Default";
711 if (sPlayGroup.isEmpty())
712 sPlayGroup =
"Default";
714 if (!sTitle.isEmpty())
717 if (!sSubtitle.isEmpty())
720 if(!sDescription.isEmpty())
723 if (!sCategory.isEmpty())
726 if (!sSeriesId.isEmpty())
729 if (!sProgramId.isEmpty())
732 if (!sStation.isEmpty())
787 bool bResult =
false;
790 throw QString(
"Record ID does not exist.");
812 nStartIndex = min( nStartIndex, (
int)recList.size() );
813 nCount = (nCount > 0) ? min( nCount, (
int)recList.size() ) : recList.size();
814 int nEndIndex = min((nStartIndex + nCount), (
int)recList.size() );
816 for(
int n = nStartIndex;
n < nEndIndex;
n++)
830 pRecRules->setStartIndex ( nStartIndex );
831 pRecRules->setCount ( nCount );
832 pRecRules->setTotalAvailable( recList.size() );
834 pRecRules->setVersion ( MYTH_BINARY_VERSION );
835 pRecRules->setProtoVer ( MYTH_PROTO_VERSION );
837 while (!recList.empty())
839 delete recList.back();
849 QDateTime dStartTimeRaw,
853 throw QString(
"Record ID is invalid.");
861 throw QString(
"Record ID does not exist.");
863 else if (!sTemplate.isEmpty())
866 throw QString(
"Template does not exist.");
868 else if (nChanId > 0 && dStartTimeRaw.isValid())
871 RecordingInfo info(nChanId, dStartTimeRaw,
false, 0, &status);
873 throw QString(
"Program does not exist.");
882 throw QString(
"Invalid request.");
893 bool bResult =
false;
896 throw QString(
"Record ID appears invalid.");
914 bool bResult =
false;
917 throw QString(
"Record ID appears invalid.");