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->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 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);
855  if (rule.m_recGroupID == 0)
857  rule.m_storageGroup = sStorageGroup;
858  rule.m_playGroup = sPlayGroup;
859 
860  rule.m_parentRecID = nParentId;
861  rule.m_isInactive = bInactive;
862 
863  rule.m_season = nSeason;
864  rule.m_episode = nEpisode;
865  rule.m_inetref = sInetref;
866 
867  rule.m_recPriority = nRecPriority;
868  rule.m_prefInput = nPreferredInput;
869  rule.m_startOffset = nStartOffset;
870  rule.m_endOffset = nEndOffset;
871  rule.m_filter = nFilter;
872 
873  rule.m_autoExpire = bAutoExpire;
874  rule.m_maxEpisodes = nMaxEpisodes;
875  rule.m_maxNewest = bMaxNewest;
876 
877  rule.m_autoCommFlag = bAutoCommflag;
878  rule.m_autoTranscode = bAutoTranscode;
879  rule.m_autoMetadataLookup = bAutoMetaLookup;
880 
881  rule.m_autoUserJob1 = bAutoUserJob1;
882  rule.m_autoUserJob2 = bAutoUserJob2;
883  rule.m_autoUserJob3 = bAutoUserJob3;
884  rule.m_autoUserJob4 = bAutoUserJob4;
885 
886  rule.m_transcoder = nTranscoder;
887 
888  QString msg;
889  if (!rule.IsValid(msg))
890  throw msg;
891 
892  rule.Save();
893 
894  uint recid = rule.m_recordID;
895 
896  return recid;
897 }
898 
900  QString sTitle,
901  QString sSubtitle,
902  QString sDescription,
903  QString sCategory,
904  QDateTime dStartTimeRaw,
905  QDateTime dEndTimeRaw,
906  QString sSeriesId,
907  QString sProgramId,
908  int nChanId,
909  QString sStation,
910  int nFindDay,
911  QTime tFindTime,
912  bool bInactive,
913  uint nSeason,
914  uint nEpisode,
915  QString sInetref,
916  QString sType,
917  QString sSearchType,
918  int nRecPriority,
919  uint nPreferredInput,
920  int nStartOffset,
921  int nEndOffset,
922  QString sDupMethod,
923  QString sDupIn,
924  uint nFilter,
925  QString sRecProfile,
926  QString sRecGroup,
927  QString sStorageGroup,
928  QString sPlayGroup,
929  bool bAutoExpire,
930  int nMaxEpisodes,
931  bool bMaxNewest,
932  bool bAutoCommflag,
933  bool bAutoTranscode,
934  bool bAutoMetaLookup,
935  bool bAutoUserJob1,
936  bool bAutoUserJob2,
937  bool bAutoUserJob3,
938  bool bAutoUserJob4,
939  int nTranscoder)
940 {
941  if (nRecordId <= 0 )
942  throw QString("Record ID is invalid.");
943 
944  RecordingRule pRule;
945  pRule.m_recordID = nRecordId;
946  pRule.Load();
947 
948  if (!pRule.IsLoaded())
949  throw QString("Record ID does not exist.");
950 
951  QDateTime recstartts = dStartTimeRaw.toUTC();
952  QDateTime recendts = dEndTimeRaw.toUTC();
953 
954  pRule.m_isInactive = bInactive;
955  if (sType.isEmpty())
956  sType = "single";
957 
958  if (sSearchType.isEmpty())
959  sSearchType = "none";
960 
961  if (sDupMethod.isEmpty())
962  sDupMethod = "subtitleanddescription";
963 
964  if (sDupIn.isEmpty())
965  sDupIn = "all";
966 
967  pRule.m_type = recTypeFromString(sType);
968  pRule.m_searchType = searchTypeFromString(sSearchType);
969  pRule.m_dupMethod = dupMethodFromString(sDupMethod);
970  pRule.m_dupIn = dupInFromString(sDupIn);
971 
972  if (sRecProfile.isEmpty())
973  sRecProfile = "Default";
974 
975  if (sRecGroup.isEmpty())
976  sRecGroup = "Default";
977 
978  if (sStorageGroup.isEmpty())
979  sStorageGroup = "Default";
980 
981  if (sPlayGroup.isEmpty())
982  sPlayGroup = "Default";
983 
984  if (!sTitle.isEmpty())
985  pRule.m_title = sTitle;
986 
987  if (!sSubtitle.isEmpty())
988  pRule.m_subtitle = sSubtitle;
989 
990  if(!sDescription.isEmpty())
991  pRule.m_description = sDescription;
992 
993  if (!sCategory.isEmpty())
994  pRule.m_category = sCategory;
995 
996  if (!sSeriesId.isEmpty())
997  pRule.m_seriesid = sSeriesId;
998 
999  if (!sProgramId.isEmpty())
1000  pRule.m_programid = sProgramId;
1001 
1002  if (nChanId)
1003  pRule.m_channelid = nChanId;
1004  if (!sStation.isEmpty())
1005  pRule.m_station = sStation;
1006 
1007  pRule.m_startdate = recstartts.date();
1008  pRule.m_starttime = recstartts.time();
1009  pRule.m_enddate = recendts.date();
1010  pRule.m_endtime = recendts.time();
1011 
1012  pRule.m_findday = nFindDay;
1013  pRule.m_findtime = tFindTime;
1014 
1015  pRule.m_recProfile = sRecProfile;
1016  pRule.m_recGroupID = RecordingInfo::GetRecgroupID(sRecGroup);
1017  if (pRule.m_recGroupID == 0)
1019  pRule.m_storageGroup = sStorageGroup;
1020  pRule.m_playGroup = sPlayGroup;
1021 
1022  pRule.m_isInactive = bInactive;
1023 
1024  pRule.m_season = nSeason;
1025  pRule.m_episode = nEpisode;
1026  pRule.m_inetref = sInetref;
1027 
1028  pRule.m_recPriority = nRecPriority;
1029  pRule.m_prefInput = nPreferredInput;
1030  pRule.m_startOffset = nStartOffset;
1031  pRule.m_endOffset = nEndOffset;
1032  pRule.m_filter = nFilter;
1033 
1034  pRule.m_autoExpire = bAutoExpire;
1035  pRule.m_maxEpisodes = nMaxEpisodes;
1036  pRule.m_maxNewest = bMaxNewest;
1037 
1038  pRule.m_autoCommFlag = bAutoCommflag;
1039  pRule.m_autoTranscode = bAutoTranscode;
1040  pRule.m_autoMetadataLookup = bAutoMetaLookup;
1041 
1042  pRule.m_autoUserJob1 = bAutoUserJob1;
1043  pRule.m_autoUserJob2 = bAutoUserJob2;
1044  pRule.m_autoUserJob3 = bAutoUserJob3;
1045  pRule.m_autoUserJob4 = bAutoUserJob4;
1046 
1047  pRule.m_transcoder = nTranscoder;
1048 
1049  QString msg;
1050  if (!pRule.IsValid(msg))
1051  throw msg;
1052 
1053  bool bResult = pRule.Save();
1054 
1055  return bResult;
1056 }
1057 
1059 {
1060  bool bResult = false;
1061 
1062  if (nRecordId <= 0 )
1063  throw QString("Record ID does not exist.");
1064 
1065  RecordingRule pRule;
1066  pRule.m_recordID = nRecordId;
1067 
1068  bResult = pRule.Delete();
1069 
1070  return bResult;
1071 }
1072 
1073 bool Dvr::AddDontRecordSchedule(int nChanId, const QDateTime &dStartTime,
1074  bool bNeverRecord)
1075 {
1076  bool bResult = true;
1077 
1078  if (nChanId <= 0 || !dStartTime.isValid())
1079  throw QString("Program does not exist.");
1080 
1081  ProgramInfo *pi = LoadProgramFromProgram(nChanId, dStartTime.toUTC());
1082 
1083  if (!pi)
1084  throw QString("Program does not exist.");
1085 
1086  // Why RecordingInfo instead of ProgramInfo? Good question ...
1087  RecordingInfo recInfo = RecordingInfo(*pi);
1088 
1089  delete pi;
1090 
1091  if (bNeverRecord)
1092  {
1093  recInfo.ApplyNeverRecord();
1094  }
1095  else
1097 
1098  return bResult;
1099 }
1100 
1102  int nCount,
1103  const QString &Sort,
1104  bool Descending )
1105 {
1106  Scheduler::SchedSortColumn sortingColumn;
1107  if (Sort.toLower() == "lastrecorded")
1108  sortingColumn = Scheduler::kSortLastRecorded;
1109  else if (Sort.toLower() == "nextrecording")
1110  sortingColumn = Scheduler::kSortNextRecording;
1111  else if (Sort.toLower() == "title")
1112  sortingColumn = Scheduler::kSortTitle;
1113  else if (Sort.toLower() == "priority")
1114  sortingColumn = Scheduler::kSortPriority;
1115  else if (Sort.toLower() == "type")
1116  sortingColumn = Scheduler::kSortType;
1117  else
1118  sortingColumn = Scheduler::kSortTitle;
1119 
1120  RecList recList;
1121  Scheduler::GetAllScheduled(recList, sortingColumn, !Descending);
1122 
1123  // ----------------------------------------------------------------------
1124  // Build Response
1125  // ----------------------------------------------------------------------
1126 
1127  DTC::RecRuleList *pRecRules = new DTC::RecRuleList();
1128 
1129  nStartIndex = min( nStartIndex, (int)recList.size() );
1130  nCount = (nCount > 0) ? min( nCount, (int)recList.size() ) : recList.size();
1131  int nEndIndex = min((nStartIndex + nCount), (int)recList.size() );
1132 
1133  for( int n = nStartIndex; n < nEndIndex; n++)
1134  {
1135  RecordingInfo *info = recList[n];
1136 
1137  if (info != NULL)
1138  {
1139  DTC::RecRule *pRecRule = pRecRules->AddNewRecRule();
1140 
1141  FillRecRuleInfo( pRecRule, info->GetRecordingRule() );
1142  }
1143  }
1144 
1145  // ----------------------------------------------------------------------
1146 
1147  pRecRules->setStartIndex ( nStartIndex );
1148  pRecRules->setCount ( nCount );
1149  pRecRules->setTotalAvailable( recList.size() );
1150  pRecRules->setAsOf ( MythDate::current() );
1151  pRecRules->setVersion ( MYTH_BINARY_VERSION );
1152  pRecRules->setProtoVer ( MYTH_PROTO_VERSION );
1153 
1154  while (!recList.empty())
1155  {
1156  delete recList.back();
1157  recList.pop_back();
1158  }
1159 
1160  return pRecRules;
1161 }
1162 
1164  QString sTemplate,
1165  int nRecordedId,
1166  int nChanId,
1167  QDateTime dStartTimeRaw,
1168  bool bMakeOverride )
1169 {
1170  RecordingRule rule;
1171  QDateTime dStartTime = dStartTimeRaw.toUTC();
1172 
1173  if (nRecordId > 0)
1174  {
1175  rule.m_recordID = nRecordId;
1176  if (!rule.Load())
1177  throw QString("Record ID does not exist.");
1178  }
1179  else if (!sTemplate.isEmpty())
1180  {
1181  if (!rule.LoadTemplate(sTemplate))
1182  throw QString("Template does not exist.");
1183  }
1184  else if (nRecordedId > 0) // Loads from the Recorded/Recorded Program Table
1185  {
1186  // Despite the use of ProgramInfo, this only applies to Recordings.
1187  ProgramInfo recInfo(nRecordedId);
1188  if (!rule.LoadByProgram(&recInfo))
1189  throw QString("Recording does not exist");
1190  }
1191  else if (nChanId > 0 && dStartTime.isValid()) // Loads from Program Table, should NOT be used with recordings
1192  {
1193  // Despite the use of RecordingInfo, this only applies to programs in the
1194  // present or future, not to recordings? Confused yet?
1196  RecordingInfo info(nChanId, dStartTime, false, 0, &status);
1197  if (status != RecordingInfo::kFoundProgram)
1198  throw QString("Program does not exist.");
1199  RecordingRule *pRule = info.GetRecordingRule();
1200  if (bMakeOverride && rule.m_type != kSingleRecord &&
1201  rule.m_type != kOverrideRecord && rule.m_type != kDontRecord)
1202  pRule->MakeOverride();
1203  rule = *pRule;
1204  }
1205  else
1206  {
1207  throw QString("Invalid request.");
1208  }
1209 
1210  DTC::RecRule *pRecRule = new DTC::RecRule();
1211  FillRecRuleInfo( pRecRule, &rule );
1212 
1213  return pRecRule;
1214 }
1215 
1217 {
1218  bool bResult = false;
1219 
1220  if (nRecordId <= 0 )
1221  throw QString("Record ID appears invalid.");
1222 
1223  RecordingRule pRule;
1224  pRule.m_recordID = nRecordId;
1225  pRule.Load();
1226 
1227  if (pRule.IsLoaded())
1228  {
1229  pRule.m_isInactive = false;
1230  bResult = pRule.Save();
1231  }
1232 
1233  return bResult;
1234 }
1235 
1237 {
1238  bool bResult = false;
1239 
1240  if (nRecordId <= 0 )
1241  throw QString("Record ID appears invalid.");
1242 
1243  RecordingRule pRule;
1244  pRule.m_recordID = nRecordId;
1245  pRule.Load();
1246 
1247  if (pRule.IsLoaded())
1248  {
1249  pRule.m_isInactive = true;
1250  bResult = pRule.Save();
1251  }
1252 
1253  return bResult;
1254 }
1255 
1257 {
1258  RecStatus::Type type = static_cast<RecStatus::Type>(RecStatus);
1259  return RecStatus::toString(type);
1260 }
1261 
1262 QString Dvr::RecStatusToDescription(int RecStatus, int recType,
1263  const QDateTime &StartTime)
1264 {
1265  //if (!StartTime.isValid())
1266  // throw QString("StartTime appears invalid.");
1267  RecStatus::Type rsType = static_cast<RecStatus::Type>(RecStatus);
1268  RecordingType recordingType = static_cast<RecordingType>(recType);
1269  return RecStatus::toDescription(rsType, recordingType, StartTime);
1270 }
1271 
1272 QString Dvr::RecTypeToString(QString recType)
1273 {
1274  bool ok;
1275  RecordingType enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1276  if (ok)
1277  return toString(enumType);
1278  // RecordingType type = static_cast<RecordingType>(recType);
1279  return toString(recTypeFromString(recType));
1280 }
1281 
1282 QString Dvr::RecTypeToDescription(QString recType)
1283 {
1284  bool ok;
1285  RecordingType enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1286  if (ok)
1287  return toDescription(enumType);
1288  // RecordingType type = static_cast<RecordingType>(recType);
1289  return toDescription(recTypeFromString(recType));
1290 }
1291 
1292 QString Dvr::DupInToString(QString DupIn)
1293 {
1294  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1295  // return toString(type);
1296  return toString(dupInFromString(DupIn));
1297 }
1298 
1299 QString Dvr::DupInToDescription(QString DupIn)
1300 {
1301  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1302  //return toDescription(type);
1303  return toDescription(dupInFromString(DupIn));
1304 }
1305 
1306 QString Dvr::DupMethodToString(QString DupMethod)
1307 {
1308  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1309  return toString(dupMethodFromString(DupMethod));
1310 }
1311 
1312 QString Dvr::DupMethodToDescription(QString DupMethod)
1313 {
1314  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1315  return toDescription(dupMethodFromString(DupMethod));
1316 }
QString RecStatusToString(int RecStatus)
Definition: dvr.cpp:1256
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:465
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:1312
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:1292
GLint GLenum GLsizei GLint GLenum GLenum type
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:1101
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:1306
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:1262
bool GetAllPending(RecList &retList, int recRuleId=0) const
Definition: scheduler.cpp:1718
QString RecTypeToString(QString RecType)
Definition: dvr.cpp:1272
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:949
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:1282
void dispatch(const MythEvent &event)
QString m_inetref
Definition: recordingrule.h:89
bool AddDontRecordSchedule(int ChanId, const QDateTime &StartTime, bool NeverRecord)
Definition: dvr.cpp:1073
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:397
DTC::RecRule * GetRecordSchedule(uint RecordId, QString Template, int nRecordedId, int ChanId, QDateTime StartTime, bool MakeOverride)
Definition: dvr.cpp:1163
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:1299
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
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:1058
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:1236
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:899
Default UTC.
Definition: mythdate.h:14
bool EnableRecordSchedule(uint RecordId)
Definition: dvr.cpp:1216
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:757
bool IsValid(QString &text)