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 = min( nStartIndex, (int)infoList.size() );
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->GetCardID() );
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.cardid == static_cast<uint>(elink->GetCardID()))
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 inetref <> '' "
586  " AND deletepending = 0 "
587  " GROUP BY title, inetref "
588  " ORDER BY title");
589 
590  query.prepare(querystr);
591 
592  DTC::TitleInfoList *pTitleInfos = new DTC::TitleInfoList();
593  if (!query.exec())
594  {
595  MythDB::DBError("GetTitleList recorded", query);
596  return pTitleInfos;
597  }
598 
599  while (query.next())
600  {
601  DTC::TitleInfo *pTitleInfo = pTitleInfos->AddNewTitleInfo();
602 
603  pTitleInfo->setTitle(query.value(0).toString());
604  pTitleInfo->setInetref(query.value(1).toString());
605  pTitleInfo->setCount(query.value(2).toInt());
606  }
607 
608  return pTitleInfos;
609 }
610 
612 //
614 
616  int nCount,
617  bool bShowAll,
618  int nRecordId,
619  int nRecStatus )
620 {
621  RecordingList recordingList; // Auto-delete deque
622  RecList tmpList; // Standard deque, objects must be deleted
623 
624  if (nRecordId <= 0)
625  nRecordId = -1;
626 
627  // NOTE: Fetching this information directly from the schedule is
628  // significantly faster than using ProgramInfo::LoadFromScheduler()
629  Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
630  if (scheduler)
631  scheduler->GetAllPending(tmpList, nRecordId);
632 
633  // Sort the upcoming into only those which will record
634  RecList::iterator it = tmpList.begin();
635  for(; it < tmpList.end(); ++it)
636  {
637  if ((nRecStatus != 0) &&
638  ((*it)->GetRecordingStatus() != nRecStatus))
639  {
640  delete *it;
641  *it = NULL;
642  continue;
643  }
644 
645  if (!bShowAll && ((((*it)->GetRecordingStatus() >= RecStatus::Failing) &&
646  ((*it)->GetRecordingStatus() <= RecStatus::WillRecord)) ||
647  ((*it)->GetRecordingStatus() == RecStatus::Conflict)) &&
648  ((*it)->GetRecordingEndTime() > MythDate::current()))
649  {
650  recordingList.push_back(new RecordingInfo(**it));
651  }
652  else if (bShowAll &&
653  ((*it)->GetRecordingEndTime() > MythDate::current()))
654  {
655  recordingList.push_back(new RecordingInfo(**it));
656  }
657 
658  delete *it;
659  *it = NULL;
660  }
661 
662  // ----------------------------------------------------------------------
663  // Build Response
664  // ----------------------------------------------------------------------
665 
666  DTC::ProgramList *pPrograms = new DTC::ProgramList();
667 
668  nStartIndex = min( nStartIndex, (int)recordingList.size() );
669  nCount = (nCount > 0) ? min( nCount, (int)recordingList.size() ) : recordingList.size();
670  int nEndIndex = min((nStartIndex + nCount), (int)recordingList.size() );
671 
672  for( int n = nStartIndex; n < nEndIndex; n++)
673  {
674  ProgramInfo *pInfo = recordingList[ n ];
675 
676  DTC::Program *pProgram = pPrograms->AddNewProgram();
677 
678  FillProgramInfo( pProgram, pInfo, true );
679  }
680 
681  // ----------------------------------------------------------------------
682 
683  pPrograms->setStartIndex ( nStartIndex );
684  pPrograms->setCount ( nCount );
685  pPrograms->setTotalAvailable( recordingList.size() );
686  pPrograms->setAsOf ( MythDate::current() );
687  pPrograms->setVersion ( MYTH_BINARY_VERSION );
688  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
689 
690  return pPrograms;
691 }
692 
694 //
696 
698  int nCount,
699  int nRecordId )
700 {
701  RecordingList recordingList; // Auto-delete deque
702  RecList tmpList; // Standard deque, objects must be deleted
703 
704  if (nRecordId <= 0)
705  nRecordId = -1;
706 
707  // NOTE: Fetching this information directly from the schedule is
708  // significantly faster than using ProgramInfo::LoadFromScheduler()
709  Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
710  if (scheduler)
711  scheduler->GetAllPending(tmpList, nRecordId);
712 
713  // Sort the upcoming into only those which are conflicts
714  RecList::iterator it = tmpList.begin();
715  for(; it < tmpList.end(); ++it)
716  {
717  if (((*it)->GetRecordingStatus() == RecStatus::Conflict) &&
718  ((*it)->GetRecordingStartTime() >= MythDate::current()))
719  {
720  recordingList.push_back(new RecordingInfo(**it));
721  }
722  delete *it;
723  *it = NULL;
724  }
725 
726  // ----------------------------------------------------------------------
727  // Build Response
728  // ----------------------------------------------------------------------
729 
730  DTC::ProgramList *pPrograms = new DTC::ProgramList();
731 
732  nStartIndex = min( nStartIndex, (int)recordingList.size() );
733  nCount = (nCount > 0) ? min( nCount, (int)recordingList.size() ) : recordingList.size();
734  int nEndIndex = min((nStartIndex + nCount), (int)recordingList.size() );
735 
736  for( int n = nStartIndex; n < nEndIndex; n++)
737  {
738  ProgramInfo *pInfo = recordingList[ n ];
739 
740  DTC::Program *pProgram = pPrograms->AddNewProgram();
741 
742  FillProgramInfo( pProgram, pInfo, true );
743  }
744 
745  // ----------------------------------------------------------------------
746 
747  pPrograms->setStartIndex ( nStartIndex );
748  pPrograms->setCount ( nCount );
749  pPrograms->setTotalAvailable( recordingList.size() );
750  pPrograms->setAsOf ( MythDate::current() );
751  pPrograms->setVersion ( MYTH_BINARY_VERSION );
752  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
753 
754  return pPrograms;
755 }
756 
758  QString sTitle,
759  QString sSubtitle,
760  QString sDescription,
761  QString sCategory,
762  QDateTime recstarttsRaw,
763  QDateTime recendtsRaw,
764  QString sSeriesId,
765  QString sProgramId,
766  int nChanId,
767  QString sStation,
768  int nFindDay,
769  QTime tFindTime,
770  int nParentId,
771  bool bInactive,
772  uint nSeason,
773  uint nEpisode,
774  QString sInetref,
775  QString sType,
776  QString sSearchType,
777  int nRecPriority,
778  uint nPreferredInput,
779  int nStartOffset,
780  int nEndOffset,
781  QString sDupMethod,
782  QString sDupIn,
783  uint nFilter,
784  QString sRecProfile,
785  QString sRecGroup,
786  QString sStorageGroup,
787  QString sPlayGroup,
788  bool bAutoExpire,
789  int nMaxEpisodes,
790  bool bMaxNewest,
791  bool bAutoCommflag,
792  bool bAutoTranscode,
793  bool bAutoMetaLookup,
794  bool bAutoUserJob1,
795  bool bAutoUserJob2,
796  bool bAutoUserJob3,
797  bool bAutoUserJob4,
798  int nTranscoder)
799 {
800  QDateTime recstartts = recstarttsRaw.toUTC();
801  QDateTime recendts = recendtsRaw.toUTC();
802  RecordingRule rule;
803  rule.LoadTemplate("Default");
804 
805  if (sType.isEmpty())
806  sType = "single";
807 
808  if (sSearchType.isEmpty())
809  sSearchType = "none";
810 
811  if (sDupMethod.isEmpty())
812  sDupMethod = "subtitleanddescription";
813 
814  if (sDupIn.isEmpty())
815  sDupIn = "all";
816 
817  rule.m_title = sTitle;
818  rule.m_subtitle = sSubtitle;
819  rule.m_description = sDescription;
820 
821  rule.m_startdate = recstartts.date();
822  rule.m_starttime = recstartts.time();
823  rule.m_enddate = recendts.date();
824  rule.m_endtime = recendts.time();
825 
826  rule.m_type = recTypeFromString(sType);
827  rule.m_searchType = searchTypeFromString(sSearchType);
828  rule.m_dupMethod = dupMethodFromString(sDupMethod);
829  rule.m_dupIn = dupInFromString(sDupIn);
830 
831  if (sRecProfile.isEmpty())
832  sRecProfile = "Default";
833 
834  if (sRecGroup.isEmpty())
835  sRecGroup = "Default";
836 
837  if (sStorageGroup.isEmpty())
838  sStorageGroup = "Default";
839 
840  if (sPlayGroup.isEmpty())
841  sPlayGroup = "Default";
842 
843  rule.m_category = sCategory;
844  rule.m_seriesid = sSeriesId;
845  rule.m_programid = sProgramId;
846 
847  rule.m_channelid = nChanId;
848  rule.m_station = sStation;
849 
850  rule.m_findday = nFindDay;
851  rule.m_findtime = tFindTime;
852 
853  rule.m_recProfile = sRecProfile;
854  rule.m_recGroupID = RecordingInfo::GetRecgroupID(sRecGroup) > 0 ? RecordingInfo::GetRecgroupID(sRecGroup) :
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) > 0 ? RecordingInfo::GetRecgroupID(sRecGroup) :
1017  pRule.m_storageGroup = sStorageGroup;
1018  pRule.m_playGroup = sPlayGroup;
1019 
1020  pRule.m_isInactive = bInactive;
1021 
1022  pRule.m_season = nSeason;
1023  pRule.m_episode = nEpisode;
1024  pRule.m_inetref = sInetref;
1025 
1026  pRule.m_recPriority = nRecPriority;
1027  pRule.m_prefInput = nPreferredInput;
1028  pRule.m_startOffset = nStartOffset;
1029  pRule.m_endOffset = nEndOffset;
1030  pRule.m_filter = nFilter;
1031 
1032  pRule.m_autoExpire = bAutoExpire;
1033  pRule.m_maxEpisodes = nMaxEpisodes;
1034  pRule.m_maxNewest = bMaxNewest;
1035 
1036  pRule.m_autoCommFlag = bAutoCommflag;
1037  pRule.m_autoTranscode = bAutoTranscode;
1038  pRule.m_autoMetadataLookup = bAutoMetaLookup;
1039 
1040  pRule.m_autoUserJob1 = bAutoUserJob1;
1041  pRule.m_autoUserJob2 = bAutoUserJob2;
1042  pRule.m_autoUserJob3 = bAutoUserJob3;
1043  pRule.m_autoUserJob4 = bAutoUserJob4;
1044 
1045  pRule.m_transcoder = nTranscoder;
1046 
1047  QString msg;
1048  if (!pRule.IsValid(msg))
1049  throw msg;
1050 
1051  bool bResult = pRule.Save();
1052 
1053  return bResult;
1054 }
1055 
1057 {
1058  bool bResult = false;
1059 
1060  if (nRecordId <= 0 )
1061  throw QString("Record ID does not exist.");
1062 
1063  RecordingRule pRule;
1064  pRule.m_recordID = nRecordId;
1065 
1066  bResult = pRule.Delete();
1067 
1068  return bResult;
1069 }
1070 
1071 bool Dvr::AddDontRecordSchedule(int nChanId, const QDateTime &dStartTime,
1072  bool bNeverRecord)
1073 {
1074  bool bResult = true;
1075 
1076  if (nChanId <= 0 || !dStartTime.isValid())
1077  throw QString("Program does not exist.");
1078 
1079  ProgramInfo *pi = LoadProgramFromProgram(nChanId, dStartTime.toUTC());
1080 
1081  if (!pi)
1082  throw QString("Program does not exist.");
1083 
1084  // Why RecordingInfo instead of ProgramInfo? Good question ...
1085  RecordingInfo recInfo = RecordingInfo(*pi);
1086 
1087  delete pi;
1088 
1089  if (bNeverRecord)
1090  {
1091  recInfo.ApplyNeverRecord();
1092  }
1093  else
1095 
1096  return bResult;
1097 }
1098 
1100  int nCount,
1101  const QString &Sort,
1102  bool Descending )
1103 {
1104  Scheduler::SchedSortColumn sortingColumn;
1105  if (Sort.toLower() == "lastrecorded")
1106  sortingColumn = Scheduler::kSortLastRecorded;
1107  else if (Sort.toLower() == "nextrecording")
1108  sortingColumn = Scheduler::kSortNextRecording;
1109  else if (Sort.toLower() == "title")
1110  sortingColumn = Scheduler::kSortTitle;
1111  else if (Sort.toLower() == "priority")
1112  sortingColumn = Scheduler::kSortPriority;
1113  else if (Sort.toLower() == "type")
1114  sortingColumn = Scheduler::kSortType;
1115  else
1116  sortingColumn = Scheduler::kSortTitle;
1117 
1118  RecList recList;
1119  Scheduler::GetAllScheduled(recList, sortingColumn, !Descending);
1120 
1121  // ----------------------------------------------------------------------
1122  // Build Response
1123  // ----------------------------------------------------------------------
1124 
1125  DTC::RecRuleList *pRecRules = new DTC::RecRuleList();
1126 
1127  nStartIndex = min( nStartIndex, (int)recList.size() );
1128  nCount = (nCount > 0) ? min( nCount, (int)recList.size() ) : recList.size();
1129  int nEndIndex = min((nStartIndex + nCount), (int)recList.size() );
1130 
1131  for( int n = nStartIndex; n < nEndIndex; n++)
1132  {
1133  RecordingInfo *info = recList[n];
1134 
1135  if (info != NULL)
1136  {
1137  DTC::RecRule *pRecRule = pRecRules->AddNewRecRule();
1138 
1139  FillRecRuleInfo( pRecRule, info->GetRecordingRule() );
1140  }
1141  }
1142 
1143  // ----------------------------------------------------------------------
1144 
1145  pRecRules->setStartIndex ( nStartIndex );
1146  pRecRules->setCount ( nCount );
1147  pRecRules->setTotalAvailable( recList.size() );
1148  pRecRules->setAsOf ( MythDate::current() );
1149  pRecRules->setVersion ( MYTH_BINARY_VERSION );
1150  pRecRules->setProtoVer ( MYTH_PROTO_VERSION );
1151 
1152  while (!recList.empty())
1153  {
1154  delete recList.back();
1155  recList.pop_back();
1156  }
1157 
1158  return pRecRules;
1159 }
1160 
1162  QString sTemplate,
1163  int nRecordedId,
1164  int nChanId,
1165  QDateTime dStartTimeRaw,
1166  bool bMakeOverride )
1167 {
1168  RecordingRule rule;
1169  QDateTime dStartTime = dStartTimeRaw.toUTC();
1170 
1171  if (nRecordId > 0)
1172  {
1173  rule.m_recordID = nRecordId;
1174  if (!rule.Load())
1175  throw QString("Record ID does not exist.");
1176  }
1177  else if (!sTemplate.isEmpty())
1178  {
1179  if (!rule.LoadTemplate(sTemplate))
1180  throw QString("Template does not exist.");
1181  }
1182  else if (nRecordedId > 0) // Loads from the Recorded/Recorded Program Table
1183  {
1184  // Despite the use of ProgramInfo, this only applies to Recordings.
1185  ProgramInfo recInfo(nRecordedId);
1186  if (!rule.LoadByProgram(&recInfo))
1187  throw QString("Recording does not exist");
1188  }
1189  else if (nChanId > 0 && dStartTime.isValid()) // Loads from Program Table, should NOT be used with recordings
1190  {
1191  // Despite the use of RecordingInfo, this only applies to programs in the
1192  // present or future, not to recordings? Confused yet?
1194  RecordingInfo info(nChanId, dStartTime, false, 0, &status);
1195  if (status != RecordingInfo::kFoundProgram)
1196  throw QString("Program does not exist.");
1197  RecordingRule *pRule = info.GetRecordingRule();
1198  if (bMakeOverride && rule.m_type != kSingleRecord &&
1199  rule.m_type != kOverrideRecord && rule.m_type != kDontRecord)
1200  pRule->MakeOverride();
1201  rule = *pRule;
1202  }
1203  else
1204  {
1205  throw QString("Invalid request.");
1206  }
1207 
1208  DTC::RecRule *pRecRule = new DTC::RecRule();
1209  FillRecRuleInfo( pRecRule, &rule );
1210 
1211  return pRecRule;
1212 }
1213 
1215 {
1216  bool bResult = false;
1217 
1218  if (nRecordId <= 0 )
1219  throw QString("Record ID appears invalid.");
1220 
1221  RecordingRule pRule;
1222  pRule.m_recordID = nRecordId;
1223  pRule.Load();
1224 
1225  if (pRule.IsLoaded())
1226  {
1227  pRule.m_isInactive = false;
1228  bResult = pRule.Save();
1229  }
1230 
1231  return bResult;
1232 }
1233 
1235 {
1236  bool bResult = false;
1237 
1238  if (nRecordId <= 0 )
1239  throw QString("Record ID appears invalid.");
1240 
1241  RecordingRule pRule;
1242  pRule.m_recordID = nRecordId;
1243  pRule.Load();
1244 
1245  if (pRule.IsLoaded())
1246  {
1247  pRule.m_isInactive = true;
1248  bResult = pRule.Save();
1249  }
1250 
1251  return bResult;
1252 }
1253 
1255 {
1256  RecStatus::Type type = static_cast<RecStatus::Type>(RecStatus);
1257  return RecStatus::toString(type);
1258 }
1259 
1260 QString Dvr::RecStatusToDescription(int RecStatus, int recType,
1261  const QDateTime &StartTime)
1262 {
1263  //if (!StartTime.isValid())
1264  // throw QString("StartTime appears invalid.");
1265  RecStatus::Type rsType = static_cast<RecStatus::Type>(RecStatus);
1266  RecordingType recordingType = static_cast<RecordingType>(recType);
1267  return RecStatus::toDescription(rsType, recordingType, StartTime);
1268 }
1269 
1270 QString Dvr::RecTypeToString(QString recType)
1271 {
1272  bool ok;
1273  RecordingType enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1274  if (ok)
1275  return toString(enumType);
1276  // RecordingType type = static_cast<RecordingType>(recType);
1277  return toString(recTypeFromString(recType));
1278 }
1279 
1280 QString Dvr::RecTypeToDescription(QString recType)
1281 {
1282  bool ok;
1283  RecordingType enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1284  if (ok)
1285  return toDescription(enumType);
1286  // RecordingType type = static_cast<RecordingType>(recType);
1287  return toDescription(recTypeFromString(recType));
1288 }
1289 
1290 QString Dvr::DupInToString(QString DupIn)
1291 {
1292  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1293  // return toString(type);
1294  return toString(dupInFromString(DupIn));
1295 }
1296 
1297 QString Dvr::DupInToDescription(QString DupIn)
1298 {
1299  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1300  //return toDescription(type);
1301  return toDescription(dupInFromString(DupIn));
1302 }
1303 
1304 QString Dvr::DupMethodToString(QString DupMethod)
1305 {
1306  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1307  return toString(dupMethodFromString(DupMethod));
1308 }
1309 
1310 QString Dvr::DupMethodToDescription(QString DupMethod)
1311 {
1312  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1313  return toDescription(dupMethodFromString(DupMethod));
1314 }
QString RecStatusToString(int RecStatus)
Definition: dvr.cpp:1254
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:697
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)
QString toString(MarkTypes type)
QStringList GetPlayGroupList()
Definition: dvr.cpp:506
QVariant value(int i) const
Definition: mythdbcon.h:182
bool IsDeletePending(void) const
Definition: programinfo.h:469
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:1310
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:1290
GLint GLenum GLsizei GLint GLenum GLenum type
AutoDeleteDeque< ProgramInfo * > ProgramList
Definition: programinfo.h:35
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:1099
DTC::ProgramList * GetExpiringList(int StartIndex, int Count)
Definition: dvr.cpp:335
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
Definition: programinfo.h:387
uint cardid
card id associated with input
Definition: inputinfo.h:75
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:72
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:1304
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:1260
bool GetAllPending(RecList &retList, int recRuleId=0) const
Definition: scheduler.cpp:1718
QString RecTypeToString(QString RecType)
Definition: dvr.cpp:1270
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:1067
void GetAllExpiring(QStringList &strList)
Gets the full list of programs that can expire in expiration order.
Definition: autoexpire.cpp:841
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:1280
void dispatch(const MythEvent &event)
QString m_inetref
Definition: recordingrule.h:89
bool AddDontRecordSchedule(int ChanId, const QDateTime &StartTime, bool NeverRecord)
Definition: dvr.cpp:1071
Encoder * AddNewEncoder()
Definition: encoderList.h:59
DTC::ProgramList * GetUpcomingList(int StartIndex, int Count, bool ShowAll, int RecordId, int RecStatus)
Definition: dvr.cpp:615
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:402
DTC::RecRule * GetRecordSchedule(uint RecordId, QString Template, int nRecordedId, int ChanId, QDateTime StartTime, bool MakeOverride)
Definition: dvr.cpp:1161
bool UnDeleteRecording(int RecordedId, int ChanId, const QDateTime &StartTime)
Definition: dvr.cpp:213
QString m_title
Recording rule is enabled?
Definition: recordingrule.h:75
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:1297
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:343
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:1056
bool Load(bool asTemplate=false)
unsigned m_filter
QString GetStorageGroup(void) const
Definition: programinfo.h:405
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:355
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:1234
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:1214
QStringList GetTitleList(const QString &RecGroup)
Definition: dvr.cpp:542
QString GetTitle(void) const
Definition: programinfo.h:346
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:757
bool IsValid(QString &text)