MythTV  0.28pre
dvr.cpp
Go to the documentation of this file.
1 // Program Name: dvr.cpp
3 // Created : Mar. 7, 2011
4 //
5 // Copyright (c) 2011 David Blain <dblain@mythtv.org>
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //
25 
26 #include <QMap>
27 #include <QRegExp>
28 
29 #include "dvr.h"
30 
31 #include "compat.h"
32 #include "mythversion.h"
33 #include "mythcorecontext.h"
34 #include "mythevent.h"
35 #include "scheduler.h"
36 #include "autoexpire.h"
37 #include "jobqueue.h"
38 #include "encoderlink.h"
39 #include "remoteutil.h"
40 #include "mythdate.h"
41 #include "recordinginfo.h"
42 #include "cardutil.h"
43 #include "inputinfo.h"
44 #include "programtypes.h"
45 #include "recordingtypes.h"
46 
47 #include "serviceUtil.h"
48 #include "mythscheduler.h"
49 #include "storagegroup.h"
50 #include "playgroup.h"
51 #include "recordingprofile.h"
52 
53 #include "scheduler.h"
54 
55 extern QMap<int, EncoderLink *> tvList;
56 extern AutoExpire *expirer;
57 
59 //
61 
63  int nStartIndex,
64  int nCount,
65  const QString &sTitleRegEx,
66  const QString &sRecGroup,
67  const QString &sStorageGroup )
68 {
69  QMap< QString, ProgramInfo* > recMap;
70 
72  recMap = gCoreContext->GetScheduler()->GetRecording();
73 
74  QMap< QString, uint32_t > inUseMap = ProgramInfo::QueryInUseMap();
75  QMap< QString, bool > isJobRunning= ProgramInfo::QueryJobsRunning(JOB_COMMFLAG);
76 
77  ProgramList progList;
78 
79  int desc = 1;
80  if (bDescending)
81  desc = -1;
82 
83  LoadFromRecorded( progList, false, inUseMap, isJobRunning, recMap, desc );
84 
85  QMap< QString, ProgramInfo* >::iterator mit = recMap.begin();
86 
87  for (; mit != recMap.end(); mit = recMap.erase(mit))
88  delete *mit;
89 
90  // ----------------------------------------------------------------------
91  // Build Response
92  // ----------------------------------------------------------------------
93 
94  DTC::ProgramList *pPrograms = new DTC::ProgramList();
95  int nAvailable = 0;
96 
97  int nMax = (nCount > 0) ? nCount : progList.size();
98 
99  nAvailable = 0;
100  nCount = 0;
101 
102  QRegExp rTitleRegEx = QRegExp(sTitleRegEx, Qt::CaseInsensitive);
103 
104  for( unsigned int n = 0; n < progList.size(); n++)
105  {
106  ProgramInfo *pInfo = progList[ n ];
107 
108  if (pInfo->IsDeletePending() ||
109  (!sTitleRegEx.isEmpty() && !pInfo->GetTitle().contains(rTitleRegEx)) ||
110  (!sRecGroup.isEmpty() && sRecGroup != pInfo->GetRecordingGroup()) ||
111  (!sStorageGroup.isEmpty() && sStorageGroup != pInfo->GetStorageGroup()))
112  continue;
113 
114  if ((nAvailable < nStartIndex) ||
115  (nCount >= nMax))
116  {
117  ++nAvailable;
118  continue;
119  }
120 
121  ++nAvailable;
122  ++nCount;
123 
124  DTC::Program *pProgram = pPrograms->AddNewProgram();
125 
126  FillProgramInfo( pProgram, pInfo, true );
127  }
128 
129  // ----------------------------------------------------------------------
130 
131  pPrograms->setStartIndex ( nStartIndex );
132  pPrograms->setCount ( nCount );
133  pPrograms->setTotalAvailable( nAvailable );
134  pPrograms->setAsOf ( MythDate::current() );
135  pPrograms->setVersion ( MYTH_BINARY_VERSION );
136  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
137 
138  return pPrograms;
139 }
140 
142 //
144 
146  int chanid, const QDateTime &recstarttsRaw)
147 {
148  if ((RecordedId <= 0) &&
149  (chanid <= 0 || !recstarttsRaw.isValid()))
150  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
151 
152  // TODO Should use RecordingInfo
153  ProgramInfo pi;
154  if (RecordedId > 0)
155  pi = ProgramInfo(RecordedId);
156  else
157  pi = ProgramInfo(chanid, recstarttsRaw.toUTC());
158 
159  DTC::Program *pProgram = new DTC::Program();
160  FillProgramInfo( pProgram, &pi, true );
161 
162  return pProgram;
163 }
164 
166 //
168 
169 bool Dvr::RemoveRecorded(int RecordedId,
170  int chanid, const QDateTime &recstarttsRaw,
171  bool forceDelete, bool allowRerecord)
172 {
173  return DeleteRecording(RecordedId, chanid, recstarttsRaw, forceDelete,
174  allowRerecord);
175 }
176 
177 
178 bool Dvr::DeleteRecording(int RecordedId,
179  int chanid, const QDateTime &recstarttsRaw,
180  bool forceDelete, bool allowRerecord)
181 {
182  if ((RecordedId <= 0) &&
183  (chanid <= 0 || !recstarttsRaw.isValid()))
184  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
185 
186  // TODO Should use RecordingInfo
187  ProgramInfo pi;
188  if (RecordedId > 0)
189  pi = ProgramInfo(RecordedId);
190  else
191  pi = ProgramInfo(chanid, recstarttsRaw.toUTC());
192 
193  if (pi.GetChanID() && pi.HasPathname())
194  {
195  QString cmd = QString("DELETE_RECORDING %1 %2 %3 %4")
196  .arg(pi.GetChanID())
198  .arg(forceDelete ? "FORCE" : "NO_FORCE")
199  .arg(allowRerecord ? "FORGET" : "NO_FORGET");
200  MythEvent me(cmd);
201 
202  gCoreContext->dispatch(me);
203  return true;
204  }
205 
206  return false;
207 }
208 
210 //
212 
213 bool Dvr::UnDeleteRecording(int RecordedId,
214  int chanid, const QDateTime &recstarttsRaw)
215 {
216  if ((RecordedId <= 0) &&
217  (chanid <= 0 || !recstarttsRaw.isValid()))
218  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
219 
220  RecordingInfo ri;
221  if (RecordedId > 0)
222  ri = RecordingInfo(RecordedId);
223  else
224  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
225 
226  if (ri.GetChanID() && ri.HasPathname())
227  {
228  QString cmd = QString("UNDELETE_RECORDING %1 %2")
229  .arg(ri.GetChanID())
231  MythEvent me(cmd);
232 
233  gCoreContext->dispatch(me);
234  return true;
235  }
236 
237  return false;
238 }
239 
241 //
243 
244 bool Dvr::UpdateRecordedWatchedStatus ( int RecordedId,
245  int chanid,
246  const QDateTime &recstarttsRaw,
247  bool watched)
248 {
249  if ((RecordedId <= 0) &&
250  (chanid <= 0 || !recstarttsRaw.isValid()))
251  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
252 
253  // TODO Should use RecordingInfo
254  ProgramInfo pi;
255  if (RecordedId > 0)
256  pi = ProgramInfo(RecordedId);
257  else
258  pi = ProgramInfo(chanid, recstarttsRaw.toUTC());
259 
260  pi.SaveWatched(watched);
261 
262  return true;
263 }
264 
266 //
268 
270  int chanid,
271  const QDateTime &recstarttsRaw,
272  const QString &offsettype )
273 {
274  int marktype;
275  if ((RecordedId <= 0) &&
276  (chanid <= 0 || !recstarttsRaw.isValid()))
277  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
278 
279  RecordingInfo ri;
280  if (RecordedId > 0)
281  ri = RecordingInfo(RecordedId);
282  else
283  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
284 
285  DTC::CutList* pCutList = new DTC::CutList();
286  if (offsettype == "Position")
287  marktype = 1;
288  else if (offsettype == "Duration")
289  marktype = 2;
290  else
291  marktype = 0;
292 
293  FillCutList(pCutList, &ri, marktype);
294 
295  return pCutList;
296 }
297 
299 //
301 
303  int chanid,
304  const QDateTime &recstarttsRaw,
305  const QString &offsettype )
306 {
307  int marktype;
308  if ((RecordedId <= 0) &&
309  (chanid <= 0 || !recstarttsRaw.isValid()))
310  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
311 
312  RecordingInfo ri;
313  if (RecordedId > 0)
314  ri = RecordingInfo(RecordedId);
315  else
316  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
317 
318  DTC::CutList* pCutList = new DTC::CutList();
319  if (offsettype == "Position")
320  marktype = 1;
321  else if (offsettype == "Duration")
322  marktype = 2;
323  else
324  marktype = 0;
325 
326  FillCommBreak(pCutList, &ri, marktype);
327 
328  return pCutList;
329 }
330 
332 //
334 
336  int nCount )
337 {
338  pginfolist_t infoList;
339 
340  if (expirer)
341  expirer->GetAllExpiring( infoList );
342 
343  // ----------------------------------------------------------------------
344  // Build Response
345  // ----------------------------------------------------------------------
346 
347  DTC::ProgramList *pPrograms = new DTC::ProgramList();
348 
349  nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)infoList.size() ) : 0;
350  nCount = (nCount > 0) ? min( nCount, (int)infoList.size() ) : infoList.size();
351  int nEndIndex = min((nStartIndex + nCount), (int)infoList.size() );
352 
353  for( int n = nStartIndex; n < nEndIndex; n++)
354  {
355  ProgramInfo *pInfo = infoList[ n ];
356 
357  if (pInfo != NULL)
358  {
359  DTC::Program *pProgram = pPrograms->AddNewProgram();
360 
361  FillProgramInfo( pProgram, pInfo, true );
362 
363  delete pInfo;
364  }
365  }
366 
367  // ----------------------------------------------------------------------
368 
369  pPrograms->setStartIndex ( nStartIndex );
370  pPrograms->setCount ( nCount );
371  pPrograms->setTotalAvailable( infoList.size() );
372  pPrograms->setAsOf ( MythDate::current() );
373  pPrograms->setVersion ( MYTH_BINARY_VERSION );
374  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
375 
376  return pPrograms;
377 }
378 
380 //
382 
384 {
385 
386  DTC::EncoderList* pList = new DTC::EncoderList();
387 
388  QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo();
389  QMap<int, EncoderLink *>::Iterator iter = tvList.begin();
390 
391  for (; iter != tvList.end(); ++iter)
392  {
393  EncoderLink *elink = *iter;
394 
395  if (elink != NULL)
396  {
397  DTC::Encoder *pEncoder = pList->AddNewEncoder();
398 
399  pEncoder->setId ( elink->GetInputID() );
400  pEncoder->setState ( elink->GetState() );
401  pEncoder->setLocal ( elink->IsLocal() );
402  pEncoder->setConnected ( elink->IsConnected() );
403  pEncoder->setSleepStatus ( elink->GetSleepStatus() );
404  // pEncoder->setLowOnFreeSpace( elink->isLowOnFreeSpace());
405 
406  if (pEncoder->Local())
407  pEncoder->setHostName( gCoreContext->GetHostName() );
408  else
409  pEncoder->setHostName( elink->GetHostName() );
410 
411  QList<InputInfo>::iterator it = inputInfoList.begin();
412  for (; it < inputInfoList.end(); ++it)
413  {
414  InputInfo inputInfo = *it;
415  if (inputInfo.inputid == static_cast<uint>(elink->GetInputID()))
416  {
417  DTC::Input *input = pEncoder->AddNewInput();
418  FillInputInfo(input, inputInfo);
419  }
420  }
421 
422  switch ( pEncoder->State() )
423  {
427  {
428  ProgramInfo *pInfo = elink->GetRecording();
429 
430  if (pInfo)
431  {
432  DTC::Program *pProgram = pEncoder->Recording();
433 
434  FillProgramInfo( pProgram, pInfo, true, true );
435 
436  delete pInfo;
437  }
438 
439  break;
440  }
441 
442  default:
443  break;
444  }
445  }
446  }
447  return pList;
448 }
449 
451 //
453 
455 {
456  DTC::InputList *pList = new DTC::InputList();
457 
458  QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo();
459  QList<InputInfo>::iterator it = inputInfoList.begin();
460  for (; it < inputInfoList.end(); ++it)
461  {
462  InputInfo inputInfo = *it;
463  DTC::Input *input = pList->AddNewInput();
464  FillInputInfo(input, inputInfo);
465  }
466 
467  return pList;
468 }
469 
471 //
473 
474 QStringList Dvr::GetRecGroupList()
475 {
476  MSqlQuery query(MSqlQuery::InitCon());
477  query.prepare("SELECT recgroup FROM recgroups WHERE recgroup <> 'Deleted' "
478  "ORDER BY recgroup");
479 
480  QStringList result;
481  if (!query.exec())
482  {
483  MythDB::DBError("GetRecGroupList", query);
484  return result;
485  }
486 
487  while (query.next())
488  result << query.value(0).toString();
489 
490  return result;
491 }
492 
494 //
496 
498 {
500 }
501 
503 //
505 
507 {
508  return PlayGroup::GetNames();
509 }
510 
512 //
514 
516 {
518 
519  MSqlQuery query(MSqlQuery::InitCon());
520 
521  query.prepare("SELECT filterid, description, newruledefault "
522  "FROM recordfilter ORDER BY filterid");
523 
524  if (query.exec())
525  {
526  while (query.next())
527  {
528  DTC::RecRuleFilter* ruleFilter = filterList->AddNewRecRuleFilter();
529  ruleFilter->setId(query.value(0).toInt());
530  ruleFilter->setDescription(QObject::tr(query.value(1).toString()
531  .toUtf8().constData()));
532  }
533  }
534 
535  return filterList;
536 }
537 
539 //
541 
542 QStringList Dvr::GetTitleList(const QString& RecGroup)
543 {
544  MSqlQuery query(MSqlQuery::InitCon());
545 
546  QString querystr = "SELECT DISTINCT title FROM recorded "
547  "WHERE deletepending = 0";
548 
549  if (!RecGroup.isEmpty())
550  querystr += " AND recgroup = :RECGROUP";
551  else
552  querystr += " AND recgroup != 'Deleted'";
553 
554  querystr += " ORDER BY title";
555 
556  query.prepare(querystr);
557 
558  if (!RecGroup.isEmpty())
559  query.bindValue(":RECGROUP", RecGroup);
560 
561  QStringList result;
562  if (!query.exec())
563  {
564  MythDB::DBError("GetTitleList recorded", query);
565  return result;
566  }
567 
568  while (query.next())
569  result << query.value(0).toString();
570 
571  return result;
572 }
573 
575 //
577 
579 {
580  MSqlQuery query(MSqlQuery::InitCon());
581 
582  QString querystr = QString(
583  "SELECT title, inetref, count(title) as count "
584  " FROM recorded "
585  " WHERE deletepending = 0 "
586  " GROUP BY title, inetref "
587  " ORDER BY title");
588 
589  query.prepare(querystr);
590 
591  DTC::TitleInfoList *pTitleInfos = new DTC::TitleInfoList();
592  if (!query.exec())
593  {
594  MythDB::DBError("GetTitleList recorded", query);
595  return pTitleInfos;
596  }
597 
598  while (query.next())
599  {
600  DTC::TitleInfo *pTitleInfo = pTitleInfos->AddNewTitleInfo();
601 
602  pTitleInfo->setTitle(query.value(0).toString());
603  pTitleInfo->setInetref(query.value(1).toString());
604  pTitleInfo->setCount(query.value(2).toInt());
605  }
606 
607  return pTitleInfos;
608 }
609 
611 //
613 
615  int nCount,
616  bool bShowAll,
617  int nRecordId,
618  int nRecStatus )
619 {
620  RecordingList recordingList; // Auto-delete deque
621  RecList tmpList; // Standard deque, objects must be deleted
622 
623  if (nRecordId <= 0)
624  nRecordId = -1;
625 
626  // NOTE: Fetching this information directly from the schedule is
627  // significantly faster than using ProgramInfo::LoadFromScheduler()
628  Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
629  if (scheduler)
630  scheduler->GetAllPending(tmpList, nRecordId);
631 
632  // Sort the upcoming into only those which will record
633  RecList::iterator it = tmpList.begin();
634  for(; it < tmpList.end(); ++it)
635  {
636  if ((nRecStatus != 0) &&
637  ((*it)->GetRecordingStatus() != nRecStatus))
638  {
639  delete *it;
640  *it = NULL;
641  continue;
642  }
643 
644  if (!bShowAll && ((((*it)->GetRecordingStatus() >= RecStatus::Failing) &&
645  ((*it)->GetRecordingStatus() <= RecStatus::WillRecord)) ||
646  ((*it)->GetRecordingStatus() == RecStatus::Conflict)) &&
647  ((*it)->GetRecordingEndTime() > MythDate::current()))
648  {
649  recordingList.push_back(new RecordingInfo(**it));
650  }
651  else if (bShowAll &&
652  ((*it)->GetRecordingEndTime() > MythDate::current()))
653  {
654  recordingList.push_back(new RecordingInfo(**it));
655  }
656 
657  delete *it;
658  *it = NULL;
659  }
660 
661  // ----------------------------------------------------------------------
662  // Build Response
663  // ----------------------------------------------------------------------
664 
665  DTC::ProgramList *pPrograms = new DTC::ProgramList();
666 
667  nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)recordingList.size() ) : 0;
668  nCount = (nCount > 0) ? min( nCount, (int)recordingList.size() ) : recordingList.size();
669  int nEndIndex = min((nStartIndex + nCount), (int)recordingList.size() );
670 
671  for( int n = nStartIndex; n < nEndIndex; n++)
672  {
673  ProgramInfo *pInfo = recordingList[ n ];
674 
675  DTC::Program *pProgram = pPrograms->AddNewProgram();
676 
677  FillProgramInfo( pProgram, pInfo, true );
678  }
679 
680  // ----------------------------------------------------------------------
681 
682  pPrograms->setStartIndex ( nStartIndex );
683  pPrograms->setCount ( nCount );
684  pPrograms->setTotalAvailable( recordingList.size() );
685  pPrograms->setAsOf ( MythDate::current() );
686  pPrograms->setVersion ( MYTH_BINARY_VERSION );
687  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
688 
689  return pPrograms;
690 }
691 
693 //
695 
697  int nCount,
698  int nRecordId )
699 {
700  RecordingList recordingList; // Auto-delete deque
701  RecList tmpList; // Standard deque, objects must be deleted
702 
703  if (nRecordId <= 0)
704  nRecordId = -1;
705 
706  // NOTE: Fetching this information directly from the schedule is
707  // significantly faster than using ProgramInfo::LoadFromScheduler()
708  Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
709  if (scheduler)
710  scheduler->GetAllPending(tmpList, nRecordId);
711 
712  // Sort the upcoming into only those which are conflicts
713  RecList::iterator it = tmpList.begin();
714  for(; it < tmpList.end(); ++it)
715  {
716  if (((*it)->GetRecordingStatus() == RecStatus::Conflict) &&
717  ((*it)->GetRecordingStartTime() >= MythDate::current()))
718  {
719  recordingList.push_back(new RecordingInfo(**it));
720  }
721  delete *it;
722  *it = NULL;
723  }
724 
725  // ----------------------------------------------------------------------
726  // Build Response
727  // ----------------------------------------------------------------------
728 
729  DTC::ProgramList *pPrograms = new DTC::ProgramList();
730 
731  nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)recordingList.size() ) : 0;
732  nCount = (nCount > 0) ? min( nCount, (int)recordingList.size() ) : recordingList.size();
733  int nEndIndex = min((nStartIndex + nCount), (int)recordingList.size() );
734 
735  for( int n = nStartIndex; n < nEndIndex; n++)
736  {
737  ProgramInfo *pInfo = recordingList[ n ];
738 
739  DTC::Program *pProgram = pPrograms->AddNewProgram();
740 
741  FillProgramInfo( pProgram, pInfo, true );
742  }
743 
744  // ----------------------------------------------------------------------
745 
746  pPrograms->setStartIndex ( nStartIndex );
747  pPrograms->setCount ( nCount );
748  pPrograms->setTotalAvailable( recordingList.size() );
749  pPrograms->setAsOf ( MythDate::current() );
750  pPrograms->setVersion ( MYTH_BINARY_VERSION );
751  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
752 
753  return pPrograms;
754 }
755 
757  QString sTitle,
758  QString sSubtitle,
759  QString sDescription,
760  QString sCategory,
761  QDateTime recstarttsRaw,
762  QDateTime recendtsRaw,
763  QString sSeriesId,
764  QString sProgramId,
765  int nChanId,
766  QString sStation,
767  int nFindDay,
768  QTime tFindTime,
769  int nParentId,
770  bool bInactive,
771  uint nSeason,
772  uint nEpisode,
773  QString sInetref,
774  QString sType,
775  QString sSearchType,
776  int nRecPriority,
777  uint nPreferredInput,
778  int nStartOffset,
779  int nEndOffset,
780  QString sDupMethod,
781  QString sDupIn,
782  uint nFilter,
783  QString sRecProfile,
784  QString sRecGroup,
785  QString sStorageGroup,
786  QString sPlayGroup,
787  bool bAutoExpire,
788  int nMaxEpisodes,
789  bool bMaxNewest,
790  bool bAutoCommflag,
791  bool bAutoTranscode,
792  bool bAutoMetaLookup,
793  bool bAutoUserJob1,
794  bool bAutoUserJob2,
795  bool bAutoUserJob3,
796  bool bAutoUserJob4,
797  int nTranscoder)
798 {
799  QDateTime recstartts = recstarttsRaw.toUTC();
800  QDateTime recendts = recendtsRaw.toUTC();
801  RecordingRule rule;
802  rule.LoadTemplate("Default");
803 
804  if (sType.isEmpty())
805  sType = "single";
806 
807  if (sSearchType.isEmpty())
808  sSearchType = "none";
809 
810  if (sDupMethod.isEmpty())
811  sDupMethod = "subtitleanddescription";
812 
813  if (sDupIn.isEmpty())
814  sDupIn = "all";
815 
816  rule.m_title = sTitle;
817  rule.m_subtitle = sSubtitle;
818  rule.m_description = sDescription;
819 
820  rule.m_startdate = recstartts.date();
821  rule.m_starttime = recstartts.time();
822  rule.m_enddate = recendts.date();
823  rule.m_endtime = recendts.time();
824 
825  rule.m_type = recTypeFromString(sType);
826  rule.m_searchType = searchTypeFromString(sSearchType);
827  rule.m_dupMethod = dupMethodFromString(sDupMethod);
828  rule.m_dupIn = dupInFromString(sDupIn);
829 
830  if (sRecProfile.isEmpty())
831  sRecProfile = "Default";
832 
833  if (sRecGroup.isEmpty())
834  sRecGroup = "Default";
835 
836  if (sStorageGroup.isEmpty())
837  sStorageGroup = "Default";
838 
839  if (sPlayGroup.isEmpty())
840  sPlayGroup = "Default";
841 
842  rule.m_category = sCategory;
843  rule.m_seriesid = sSeriesId;
844  rule.m_programid = sProgramId;
845 
846  rule.m_channelid = nChanId;
847  rule.m_station = sStation;
848 
849  rule.m_findday = nFindDay;
850  rule.m_findtime = tFindTime;
851 
852  rule.m_recProfile = sRecProfile;
853  rule.m_recGroupID = RecordingInfo::GetRecgroupID(sRecGroup);
854  if (rule.m_recGroupID == 0)
856  rule.m_storageGroup = sStorageGroup;
857  rule.m_playGroup = sPlayGroup;
858 
859  rule.m_parentRecID = nParentId;
860  rule.m_isInactive = bInactive;
861 
862  rule.m_season = nSeason;
863  rule.m_episode = nEpisode;
864  rule.m_inetref = sInetref;
865 
866  rule.m_recPriority = nRecPriority;
867  rule.m_prefInput = nPreferredInput;
868  rule.m_startOffset = nStartOffset;
869  rule.m_endOffset = nEndOffset;
870  rule.m_filter = nFilter;
871 
872  rule.m_autoExpire = bAutoExpire;
873  rule.m_maxEpisodes = nMaxEpisodes;
874  rule.m_maxNewest = bMaxNewest;
875 
876  rule.m_autoCommFlag = bAutoCommflag;
877  rule.m_autoTranscode = bAutoTranscode;
878  rule.m_autoMetadataLookup = bAutoMetaLookup;
879 
880  rule.m_autoUserJob1 = bAutoUserJob1;
881  rule.m_autoUserJob2 = bAutoUserJob2;
882  rule.m_autoUserJob3 = bAutoUserJob3;
883  rule.m_autoUserJob4 = bAutoUserJob4;
884 
885  rule.m_transcoder = nTranscoder;
886 
887  QString msg;
888  if (!rule.IsValid(msg))
889  throw msg;
890 
891  rule.Save();
892 
893  uint recid = rule.m_recordID;
894 
895  return recid;
896 }
897 
899  QString sTitle,
900  QString sSubtitle,
901  QString sDescription,
902  QString sCategory,
903  QDateTime dStartTimeRaw,
904  QDateTime dEndTimeRaw,
905  QString sSeriesId,
906  QString sProgramId,
907  int nChanId,
908  QString sStation,
909  int nFindDay,
910  QTime tFindTime,
911  bool bInactive,
912  uint nSeason,
913  uint nEpisode,
914  QString sInetref,
915  QString sType,
916  QString sSearchType,
917  int nRecPriority,
918  uint nPreferredInput,
919  int nStartOffset,
920  int nEndOffset,
921  QString sDupMethod,
922  QString sDupIn,
923  uint nFilter,
924  QString sRecProfile,
925  QString sRecGroup,
926  QString sStorageGroup,
927  QString sPlayGroup,
928  bool bAutoExpire,
929  int nMaxEpisodes,
930  bool bMaxNewest,
931  bool bAutoCommflag,
932  bool bAutoTranscode,
933  bool bAutoMetaLookup,
934  bool bAutoUserJob1,
935  bool bAutoUserJob2,
936  bool bAutoUserJob3,
937  bool bAutoUserJob4,
938  int nTranscoder)
939 {
940  if (nRecordId <= 0 )
941  throw QString("Record ID is invalid.");
942 
943  RecordingRule pRule;
944  pRule.m_recordID = nRecordId;
945  pRule.Load();
946 
947  if (!pRule.IsLoaded())
948  throw QString("Record ID does not exist.");
949 
950  QDateTime recstartts = dStartTimeRaw.toUTC();
951  QDateTime recendts = dEndTimeRaw.toUTC();
952 
953  pRule.m_isInactive = bInactive;
954  if (sType.isEmpty())
955  sType = "single";
956 
957  if (sSearchType.isEmpty())
958  sSearchType = "none";
959 
960  if (sDupMethod.isEmpty())
961  sDupMethod = "subtitleanddescription";
962 
963  if (sDupIn.isEmpty())
964  sDupIn = "all";
965 
966  pRule.m_type = recTypeFromString(sType);
967  pRule.m_searchType = searchTypeFromString(sSearchType);
968  pRule.m_dupMethod = dupMethodFromString(sDupMethod);
969  pRule.m_dupIn = dupInFromString(sDupIn);
970 
971  if (sRecProfile.isEmpty())
972  sRecProfile = "Default";
973 
974  if (sRecGroup.isEmpty())
975  sRecGroup = "Default";
976 
977  if (sStorageGroup.isEmpty())
978  sStorageGroup = "Default";
979 
980  if (sPlayGroup.isEmpty())
981  sPlayGroup = "Default";
982 
983  if (!sTitle.isEmpty())
984  pRule.m_title = sTitle;
985 
986  if (!sSubtitle.isEmpty())
987  pRule.m_subtitle = sSubtitle;
988 
989  if(!sDescription.isEmpty())
990  pRule.m_description = sDescription;
991 
992  if (!sCategory.isEmpty())
993  pRule.m_category = sCategory;
994 
995  if (!sSeriesId.isEmpty())
996  pRule.m_seriesid = sSeriesId;
997 
998  if (!sProgramId.isEmpty())
999  pRule.m_programid = sProgramId;
1000 
1001  if (nChanId)
1002  pRule.m_channelid = nChanId;
1003  if (!sStation.isEmpty())
1004  pRule.m_station = sStation;
1005 
1006  pRule.m_startdate = recstartts.date();
1007  pRule.m_starttime = recstartts.time();
1008  pRule.m_enddate = recendts.date();
1009  pRule.m_endtime = recendts.time();
1010 
1011  pRule.m_findday = nFindDay;
1012  pRule.m_findtime = tFindTime;
1013 
1014  pRule.m_recProfile = sRecProfile;
1015  pRule.m_recGroupID = RecordingInfo::GetRecgroupID(sRecGroup);
1016  if (pRule.m_recGroupID == 0)
1018  pRule.m_storageGroup = sStorageGroup;
1019  pRule.m_playGroup = sPlayGroup;
1020 
1021  pRule.m_isInactive = bInactive;
1022 
1023  pRule.m_season = nSeason;
1024  pRule.m_episode = nEpisode;
1025  pRule.m_inetref = sInetref;
1026 
1027  pRule.m_recPriority = nRecPriority;
1028  pRule.m_prefInput = nPreferredInput;
1029  pRule.m_startOffset = nStartOffset;
1030  pRule.m_endOffset = nEndOffset;
1031  pRule.m_filter = nFilter;
1032 
1033  pRule.m_autoExpire = bAutoExpire;
1034  pRule.m_maxEpisodes = nMaxEpisodes;
1035  pRule.m_maxNewest = bMaxNewest;
1036 
1037  pRule.m_autoCommFlag = bAutoCommflag;
1038  pRule.m_autoTranscode = bAutoTranscode;
1039  pRule.m_autoMetadataLookup = bAutoMetaLookup;
1040 
1041  pRule.m_autoUserJob1 = bAutoUserJob1;
1042  pRule.m_autoUserJob2 = bAutoUserJob2;
1043  pRule.m_autoUserJob3 = bAutoUserJob3;
1044  pRule.m_autoUserJob4 = bAutoUserJob4;
1045 
1046  pRule.m_transcoder = nTranscoder;
1047 
1048  QString msg;
1049  if (!pRule.IsValid(msg))
1050  throw msg;
1051 
1052  bool bResult = pRule.Save();
1053 
1054  return bResult;
1055 }
1056 
1058 {
1059  bool bResult = false;
1060 
1061  if (nRecordId <= 0 )
1062  throw QString("Record ID does not exist.");
1063 
1064  RecordingRule pRule;
1065  pRule.m_recordID = nRecordId;
1066 
1067  bResult = pRule.Delete();
1068 
1069  return bResult;
1070 }
1071 
1072 bool Dvr::AddDontRecordSchedule(int nChanId, const QDateTime &dStartTime,
1073  bool bNeverRecord)
1074 {
1075  bool bResult = true;
1076 
1077  if (nChanId <= 0 || !dStartTime.isValid())
1078  throw QString("Program does not exist.");
1079 
1080  ProgramInfo *pi = LoadProgramFromProgram(nChanId, dStartTime.toUTC());
1081 
1082  if (!pi)
1083  throw QString("Program does not exist.");
1084 
1085  // Why RecordingInfo instead of ProgramInfo? Good question ...
1086  RecordingInfo recInfo = RecordingInfo(*pi);
1087 
1088  delete pi;
1089 
1090  if (bNeverRecord)
1091  {
1092  recInfo.ApplyNeverRecord();
1093  }
1094  else
1096 
1097  return bResult;
1098 }
1099 
1101  int nCount,
1102  const QString &Sort,
1103  bool Descending )
1104 {
1105  Scheduler::SchedSortColumn sortingColumn;
1106  if (Sort.toLower() == "lastrecorded")
1107  sortingColumn = Scheduler::kSortLastRecorded;
1108  else if (Sort.toLower() == "nextrecording")
1109  sortingColumn = Scheduler::kSortNextRecording;
1110  else if (Sort.toLower() == "title")
1111  sortingColumn = Scheduler::kSortTitle;
1112  else if (Sort.toLower() == "priority")
1113  sortingColumn = Scheduler::kSortPriority;
1114  else if (Sort.toLower() == "type")
1115  sortingColumn = Scheduler::kSortType;
1116  else
1117  sortingColumn = Scheduler::kSortTitle;
1118 
1119  RecList recList;
1120  Scheduler::GetAllScheduled(recList, sortingColumn, !Descending);
1121 
1122  // ----------------------------------------------------------------------
1123  // Build Response
1124  // ----------------------------------------------------------------------
1125 
1126  DTC::RecRuleList *pRecRules = new DTC::RecRuleList();
1127 
1128  nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)recList.size() ) : 0;
1129  nCount = (nCount > 0) ? min( nCount, (int)recList.size() ) : recList.size();
1130  int nEndIndex = min((nStartIndex + nCount), (int)recList.size() );
1131 
1132  for( int n = nStartIndex; n < nEndIndex; n++)
1133  {
1134  RecordingInfo *info = recList[n];
1135 
1136  if (info != NULL)
1137  {
1138  DTC::RecRule *pRecRule = pRecRules->AddNewRecRule();
1139 
1140  FillRecRuleInfo( pRecRule, info->GetRecordingRule() );
1141  }
1142  }
1143 
1144  // ----------------------------------------------------------------------
1145 
1146  pRecRules->setStartIndex ( nStartIndex );
1147  pRecRules->setCount ( nCount );
1148  pRecRules->setTotalAvailable( recList.size() );
1149  pRecRules->setAsOf ( MythDate::current() );
1150  pRecRules->setVersion ( MYTH_BINARY_VERSION );
1151  pRecRules->setProtoVer ( MYTH_PROTO_VERSION );
1152 
1153  while (!recList.empty())
1154  {
1155  delete recList.back();
1156  recList.pop_back();
1157  }
1158 
1159  return pRecRules;
1160 }
1161 
1163  QString sTemplate,
1164  int nRecordedId,
1165  int nChanId,
1166  QDateTime dStartTimeRaw,
1167  bool bMakeOverride )
1168 {
1169  RecordingRule rule;
1170  QDateTime dStartTime = dStartTimeRaw.toUTC();
1171 
1172  if (nRecordId > 0)
1173  {
1174  rule.m_recordID = nRecordId;
1175  if (!rule.Load())
1176  throw QString("Record ID does not exist.");
1177  }
1178  else if (!sTemplate.isEmpty())
1179  {
1180  if (!rule.LoadTemplate(sTemplate))
1181  throw QString("Template does not exist.");
1182  }
1183  else if (nRecordedId > 0) // Loads from the Recorded/Recorded Program Table
1184  {
1185  // Despite the use of ProgramInfo, this only applies to Recordings.
1186  ProgramInfo recInfo(nRecordedId);
1187  if (!rule.LoadByProgram(&recInfo))
1188  throw QString("Recording does not exist");
1189  }
1190  else if (nChanId > 0 && dStartTime.isValid()) // Loads from Program Table, should NOT be used with recordings
1191  {
1192  // Despite the use of RecordingInfo, this only applies to programs in the
1193  // present or future, not to recordings? Confused yet?
1195  RecordingInfo info(nChanId, dStartTime, false, 0, &status);
1196  if (status != RecordingInfo::kFoundProgram)
1197  throw QString("Program does not exist.");
1198  RecordingRule *pRule = info.GetRecordingRule();
1199  if (bMakeOverride && rule.m_type != kSingleRecord &&
1200  rule.m_type != kOverrideRecord && rule.m_type != kDontRecord)
1201  pRule->MakeOverride();
1202  rule = *pRule;
1203  }
1204  else
1205  {
1206  throw QString("Invalid request.");
1207  }
1208 
1209  DTC::RecRule *pRecRule = new DTC::RecRule();
1210  FillRecRuleInfo( pRecRule, &rule );
1211 
1212  return pRecRule;
1213 }
1214 
1216 {
1217  bool bResult = false;
1218 
1219  if (nRecordId <= 0 )
1220  throw QString("Record ID appears invalid.");
1221 
1222  RecordingRule pRule;
1223  pRule.m_recordID = nRecordId;
1224  pRule.Load();
1225 
1226  if (pRule.IsLoaded())
1227  {
1228  pRule.m_isInactive = false;
1229  bResult = pRule.Save();
1230  }
1231 
1232  return bResult;
1233 }
1234 
1236 {
1237  bool bResult = false;
1238 
1239  if (nRecordId <= 0 )
1240  throw QString("Record ID appears invalid.");
1241 
1242  RecordingRule pRule;
1243  pRule.m_recordID = nRecordId;
1244  pRule.Load();
1245 
1246  if (pRule.IsLoaded())
1247  {
1248  pRule.m_isInactive = true;
1249  bResult = pRule.Save();
1250  }
1251 
1252  return bResult;
1253 }
1254 
1256 {
1257  RecStatus::Type type = static_cast<RecStatus::Type>(RecStatus);
1258  return RecStatus::toString(type);
1259 }
1260 
1261 QString Dvr::RecStatusToDescription(int RecStatus, int recType,
1262  const QDateTime &StartTime)
1263 {
1264  //if (!StartTime.isValid())
1265  // throw QString("StartTime appears invalid.");
1266  RecStatus::Type rsType = static_cast<RecStatus::Type>(RecStatus);
1267  RecordingType recordingType = static_cast<RecordingType>(recType);
1268  return RecStatus::toDescription(rsType, recordingType, StartTime);
1269 }
1270 
1271 QString Dvr::RecTypeToString(QString recType)
1272 {
1273  bool ok;
1274  RecordingType enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1275  if (ok)
1276  return toString(enumType);
1277  // RecordingType type = static_cast<RecordingType>(recType);
1278  return toString(recTypeFromString(recType));
1279 }
1280 
1281 QString Dvr::RecTypeToDescription(QString recType)
1282 {
1283  bool ok;
1284  RecordingType enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1285  if (ok)
1286  return toDescription(enumType);
1287  // RecordingType type = static_cast<RecordingType>(recType);
1288  return toDescription(recTypeFromString(recType));
1289 }
1290 
1291 QString Dvr::DupInToString(QString DupIn)
1292 {
1293  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1294  // return toString(type);
1295  return toString(dupInFromString(DupIn));
1296 }
1297 
1298 QString Dvr::DupInToDescription(QString DupIn)
1299 {
1300  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1301  //return toDescription(type);
1302  return toDescription(dupInFromString(DupIn));
1303 }
1304 
1305 QString Dvr::DupMethodToString(QString DupMethod)
1306 {
1307  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1308  return toString(dupMethodFromString(DupMethod));
1309 }
1310 
1311 QString Dvr::DupMethodToDescription(QString DupMethod)
1312 {
1313  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1314  return toDescription(dupMethodFromString(DupMethod));
1315 }
QString RecStatusToString(int RecStatus)
Definition: dvr.cpp:1255
QString m_subtitle
Definition: recordingrule.h:76
bool DeleteRecording(int RecordedId, int ChanId, const QDateTime &StartTime, bool ForceDelete, bool AllowRerecord)
Definition: dvr.cpp:178
QTime m_findtime
Day of the week for once per week etc.
Definition: recordingrule.h:95
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:785
MythScheduler * GetScheduler(void)
DTC::ProgramList * GetConflictList(int StartIndex, int Count, int RecordId)
Definition: dvr.cpp:696
Program * AddNewProgram()
Definition: programList.h:86
void bindValue(const QString &placeholder, const QVariant &val)
Definition: mythdbcon.cpp:884
AutoExpire * expirer
QString m_programid
Definition: recordingrule.h:88
DTC::RecRuleFilterList * GetRecRuleFilterList()
Definition: dvr.cpp:515
DTC::TitleInfoList * GetTitleInfoList()
Definition: dvr.cpp:578
SchedSortColumn
Definition: scheduler.h:70
ProgramInfo * LoadProgramFromProgram(const uint chanid, const QDateTime &starttime)
Watching LiveTV is the state for when we are watching a recording and the user has control over the c...
Definition: tv.h:63
void push_back(T info)
bool UpdateRecordedWatchedStatus(int RecordedId, int ChanId, const QDateTime &StartTime, bool Watched)
Definition: dvr.cpp:244
QString toDescription(RecordingType rectype)
Converts "rectype" into a human readable description.
bool LoadByProgram(const ProgramInfo *proginfo)
void FillProgramInfo(DTC::Program *pProgram, ProgramInfo *pInfo, bool bIncChannel, bool bDetails, bool bIncCast)
Definition: serviceUtil.cpp:44
bool Delete(bool sendSig=true)
bool IsLoaded() const
Definition: recordingrule.h:55
RecSearchType searchTypeFromString(QString type)
QStringList GetPlayGroupList()
Definition: dvr.cpp:506
QVariant value(int i) const
Definition: mythdbcon.h:182
bool IsDeletePending(void) const
Definition: programinfo.h:463
DTC::CutList * GetRecordedCutList(int RecordedId, int ChanId, const QDateTime &StartTime, const QString &OffsetType)
Definition: dvr.cpp:269
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
void FillRecRuleInfo(DTC::RecRule *pRecRule, RecordingRule *pRule)
RecordingRule * GetRecordingRule(void)
Returns the "record" field, creating it if necessary.
TitleInfo * AddNewTitleInfo()
Definition: titleInfoList.h:57
RecordingType recTypeFromString(QString type)
static QString toDescription(Type, RecordingType, const QDateTime &recstartts)
Converts "recstatus" into a long human readable description.
QString m_storageGroup
static QStringList getRecordingsGroups(void)
QString m_station
Definition: recordingrule.h:93
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:33
QString DupMethodToDescription(QString DupMethod)
Definition: dvr.cpp:1311
Watching Recording is the state for when we are watching an in progress recording, but the user does not have control over the channel and recorder to use.
Definition: tv.h:80
unsigned int uint
Definition: compat.h:136
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QString DupInToString(QString DupIn)
Definition: dvr.cpp:1291
AutoDeleteDeque< ProgramInfo * > ProgramList
Definition: programinfo.h:28
DTC::CutList * GetRecordedCommBreak(int RecordedId, int ChanId, const QDateTime &StartTime, const QString &OffsetType)
Definition: dvr.cpp:302
RecordingType m_type
Definition: recordingrule.h:99
RecordingDupMethodType m_dupMethod
DTC::RecRuleList * GetRecordScheduleList(int StartIndex, int Count, const QString &Sort, bool Descending)
Definition: dvr.cpp:1100
DTC::ProgramList * GetExpiringList(int StartIndex, int Count)
Definition: dvr.cpp:335
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
Definition: programinfo.h:382
static uint GetRecgroupID(const QString &recGroup)
Temporary helper during transition from string to ID.
size_t size(void) const
QStringList GetRecStorageGroupList()
Definition: dvr.cpp:497
bool Save(bool sendSig=true)
RecordingDupMethodType dupMethodFromString(QString type)
Holds information on recordings and videos.
Definition: programinfo.h:65
void ApplyRecordStateChange(RecordingType newstate, bool save=true)
Sets RecordingType of "record", creating "record" if it does not exist.
bool RemoveRecorded(int RecordedId, int ChanId, const QDateTime &StartTime, bool ForceDelete, bool AllowRerecord)
Definition: dvr.cpp:169
Recording Only is a TVRec only state for when we are recording a program, but there is no one current...
Definition: tv.h:84
This class is used as a container for messages.
Definition: mythevent.h:15
RecRuleFilter * AddNewRecRuleFilter()
static QString toString(Type, uint id)
static void GetAllScheduled(QStringList &strList, SchedSortColumn sortBy=kSortTitle, bool ascending=true)
Returns all scheduled programs serialized into a QStringList.
Definition: scheduler.cpp:1812
static QMap< QString, uint32_t > QueryInUseMap(void)
bool m_autoMetadataLookup
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
int m_findday
callsign?
Definition: recordingrule.h:94
QMap< int, EncoderLink * > tvList
QString m_playGroup
void FillCutList(DTC::CutList *pCutList, RecordingInfo *rInfo, int marktype)
QString DupMethodToString(QString DupMethod)
Definition: dvr.cpp:1305
Input * AddNewInput()
Definition: inputList.h:59
QString m_description
Definition: recordingrule.h:77
QString RecStatusToDescription(int RecStatus, int RecType, const QDateTime &StartTime)
Definition: dvr.cpp:1261
bool GetAllPending(RecList &retList, int recRuleId=0) const
Definition: scheduler.cpp:1718
QString RecTypeToString(QString RecType)
Definition: dvr.cpp:1271
static MSqlQueryInfo InitCon(ConnectionReuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:542
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:31
static QList< InputInfo > GetAllInputInfo()
Definition: cardutil.cpp:995
void GetAllExpiring(QStringList &strList)
Gets the full list of programs that can expire in expiration order.
Definition: autoexpire.cpp:841
uint inputid
unique key in DB for this input
Definition: inputinfo.h:72
QString m_seriesid
Definition: recordingrule.h:87
int m_parentRecID
Unique Recording Rule ID.
Definition: recordingrule.h:70
RecordingDupInType m_dupIn
QString RecTypeToDescription(QString RecType)
Definition: dvr.cpp:1281
void dispatch(const MythEvent &event)
QString m_inetref
Definition: recordingrule.h:89
bool AddDontRecordSchedule(int ChanId, const QDateTime &StartTime, bool NeverRecord)
Definition: dvr.cpp:1072
Encoder * AddNewEncoder()
Definition: encoderList.h:59
DTC::ProgramList * GetUpcomingList(int StartIndex, int Count, bool ShowAll, int RecordId, int RecStatus)
Definition: dvr.cpp:614
void FillCommBreak(DTC::CutList *pCutList, RecordingInfo *rInfo, int marktype)
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:810
RecRule * AddNewRecRule()
Definition: recRuleList.h:72
QString GetRecordingGroup(void) const
Definition: programinfo.h:397
DTC::RecRule * GetRecordSchedule(uint RecordId, QString Template, int nRecordedId, int ChanId, QDateTime StartTime, bool MakeOverride)
Definition: dvr.cpp:1162
bool UnDeleteRecording(int RecordedId, int ChanId, const QDateTime &StartTime)
Definition: dvr.cpp:213
QString m_title
Recording rule is enabled?
Definition: recordingrule.h:75
static const char * toString(OMX_AUDIO_DDPBITSTREAMID id)
Used to expire recordings to make space for new recordings.
Definition: autoexpire.h:62
void ApplyNeverRecord(void)
Set this program to never be recorded by inserting 'history' for it into the database with a status o...
QString DupInToDescription(QString DupIn)
Definition: dvr.cpp:1298
DTC::Program * GetRecorded(int RecordedId, int ChanId, const QDateTime &StartTime)
Definition: dvr.cpp:145
static QMap< QString, bool > QueryJobsRunning(int type)
QString m_recProfile
bool HasPathname(void) const
Definition: programinfo.h:338
GLint GLenum GLsizei GLint GLenum GLenum type
void SaveWatched(bool watchedFlag)
Set "watched" field in recorded/videometadata to "watchedFlag".
DTC::EncoderList * GetEncoderList()
Definition: dvr.cpp:383
static QStringList GetNames(void)
Definition: playgroup.cpp:173
virtual QMap< QString, ProgramInfo * > GetRecording(void) const =0
bool RemoveRecordSchedule(uint RecordId)
Definition: dvr.cpp:1057
bool Load(bool asTemplate=false)
unsigned m_filter
QString GetStorageGroup(void) const
Definition: programinfo.h:400
QString m_category
Definition: recordingrule.h:80
bool LoadFromRecorded(ProgramList &destination, bool possiblyInProgressRecordingsOnly, const QMap< QString, uint32_t > &inUseMap, const QMap< QString, bool > &isJobRunning, const QMap< QString, ProgramInfo * > &recMap, int sort)
bool LoadTemplate(QString category, QString categoryType="Default")
DTC::InputList * GetInputList()
Definition: dvr.cpp:454
DTC::ProgramList * GetRecordedList(bool Descending, int StartIndex, int Count, const QString &TitleRegEx, const QString &RecGroup, const QString &StorageGroup)
Definition: dvr.cpp:62
std::deque< RecordingInfo * > RecList
Definition: mythscheduler.h:10
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:610
vector< ProgramInfo * > pginfolist_t
Definition: autoexpire.h:23
QStringList GetRecGroupList()
Definition: dvr.cpp:474
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:350
RecordingDupInType dupInFromString(QString type)
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:181
void FillInputInfo(DTC::Input *input, InputInfo inputInfo)
bool MakeOverride(void)
bool DisableRecordSchedule(uint RecordId)
Definition: dvr.cpp:1235
QString GetHostName(void)
bool UpdateRecordSchedule(uint RecordId, QString Title, QString Subtitle, QString Description, QString Category, QDateTime StartTime, QDateTime EndTime, QString SeriesId, QString ProgramId, int ChanId, QString Station, int FindDay, QTime FindTime, bool Inactive, uint Season, uint Episode, QString Inetref, QString Type, QString SearchType, int RecPriority, uint PreferredInput, int StartOffset, int EndOffset, QString DupMethod, QString DupIn, uint Filter, QString RecProfile, QString RecGroup, QString StorageGroup, QString PlayGroup, bool AutoExpire, int MaxEpisodes, bool MaxNewest, bool AutoCommflag, bool AutoTranscode, bool AutoMetaLookup, bool AutoUserJob1, bool AutoUserJob2, bool AutoUserJob3, bool AutoUserJob4, int Transcoder)
Definition: dvr.cpp:898
Default UTC.
Definition: mythdate.h:14
bool EnableRecordSchedule(uint RecordId)
Definition: dvr.cpp:1215
QStringList GetTitleList(const QString &RecGroup)
Definition: dvr.cpp:542
QString GetTitle(void) const
Definition: programinfo.h:341
RecSearchType m_searchType
uint AddRecordSchedule(QString Title, QString Subtitle, QString Description, QString Category, QDateTime StartTime, QDateTime EndTime, QString SeriesId, QString ProgramId, int ChanId, QString Station, int FindDay, QTime FindTime, int ParentId, bool Inactive, uint Season, uint Episode, QString Inetref, QString Type, QString SearchType, int RecPriority, uint PreferredInput, int StartOffset, int EndOffset, QString DupMethod, QString DupIn, uint Filter, QString RecProfile, QString RecGroup, QString StorageGroup, QString PlayGroup, bool AutoExpire, int MaxEpisodes, bool MaxNewest, bool AutoCommflag, bool AutoTranscode, bool AutoMetaLookup, bool AutoUserJob1, bool AutoUserJob2, bool AutoUserJob3, bool AutoUserJob4, int Transcoder)
Definition: dvr.cpp:756
bool IsValid(QString &text)