MythTV  master
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 // Qt
27 #include <QMap>
28 
29 // MythTV
30 #include "libmyth/programinfo.h"
31 #include "libmyth/programtypes.h"
32 #include "libmyth/recordingtypes.h"
33 #include "libmyth/remoteutil.h"
34 #include "libmythbase/compat.h"
36 #include "libmythbase/mythdate.h"
37 #include "libmythbase/mythevent.h"
41 #include "libmythtv/cardutil.h"
42 #include "libmythtv/channelutil.h"
43 #include "libmythtv/inputinfo.h"
44 #include "libmythtv/jobqueue.h"
45 #include "libmythtv/playgroup.h"
46 #include "libmythtv/programdata.h"
49 #include "libmythtv/tv_rec.h"
50 
51 // MythBackend
52 #include "autoexpire.h"
53 #include "backendcontext.h"
54 #include "dvr.h"
55 #include "encoderlink.h"
56 #include "scheduler.h"
57 #include "scheduler.h"
58 #include "serviceUtil.h"
59 
61 //
63 
65  int nStartIndex,
66  int nCount,
67  const QString &sTitleRegEx,
68  const QString &sRecGroup,
69  const QString &sStorageGroup,
70  const QString &sCategory,
71  const QString &sSort,
72  bool bIgnoreLiveTV,
73  bool bIgnoreDeleted
74  )
75 {
76  QMap< QString, ProgramInfo* > recMap;
77 
79  recMap = gCoreContext->GetScheduler()->GetRecording();
80 
81  QMap< QString, uint32_t > inUseMap = ProgramInfo::QueryInUseMap();
82  QMap< QString, bool > isJobRunning= ProgramInfo::QueryJobsRunning(JOB_COMMFLAG);
83 
84  ProgramList progList;
85 
86  int desc = 1;
87  if (bDescending)
88  desc = -1;
89 
90  if (bIgnoreLiveTV && (sRecGroup == "LiveTV"))
91  {
92  bIgnoreLiveTV = false;
93  LOG(VB_GENERAL, LOG_ERR, QString("Setting Ignore%1=false because RecGroup=%1")
94  .arg(sRecGroup));
95  }
96 
97  if (bIgnoreDeleted && (sRecGroup == "Deleted"))
98  {
99  bIgnoreDeleted = false;
100  LOG(VB_GENERAL, LOG_ERR, QString("Setting Ignore%1=false because RecGroup=%1")
101  .arg(sRecGroup));
102  }
103 
104  LoadFromRecorded( progList, false, inUseMap, isJobRunning, recMap, desc,
105  sSort, bIgnoreLiveTV, bIgnoreDeleted );
106 
107  QMap< QString, ProgramInfo* >::iterator mit = recMap.begin();
108 
109  for (; mit != recMap.end(); mit = recMap.erase(mit))
110  delete *mit;
111 
112  // ----------------------------------------------------------------------
113  // Build Response
114  // ----------------------------------------------------------------------
115 
116  auto *pPrograms = new DTC::ProgramList();
117  int nAvailable = 0;
118 
119  int nMax = (nCount > 0) ? nCount : progList.size();
120 
121  nAvailable = 0;
122  nCount = 0;
123 
124  QRegularExpression rTitleRegEx
125  { sTitleRegEx, QRegularExpression::CaseInsensitiveOption };
126 
127  for (auto *pInfo : progList)
128  {
129  if (pInfo->IsDeletePending() ||
130  (!sTitleRegEx.isEmpty() && !pInfo->GetTitle().contains(rTitleRegEx)) ||
131  (!sRecGroup.isEmpty() && sRecGroup != pInfo->GetRecordingGroup()) ||
132  (!sStorageGroup.isEmpty() && sStorageGroup != pInfo->GetStorageGroup()) ||
133  (!sCategory.isEmpty() && sCategory != pInfo->GetCategory()))
134  continue;
135 
136  if ((nAvailable < nStartIndex) ||
137  (nCount >= nMax))
138  {
139  ++nAvailable;
140  continue;
141  }
142 
143  ++nAvailable;
144  ++nCount;
145 
146  DTC::Program *pProgram = pPrograms->AddNewProgram();
147 
148  FillProgramInfo( pProgram, pInfo, true );
149  }
150 
151  // ----------------------------------------------------------------------
152 
153  pPrograms->setStartIndex ( nStartIndex );
154  pPrograms->setCount ( nCount );
155  pPrograms->setTotalAvailable( nAvailable );
156  pPrograms->setAsOf ( MythDate::current() );
157  pPrograms->setVersion ( MYTH_BINARY_VERSION );
158  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
159 
160  return pPrograms;
161 }
162 
164 //
166 
168  int nStartIndex,
169  int nCount,
170  const QDateTime &sStartTime,
171  const QDateTime &sEndTime,
172  const QString &sTitle,
173  const QString &sSeriesId,
174  int nRecordId,
175  const QString &sSort)
176 {
177  if (!sStartTime.isNull() && !sStartTime.isValid())
178  throw QString("StartTime is invalid");
179 
180  if (!sEndTime.isNull() && !sEndTime.isValid())
181  throw QString("EndTime is invalid");
182 
183  const QDateTime& dtStartTime = sStartTime;
184  const QDateTime& dtEndTime = sEndTime;
185 
186  if (!sEndTime.isNull() && dtEndTime < dtStartTime)
187  throw QString("EndTime is before StartTime");
188 
189  // ----------------------------------------------------------------------
190  // Build SQL statement for Program Listing
191  // ----------------------------------------------------------------------
192 
193  ProgramList progList;
194  MSqlBindings bindings;
195  QString sSQL;
196 
197  if (!dtStartTime.isNull())
198  {
199  sSQL += " AND endtime >= :StartDate ";
200  bindings[":StartDate"] = dtStartTime;
201  }
202 
203  if (!dtEndTime.isNull())
204  {
205  sSQL += " AND starttime <= :EndDate ";
206  bindings[":EndDate"] = dtEndTime;
207  }
208 
209  QStringList clause;
210 
211  if (nRecordId > 0)
212  {
213  clause << "recordid = :RecordId";
214  bindings[":RecordId"] = nRecordId;
215  }
216 
217  if (!sTitle.isEmpty())
218  {
219  clause << "title = :Title";
220  bindings[":Title"] = sTitle;
221  }
222 
223  if (!sSeriesId.isEmpty())
224  {
225  clause << "seriesid = :SeriesId";
226  bindings[":SeriesId"] = sSeriesId;
227  }
228 
229  if (!clause.isEmpty())
230  {
231  sSQL += QString(" AND (%1) ").arg(clause.join(" OR "));
232  }
233 
234  if (sSort == "starttime")
235  sSQL += "ORDER BY starttime "; // NOLINT(bugprone-branch-clone)
236  else if (sSort == "title")
237  sSQL += "ORDER BY title ";
238  else
239  sSQL += "ORDER BY starttime ";
240 
241  if (bDescending)
242  sSQL += "DESC ";
243  else
244  sSQL += "ASC ";
245 
246  uint nTotalAvailable = (nStartIndex == 0) ? 1 : 0;
247  LoadFromOldRecorded( progList, sSQL, bindings,
248  (uint)nStartIndex, (uint)nCount, nTotalAvailable );
249 
250  // ----------------------------------------------------------------------
251  // Build Response
252  // ----------------------------------------------------------------------
253 
254  auto *pPrograms = new DTC::ProgramList();
255 
256  nCount = (int)progList.size();
257  int nEndIndex = (int)progList.size();
258 
259  for( int n = 0; n < nEndIndex; n++)
260  {
261  ProgramInfo *pInfo = progList[ n ];
262 
263  DTC::Program *pProgram = pPrograms->AddNewProgram();
264 
265  FillProgramInfo( pProgram, pInfo, true );
266  }
267 
268  // ----------------------------------------------------------------------
269 
270  pPrograms->setStartIndex ( nStartIndex );
271  pPrograms->setCount ( nCount );
272  pPrograms->setTotalAvailable( nTotalAvailable );
273  pPrograms->setAsOf ( MythDate::current() );
274  pPrograms->setVersion ( MYTH_BINARY_VERSION );
275  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
276 
277  return pPrograms;
278 }
279 
281 //
283 
285  int chanid, const QDateTime &recstarttsRaw)
286 {
287  if ((RecordedId <= 0) &&
288  (chanid <= 0 || !recstarttsRaw.isValid()))
289  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
290 
291  // TODO Should use RecordingInfo
292  ProgramInfo pi;
293  if (RecordedId > 0)
294  pi = ProgramInfo(RecordedId);
295  else
296  pi = ProgramInfo(chanid, recstarttsRaw.toUTC());
297 
298  auto *pProgram = new DTC::Program();
299  FillProgramInfo( pProgram, &pi, true );
300 
301  return pProgram;
302 }
303 
305 //
307 
308 bool Dvr::AddRecordedCredits(int RecordedId, const QJsonObject &jsonObj)
309 {
310  // Verify the corresponding recording exists
311  RecordingInfo ri(RecordedId);
312  if (!ri.HasPathname())
313  throw QString("AddRecordedCredits: recordedid %1 does "
314  "not exist.").arg(RecordedId);
315 
316  DBCredits* credits = jsonCastToCredits(jsonObj);
317  if (credits == nullptr)
318  throw QString("AddRecordedCredits: Failed to parse cast from json.");
319 
320  MSqlQuery query(MSqlQuery::InitCon());
321  for (auto & person : *credits)
322  {
323  if (!person.InsertDB(query, ri.GetChanID(),
324  ri.GetScheduledStartTime(), true))
325  throw QString("AddRecordedCredits: Failed to add credit "
326  "%1 to DB").arg(person.toString());
327  }
328 
329  delete credits;
330  return true;
331 }
332 
334 //
336 
337 int Dvr::AddRecordedProgram(const QJsonObject &jsonObj)
338 {
339  QJsonObject root = jsonObj;
340  QJsonObject program = root["Program"].toObject();
341  QJsonObject channel = program["Channel"].toObject();
342  QJsonObject recording = program["Recording"].toObject();
343  QJsonObject cast = program["Cast"].toObject();
344 
345  auto *pi = new ProgInfo();
346  int chanid = channel.value("ChanId").toString("0").toUInt();
347  QString hostname = program["HostName"].toString("");
348 
349  if (ChannelUtil::GetChanNum(chanid).isEmpty())
350  throw QString("AddRecordedProgram: chanid %1 does "
351  "not exist.").arg(chanid);
352 
353  pi->m_title = program.value("Title").toString("");
354  pi->m_subtitle = program.value("SubTitle").toString("");
355  pi->m_description = program.value("Description").toString("");
356  pi->m_category = program.value("Category").toString("");
357  pi->m_starttime = QDateTime::fromString(program.value("StartTime")
358  .toString(""), Qt::ISODate);
359  pi->m_endtime = QDateTime::fromString(program.value("EndTime")
360  .toString(""), Qt::ISODate);
361  pi->m_originalairdate = QDate::fromString(program.value("Airdate").toString(),
362  Qt::ISODate);
363  pi->m_airdate = pi->m_originalairdate.year();
364  pi->m_partnumber = program.value("PartNumber").toString("0").toUInt();
365  pi->m_parttotal = program.value("PartTotal").toString("0").toUInt();
366  pi->m_syndicatedepisodenumber = "";
367  pi->m_subtitleType = ProgramInfo::SubtitleTypesFromNames
368  (program.value("SubPropNames").toString(""));
369  pi->m_audioProps = ProgramInfo::AudioPropertiesFromNames
370  (program.value("AudioPropNames").toString(""));
371  pi->m_videoProps = ProgramInfo::VideoPropertiesFromNames
372  (program.value("VideoPropNames").toString(""));
373  pi->m_stars = program.value("Stars").toString("0.0").toFloat();
374  pi->m_categoryType = string_to_myth_category_type(program.value("CatType").toString(""));
375  pi->m_seriesId = program.value("SeriesId").toString("");
376  pi->m_programId = program.value("ProgramId").toString("");
377  pi->m_inetref = program.value("Inetref").toString("");
378  pi->m_previouslyshown = false;
379  pi->m_listingsource = 0;
380 // pi->m_ratings =
381 // pi->m_genres =
382  pi->m_season = program.value("Season").toString("0").toUInt();
383  pi->m_episode = program.value("Episode").toString("0").toUInt();
384  pi->m_totalepisodes = program.value("TotalEpisodes").toString("0").toUInt();
385 
386  pi->m_channel = channel.value("ChannelName").toString("");
387 
388  pi->m_startts = recording.value("StartTs").toString("");
389  pi->m_endts = recording.value("EndTs").toString("");
390  QDateTime recstartts = QDateTime::fromString(pi->m_startts, Qt::ISODate);
391  QDateTime recendts = QDateTime::fromString(pi->m_endts, Qt::ISODate);
392 
393  pi->m_title_pronounce = "";
394  pi->m_credits = jsonCastToCredits(cast);
395  pi->m_showtype = "";
396  pi->m_colorcode = "";
397  pi->m_clumpidx = "";
398  pi->m_clumpmax = "";
399 
400  // pi->m_ratings =
401 
402  /* Create a recordedprogram DB entry. */
403  MSqlQuery query(MSqlQuery::InitCon());
404  if (!pi->InsertDB(query, chanid, true))
405  {
406  throw QString("AddRecordedProgram: "
407  "Failed to add recordedprogram entry.");
408  }
409 
410  /* Create recorded DB entry */
411  RecordingInfo ri(pi->m_title, pi->m_title,
412  pi->m_subtitle, pi->m_subtitle,
413  pi->m_description,
414  pi->m_season, pi->m_episode,
415  pi->m_totalepisodes,
416  pi->m_syndicatedepisodenumber,
417  pi->m_category,
418  chanid,
419  channel.value("ChanNum").toString("0"),
420  channel.value("CallSign").toString(""),
421  pi->m_channel,
422  recording.value("RecGroup").toString(""),
423  recording.value("PlayGroup").toString(""),
424  hostname,
425  recording.value("StorageGroup").toString(""),
426  pi->m_airdate,
427  pi->m_partnumber,
428  pi->m_parttotal,
429  pi->m_seriesId,
430  pi->m_programId,
431  pi->m_inetref,
432  pi->m_categoryType,
433  recording.value("Priority").toString("0").toInt(),
434  pi->m_starttime,
435  pi->m_endtime,
436  recstartts,
437  recendts,
438  pi->m_stars,
439  pi->m_originalairdate,
440  program.value("Repeat").toString("false").toLower() == "true",
441  static_cast<RecStatus::Type>(recording.value("Status").toString("-3").toInt()),
442  false, // reactivate
443  recording.value("RecordedId").toString("0").toInt(),
444  0, // parentid
445  static_cast<RecordingType>(recording.value("RecType").toString("0").toInt()),
446  static_cast<RecordingDupInType>(recording.value("DupInType").toString("0").toInt()),
447  static_cast<RecordingDupMethodType>(recording.value("DupMethod").toString("0").toInt()),
448  channel.value("SourceId").toString("0").toUInt(),
449  channel.value("InputId").toString("0").toUInt(),
450  0, // findid
451  channel.value("CommFree").toString("false").toLower() == "true",
452  pi->m_subtitleType,
453  pi->m_videoProps,
454  pi->m_audioProps,
455  false, // future
456  0, // schedorder
457  0, // mplexid
458  0, // sgroupid,
459  recording.value("EncoderName").toString(""));
460 
461  ri.ProgramFlagsFromNames(program.value("ProgramFlagNames").toString(""));
462 
463  QString filename = program.value("FileName").toString("");
464  QString ext("");
465  int idx = filename.lastIndexOf('.');
466  if (idx > 0)
467  ext = filename.right(filename.size() - idx - 1);
468  // Inserts this RecordingInfo into the database as an existing recording
469  if (!ri.InsertRecording(ext, true))
470  throw QString("Failed to create RecordingInfo database entry. "
471  "Non unique starttime?");
472 
473  ri.InsertFile();
474 
477  ri.SavePreserve(ri.IsPreserved());
480  ri.SaveWatched(ri.IsWatched());
481  // TODO: Cutlist
482 
484  ri.SendUpdateEvent();
485 
486  return ri.GetRecordingID();
487 }
488 
490 //
492 
493 bool Dvr::RemoveRecorded(int RecordedId,
494  int chanid, const QDateTime &recstarttsRaw,
495  bool forceDelete, bool allowRerecord)
496 {
497  return DeleteRecording(RecordedId, chanid, recstarttsRaw, forceDelete,
498  allowRerecord);
499 }
500 
501 
502 bool Dvr::DeleteRecording(int RecordedId,
503  int chanid, const QDateTime &recstarttsRaw,
504  bool forceDelete, bool allowRerecord)
505 {
506  if ((RecordedId <= 0) &&
507  (chanid <= 0 || !recstarttsRaw.isValid()))
508  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
509 
510  // TODO Should use RecordingInfo
511  ProgramInfo pi;
512  if (RecordedId > 0)
513  pi = ProgramInfo(RecordedId);
514  else
515  pi = ProgramInfo(chanid, recstarttsRaw.toUTC());
516 
517  if (pi.GetChanID() && pi.HasPathname())
518  {
519  QString cmd = QString("DELETE_RECORDING %1 %2 %3 %4")
520  .arg(QString::number(pi.GetChanID()),
522  forceDelete ? "FORCE" : "NO_FORCE",
523  allowRerecord ? "FORGET" : "NO_FORGET");
524  MythEvent me(cmd);
525 
526  gCoreContext->dispatch(me);
527  return true;
528  }
529 
530  return false;
531 }
532 
534 //
536 
537 bool Dvr::UnDeleteRecording(int RecordedId,
538  int chanid, const QDateTime &recstarttsRaw)
539 {
540  if ((RecordedId <= 0) &&
541  (chanid <= 0 || !recstarttsRaw.isValid()))
542  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
543 
544  RecordingInfo ri;
545  if (RecordedId > 0)
546  ri = RecordingInfo(RecordedId);
547  else
548  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
549 
550  if (ri.GetChanID() && ri.HasPathname())
551  {
552  QString cmd = QString("UNDELETE_RECORDING %1 %2")
553  .arg(ri.GetChanID())
555  MythEvent me(cmd);
556 
557  gCoreContext->dispatch(me);
558  return true;
559  }
560 
561  return false;
562 }
563 
565 //
567 
568 bool Dvr::StopRecording(int RecordedId)
569 {
570  if (RecordedId <= 0)
571  throw QString("RecordedId param is invalid.");
572 
573  RecordingInfo ri = RecordingInfo(RecordedId);
574 
575  if (ri.GetChanID())
576  {
577  QString cmd = QString("STOP_RECORDING %1 %2")
578  .arg(ri.GetChanID())
580  MythEvent me(cmd);
581 
582  gCoreContext->dispatch(me);
583  return true;
584  }
585  throw QString("RecordedId %1 not found").arg(RecordedId);
586 
587  return false;
588 }
589 
591 //
593 
594 bool Dvr::ReactivateRecording(int RecordedId,
595  int chanid, const QDateTime &recstarttsRaw)
596 {
597  if ((RecordedId <= 0) &&
598  (chanid <= 0 || !recstarttsRaw.isValid()))
599  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
600 
601  RecordingInfo ri;
602  if (RecordedId > 0)
603  ri = RecordingInfo(RecordedId);
604  else
605  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
606 
607  if (ri.GetChanID() && ri.HasPathname())
608  {
609  ri.ReactivateRecording();
610  return true;
611  }
612 
613  return false;
614 }
615 
617 //
619 
621 {
622  ScheduledRecording::RescheduleMatch(0, 0, 0, QDateTime(),
623  "RescheduleRecordings");
624  return true;
625 }
626 
628 //
630 
631 bool Dvr::AllowReRecord ( int RecordedId )
632 {
633  if (RecordedId <= 0)
634  throw QString("RecordedId param is invalid.");
635 
636  RecordingInfo ri = RecordingInfo(RecordedId);
637 
638  if (!ri.GetChanID())
639  throw QString("RecordedId %1 not found").arg(RecordedId);
640 
641  ri.ForgetHistory();
642 
643  return true;
644 }
645 
647 //
649 
650 bool Dvr::UpdateRecordedWatchedStatus ( int RecordedId,
651  int chanid,
652  const QDateTime &recstarttsRaw,
653  bool watched)
654 {
655  if ((RecordedId <= 0) &&
656  (chanid <= 0 || !recstarttsRaw.isValid()))
657  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
658 
659  // TODO Should use RecordingInfo
660  ProgramInfo pi;
661  if (RecordedId > 0)
662  pi = ProgramInfo(RecordedId);
663  else
664  pi = ProgramInfo(chanid, recstarttsRaw.toUTC());
665 
666  if (pi.GetChanID() && pi.HasPathname())
667  {
668  pi.SaveWatched(watched);
669  return true;
670  }
671 
672  return false;
673 }
674 
676 //
678 
679 long Dvr::GetSavedBookmark( int RecordedId,
680  int chanid,
681  const QDateTime &recstarttsRaw,
682  const QString &offsettype )
683 {
684  if ((RecordedId <= 0) &&
685  (chanid <= 0 || !recstarttsRaw.isValid()))
686  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
687 
688  RecordingInfo ri;
689  if (RecordedId > 0)
690  ri = RecordingInfo(RecordedId);
691  else
692  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
693  uint64_t offset = 0;
694  bool isend=true;
695  uint64_t position = ri.QueryBookmark();
696  // if no bookmark return 0
697  if (position == 0)
698  return 0;
699  if (offsettype.toLower() == "position"){
700  // if bookmark cannot be converted to a keyframe we will
701  // just return the actual frame saved as the bookmark
702  if (ri.QueryKeyFramePosition(&offset, position, isend))
703  return offset;
704  }
705  if (offsettype.toLower() == "duration"){
706  if (ri.QueryKeyFrameDuration(&offset, position, isend))
707  return offset;
708  // If bookmark cannot be converted to a duration return -1
709  return -1;
710  }
711  return position;
712 }
713 
715 //
717 
718 bool Dvr::SetSavedBookmark( int RecordedId,
719  int chanid,
720  const QDateTime &recstarttsRaw,
721  const QString &offsettype,
722  long Offset )
723 {
724  if ((RecordedId <= 0) &&
725  (chanid <= 0 || !recstarttsRaw.isValid()))
726  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
727 
728  if (Offset < 0)
729  throw QString("Offset must be >= 0.");
730 
731  RecordingInfo ri;
732  if (RecordedId > 0)
733  ri = RecordingInfo(RecordedId);
734  else
735  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
736  uint64_t position = 0;
737  bool isend=true;
738  if (offsettype.toLower() == "position"){
739  if (!ri.QueryPositionKeyFrame(&position, Offset, isend))
740  return false;
741  }
742  else if (offsettype.toLower() == "duration"){
743  if (!ri.QueryDurationKeyFrame(&position, Offset, isend))
744  return false;
745  }
746  else
747  position = Offset;
748  ri.SaveBookmark(position);
749  return true;
750 }
751 
753 //
755 
757  int chanid,
758  const QDateTime &recstarttsRaw,
759  const QString &offsettype )
760 {
761  int marktype = 0;
762  if ((RecordedId <= 0) &&
763  (chanid <= 0 || !recstarttsRaw.isValid()))
764  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
765 
766  RecordingInfo ri;
767  if (RecordedId > 0)
768  ri = RecordingInfo(RecordedId);
769  else
770  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
771 
772  auto* pCutList = new DTC::CutList();
773  if (offsettype.toLower() == "position")
774  marktype = 1;
775  else if (offsettype.toLower() == "duration")
776  marktype = 2;
777  else
778  marktype = 0;
779 
780  FillCutList(pCutList, &ri, marktype);
781 
782  return pCutList;
783 }
784 
786 //
788 
790  int chanid,
791  const QDateTime &recstarttsRaw,
792  const QString &offsettype )
793 {
794  int marktype = 0;
795  if ((RecordedId <= 0) &&
796  (chanid <= 0 || !recstarttsRaw.isValid()))
797  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
798 
799  RecordingInfo ri;
800  if (RecordedId > 0)
801  ri = RecordingInfo(RecordedId);
802  else
803  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
804 
805  auto* pCutList = new DTC::CutList();
806  if (offsettype.toLower() == "position")
807  marktype = 1;
808  else if (offsettype.toLower() == "duration")
809  marktype = 2;
810  else
811  marktype = 0;
812 
813  FillCommBreak(pCutList, &ri, marktype);
814 
815  return pCutList;
816 }
817 
819 //
821 
823  const QString &offsettype )
824 {
825  MarkTypes marktype = MARK_UNSET;
826  if (RecordedId <= 0)
827  throw QString("Recorded ID appears invalid.");
828 
829  RecordingInfo ri;
830  ri = RecordingInfo(RecordedId);
831 
832  auto* pCutList = new DTC::CutList();
833  if (offsettype.toLower() == "bytes")
834  marktype = MARK_GOP_BYFRAME;
835  else if (offsettype.toLower() == "duration")
836  marktype = MARK_DURATION_MS;
837  else
838  {
839  delete pCutList;
840  throw QString("Type must be 'BYTES' or 'DURATION'.");
841  }
842 
843  FillSeek(pCutList, &ri, marktype);
844 
845  return pCutList;
846 }
847 
849 //
851 
853 {
854  RecordingInfo ri;
855  ri = RecordingInfo(RecordedId);
856 
857  if (!ri.HasPathname())
858  throw QString("Invalid RecordedId %1").arg(RecordedId);
859 
860  QVector<ProgramInfo::MarkupEntry> mapMark;
861  QVector<ProgramInfo::MarkupEntry> mapSeek;
862 
863  ri.QueryMarkup(mapMark, mapSeek);
864 
865  auto* pMarkupList = new DTC::MarkupList();
866  for (auto entry : qAsConst(mapMark))
867  {
868  DTC::Markup *pMarkup = pMarkupList->AddNewMarkup();
869  QString typestr = toString(static_cast<MarkTypes>(entry.type));
870  pMarkup->setType(typestr);
871  pMarkup->setFrame(entry.frame);
872  if (entry.isDataNull)
873  pMarkup->setData("NULL");
874  else
875  pMarkup->setData(QString::number(entry.data));
876  }
877  for (auto entry : qAsConst(mapSeek))
878  {
879  DTC::Markup *pSeek = pMarkupList->AddNewSeek();
880  QString typestr = toString(static_cast<MarkTypes>(entry.type));
881  pSeek->setType(typestr);
882  pSeek->setFrame(entry.frame);
883  if (entry.isDataNull)
884  pSeek->setData("NULL");
885  else
886  pSeek->setData(QString::number(entry.data));
887  }
888 
889 
890  return pMarkupList;
891 }
892 
894 //
896 
897 bool Dvr::SetRecordedMarkup (int RecordedId, const QJsonObject &jsonObj)
898 {
899  RecordingInfo ri;
900  ri = RecordingInfo(RecordedId);
901 
902  if (!ri.HasPathname())
903  throw QString("Invalid RecordedId %1").arg(RecordedId);
904 
905  QVector<ProgramInfo::MarkupEntry> mapMark;
906  QVector<ProgramInfo::MarkupEntry> mapSeek;
907 
908  QJsonObject markuplist = jsonObj["MarkupList"].toObject();
909 
910  QJsonArray marks = markuplist["Mark"].toArray();
911  for (const auto & m : marks)
912  {
913  QJsonObject markup = m.toObject();
915 
916  QString typestr = markup.value("Type").toString("");
917  entry.type = markTypeFromString(typestr);
918  entry.frame = markup.value("Frame").toString("-1").toLongLong();
919  QString data = markup.value("Data").toString("NULL");
920  entry.isDataNull = (data == "NULL");
921  if (!entry.isDataNull)
922  entry.data = data.toLongLong();
923 
924  mapMark.append(entry);
925  }
926 
927  QJsonArray seeks = markuplist["Seek"].toArray();
928  for (const auto & m : seeks)
929  {
930  QJsonObject markup = m.toObject();
932 
933  QString typestr = markup.value("Type").toString("");
934  entry.type = markTypeFromString(typestr);
935  entry.frame = markup.value("Frame").toString("-1").toLongLong();
936  QString data = markup.value("Data").toString("NULL");
937  entry.isDataNull = (data == "NULL");
938  if (!entry.isDataNull)
939  entry.data = data.toLongLong();
940 
941  mapSeek.append(entry);
942  }
943 
944  ri.SaveMarkup(mapMark, mapSeek);
945 
946  return true;
947 }
948 
950 //
952 
954  int nCount )
955 {
956  pginfolist_t infoList;
957 
958  if (gExpirer)
959  gExpirer->GetAllExpiring( infoList );
960 
961  // ----------------------------------------------------------------------
962  // Build Response
963  // ----------------------------------------------------------------------
964 
965  auto *pPrograms = new DTC::ProgramList();
966 
967  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, (int)infoList.size() ) : 0;
968  nCount = (nCount > 0) ? std::min( nCount, (int)infoList.size() ) : infoList.size();
969  int nEndIndex = std::min((nStartIndex + nCount), (int)infoList.size() );
970 
971  for( int n = nStartIndex; n < nEndIndex; n++)
972  {
973  ProgramInfo *pInfo = infoList[ n ];
974 
975  if (pInfo != nullptr)
976  {
977  DTC::Program *pProgram = pPrograms->AddNewProgram();
978 
979  FillProgramInfo( pProgram, pInfo, true );
980 
981  delete pInfo;
982  }
983  }
984 
985  // ----------------------------------------------------------------------
986 
987  pPrograms->setStartIndex ( nStartIndex );
988  pPrograms->setCount ( nCount );
989  pPrograms->setTotalAvailable( infoList.size() );
990  pPrograms->setAsOf ( MythDate::current() );
991  pPrograms->setVersion ( MYTH_BINARY_VERSION );
992  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
993 
994  return pPrograms;
995 }
996 
998 //
1000 
1002 {
1003  auto* pList = new DTC::EncoderList();
1004 
1005  QReadLocker tvlocker(&TVRec::s_inputsLock);
1006  QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo();
1007  for (auto * elink : qAsConst(gTVList))
1008  {
1009  if (elink != nullptr)
1010  {
1011  DTC::Encoder *pEncoder = pList->AddNewEncoder();
1012 
1013  pEncoder->setId ( elink->GetInputID() );
1014  pEncoder->setState ( elink->GetState() );
1015  pEncoder->setLocal ( elink->IsLocal() );
1016  pEncoder->setConnected ( elink->IsConnected() );
1017  pEncoder->setSleepStatus ( elink->GetSleepStatus() );
1018  // pEncoder->setLowOnFreeSpace( elink->isLowOnFreeSpace());
1019 
1020  if (pEncoder->Local())
1021  pEncoder->setHostName( gCoreContext->GetHostName() );
1022  else
1023  pEncoder->setHostName( elink->GetHostName() );
1024 
1025  for (const auto & inputInfo : qAsConst(inputInfoList))
1026  {
1027  if (inputInfo.m_inputId == static_cast<uint>(elink->GetInputID()))
1028  {
1029  DTC::Input *input = pEncoder->AddNewInput();
1030  FillInputInfo(input, inputInfo);
1031  }
1032  }
1033 
1034  switch ( pEncoder->State() )
1035  {
1036  case kState_WatchingLiveTV:
1037  case kState_RecordingOnly:
1039  {
1040  ProgramInfo *pInfo = elink->GetRecording();
1041 
1042  if (pInfo)
1043  {
1044  DTC::Program *pProgram = pEncoder->Recording();
1045 
1046  FillProgramInfo( pProgram, pInfo, true, true );
1047 
1048  delete pInfo;
1049  }
1050 
1051  break;
1052  }
1053 
1054  default:
1055  break;
1056  }
1057  }
1058  }
1059  return pList;
1060 }
1061 
1063 //
1065 
1067 {
1068  auto *pList = new DTC::InputList();
1069 
1070  QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo();
1071  for (const auto & inputInfo : qAsConst(inputInfoList))
1072  {
1073  DTC::Input *input = pList->AddNewInput();
1074  FillInputInfo(input, inputInfo);
1075  }
1076 
1077  return pList;
1078 }
1079 
1081 //
1083 
1085 {
1086  MSqlQuery query(MSqlQuery::InitCon());
1087  query.prepare("SELECT recgroup FROM recgroups WHERE recgroup <> 'Deleted' "
1088  "ORDER BY recgroup");
1089 
1090  QStringList result;
1091  if (!query.exec())
1092  {
1093  MythDB::DBError("GetRecGroupList", query);
1094  return result;
1095  }
1096 
1097  while (query.next())
1098  result << query.value(0).toString();
1099 
1100  return result;
1101 }
1102 
1104 //
1106 
1107 QStringList Dvr::GetProgramCategories( bool OnlyRecorded )
1108 {
1109  MSqlQuery query(MSqlQuery::InitCon());
1110 
1111  if (OnlyRecorded)
1112  query.prepare("SELECT DISTINCT category FROM recorded ORDER BY category");
1113  else
1114  query.prepare("SELECT DISTINCT category FROM program ORDER BY category");
1115 
1116  QStringList result;
1117  if (!query.exec())
1118  {
1119  MythDB::DBError("GetProgramCategories", query);
1120  return result;
1121  }
1122 
1123  while (query.next())
1124  result << query.value(0).toString();
1125 
1126  return result;
1127 }
1128 
1130 //
1132 
1134 {
1136 }
1137 
1139 //
1141 
1143 {
1144  return PlayGroup::GetNames();
1145 }
1146 
1148 //
1150 
1152 {
1153  auto* filterList = new DTC::RecRuleFilterList();
1154 
1155  MSqlQuery query(MSqlQuery::InitCon());
1156 
1157  query.prepare("SELECT filterid, description, newruledefault "
1158  "FROM recordfilter ORDER BY filterid");
1159 
1160  if (query.exec())
1161  {
1162  while (query.next())
1163  {
1164  DTC::RecRuleFilter* ruleFilter = filterList->AddNewRecRuleFilter();
1165  ruleFilter->setId(query.value(0).toInt());
1166  ruleFilter->setDescription(QObject::tr(query.value(1).toString()
1167  .toUtf8().constData()));
1168  }
1169  }
1170 
1171  return filterList;
1172 }
1173 
1175 //
1177 
1178 QStringList Dvr::GetTitleList(const QString& RecGroup)
1179 {
1180  MSqlQuery query(MSqlQuery::InitCon());
1181 
1182  QString querystr = "SELECT DISTINCT title FROM recorded "
1183  "WHERE deletepending = 0";
1184 
1185  if (!RecGroup.isEmpty())
1186  querystr += " AND recgroup = :RECGROUP";
1187  else
1188  querystr += " AND recgroup != 'Deleted'";
1189 
1190  querystr += " ORDER BY title";
1191 
1192  query.prepare(querystr);
1193 
1194  if (!RecGroup.isEmpty())
1195  query.bindValue(":RECGROUP", RecGroup);
1196 
1197  QStringList result;
1198  if (!query.exec())
1199  {
1200  MythDB::DBError("GetTitleList recorded", query);
1201  return result;
1202  }
1203 
1204  while (query.next())
1205  result << query.value(0).toString();
1206 
1207  return result;
1208 }
1209 
1211 //
1213 
1215 {
1216  MSqlQuery query(MSqlQuery::InitCon());
1217 
1218  QString querystr = QString(
1219  "SELECT title, inetref, count(title) as count "
1220  " FROM recorded AS r "
1221  " JOIN recgroups AS g ON r.recgroupid = g.recgroupid "
1222  " WHERE g.recgroup NOT IN ('Deleted', 'LiveTV') "
1223  " AND r.deletepending = 0 "
1224  " GROUP BY title, inetref "
1225  " ORDER BY title");
1226 
1227  query.prepare(querystr);
1228 
1229  auto *pTitleInfos = new DTC::TitleInfoList();
1230  if (!query.exec())
1231  {
1232  MythDB::DBError("GetTitleList recorded", query);
1233  return pTitleInfos;
1234  }
1235 
1236  while (query.next())
1237  {
1238  DTC::TitleInfo *pTitleInfo = pTitleInfos->AddNewTitleInfo();
1239 
1240  pTitleInfo->setTitle(query.value(0).toString());
1241  pTitleInfo->setInetref(query.value(1).toString());
1242  pTitleInfo->setCount(query.value(2).toInt());
1243  }
1244 
1245  return pTitleInfos;
1246 }
1247 
1249 //
1251 
1253  int nCount,
1254  bool bShowAll,
1255  int nRecordId,
1256  int nRecStatus )
1257 {
1258  RecordingList recordingList; // Auto-delete deque
1259  RecList tmpList; // Standard deque, objects must be deleted
1260 
1261  if (nRecordId <= 0)
1262  nRecordId = -1;
1263 
1264  // NOTE: Fetching this information directly from the schedule is
1265  // significantly faster than using ProgramInfo::LoadFromScheduler()
1266  auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
1267  if (scheduler)
1268  scheduler->GetAllPending(tmpList, nRecordId);
1269 
1270  // Sort the upcoming into only those which will record
1271  // NOLINTNEXTLINE(modernize-loop-convert)
1272  for (auto it = tmpList.begin(); it < tmpList.end(); ++it)
1273  {
1274  if ((nRecStatus != 0) &&
1275  ((*it)->GetRecordingStatus() != nRecStatus))
1276  {
1277  delete *it;
1278  *it = nullptr;
1279  continue;
1280  }
1281 
1282  if (!bShowAll && ((((*it)->GetRecordingStatus() >= RecStatus::Pending) &&
1283  ((*it)->GetRecordingStatus() <= RecStatus::WillRecord)) ||
1284  ((*it)->GetRecordingStatus() == RecStatus::Recorded) ||
1285  ((*it)->GetRecordingStatus() == RecStatus::Conflict)) &&
1286  ((*it)->GetRecordingEndTime() > MythDate::current()))
1287  { // NOLINT(bugprone-branch-clone)
1288  recordingList.push_back(new RecordingInfo(**it));
1289  }
1290  else if (bShowAll &&
1291  ((*it)->GetRecordingEndTime() > MythDate::current()))
1292  {
1293  recordingList.push_back(new RecordingInfo(**it));
1294  }
1295 
1296  delete *it;
1297  *it = nullptr;
1298  }
1299 
1300  // ----------------------------------------------------------------------
1301  // Build Response
1302  // ----------------------------------------------------------------------
1303 
1304  auto *pPrograms = new DTC::ProgramList();
1305 
1306  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, (int)recordingList.size() ) : 0;
1307  nCount = (nCount > 0) ? std::min( nCount, (int)recordingList.size() ) : recordingList.size();
1308  int nEndIndex = std::min((nStartIndex + nCount), (int)recordingList.size() );
1309 
1310  for( int n = nStartIndex; n < nEndIndex; n++)
1311  {
1312  ProgramInfo *pInfo = recordingList[ n ];
1313 
1314  DTC::Program *pProgram = pPrograms->AddNewProgram();
1315 
1316  FillProgramInfo( pProgram, pInfo, true );
1317  }
1318 
1319  // ----------------------------------------------------------------------
1320 
1321  pPrograms->setStartIndex ( nStartIndex );
1322  pPrograms->setCount ( nCount );
1323  pPrograms->setTotalAvailable( recordingList.size() );
1324  pPrograms->setAsOf ( MythDate::current() );
1325  pPrograms->setVersion ( MYTH_BINARY_VERSION );
1326  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
1327 
1328  return pPrograms;
1329 }
1330 
1332 //
1334 
1336  int nCount,
1337  int nRecordId )
1338 {
1339  RecordingList recordingList; // Auto-delete deque
1340  RecList tmpList; // Standard deque, objects must be deleted
1341 
1342  if (nRecordId <= 0)
1343  nRecordId = -1;
1344 
1345  // NOTE: Fetching this information directly from the schedule is
1346  // significantly faster than using ProgramInfo::LoadFromScheduler()
1347  auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
1348  if (scheduler)
1349  scheduler->GetAllPending(tmpList, nRecordId);
1350 
1351  // Sort the upcoming into only those which are conflicts
1352  // NOLINTNEXTLINE(modernize-loop-convert)
1353  for (auto it = tmpList.begin(); it < tmpList.end(); ++it)
1354  {
1355  if (((*it)->GetRecordingStatus() == RecStatus::Conflict) &&
1356  ((*it)->GetRecordingStartTime() >= MythDate::current()))
1357  {
1358  recordingList.push_back(new RecordingInfo(**it));
1359  }
1360  delete *it;
1361  *it = nullptr;
1362  }
1363 
1364  // ----------------------------------------------------------------------
1365  // Build Response
1366  // ----------------------------------------------------------------------
1367 
1368  auto *pPrograms = new DTC::ProgramList();
1369 
1370  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, (int)recordingList.size() ) : 0;
1371  nCount = (nCount > 0) ? std::min( nCount, (int)recordingList.size() ) : recordingList.size();
1372  int nEndIndex = std::min((nStartIndex + nCount), (int)recordingList.size() );
1373 
1374  for( int n = nStartIndex; n < nEndIndex; n++)
1375  {
1376  ProgramInfo *pInfo = recordingList[ n ];
1377 
1378  DTC::Program *pProgram = pPrograms->AddNewProgram();
1379 
1380  FillProgramInfo( pProgram, pInfo, true );
1381  }
1382 
1383  // ----------------------------------------------------------------------
1384 
1385  pPrograms->setStartIndex ( nStartIndex );
1386  pPrograms->setCount ( nCount );
1387  pPrograms->setTotalAvailable( recordingList.size() );
1388  pPrograms->setAsOf ( MythDate::current() );
1389  pPrograms->setVersion ( MYTH_BINARY_VERSION );
1390  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
1391 
1392  return pPrograms;
1393 }
1394 
1396  const QString& sTitle,
1397  const QString& sSubtitle,
1398  const QString& sDescription,
1399  const QString& sCategory,
1400  const QDateTime& recstarttsRaw,
1401  const QDateTime& recendtsRaw,
1402  const QString& sSeriesId,
1403  const QString& sProgramId,
1404  int nChanId,
1405  const QString& sStation,
1406  int nFindDay,
1407  QTime tFindTime,
1408  int nParentId,
1409  bool bInactive,
1410  uint nSeason,
1411  uint nEpisode,
1412  const QString& sInetref,
1413  QString sType,
1414  QString sSearchType,
1415  int nRecPriority,
1416  uint nPreferredInput,
1417  int nStartOffset,
1418  int nEndOffset,
1419  const QDateTime& lastrectsRaw,
1420  QString sDupMethod,
1421  QString sDupIn,
1422  bool bNewEpisOnly,
1423  uint nFilter,
1424  QString sRecProfile,
1425  QString sRecGroup,
1426  QString sStorageGroup,
1427  QString sPlayGroup,
1428  bool bAutoExpire,
1429  int nMaxEpisodes,
1430  bool bMaxNewest,
1431  bool bAutoCommflag,
1432  bool bAutoTranscode,
1433  bool bAutoMetaLookup,
1434  bool bAutoUserJob1,
1435  bool bAutoUserJob2,
1436  bool bAutoUserJob3,
1437  bool bAutoUserJob4,
1438  int nTranscoder)
1439 {
1440  QDateTime recstartts = recstarttsRaw.toUTC();
1441  QDateTime recendts = recendtsRaw.toUTC();
1442  QDateTime lastrects = lastrectsRaw.toUTC();
1443  RecordingRule rule;
1444  rule.LoadTemplate("Default");
1445 
1446  if (sType.isEmpty())
1447  sType = "single";
1448 
1449  if (sSearchType.isEmpty())
1450  sSearchType = "none";
1451 
1452  if (sDupMethod.isEmpty())
1453  sDupMethod = "subtitleanddescription";
1454 
1455  if (sDupIn.isEmpty())
1456  sDupIn = "all";
1457 
1458  rule.m_title = sTitle;
1459  rule.m_subtitle = sSubtitle;
1460  rule.m_description = sDescription;
1461 
1462  rule.m_startdate = recstartts.date();
1463  rule.m_starttime = recstartts.time();
1464  rule.m_enddate = recendts.date();
1465  rule.m_endtime = recendts.time();
1466 
1467  rule.m_type = recTypeFromString(sType);
1468  rule.m_searchType = searchTypeFromString(sSearchType);
1469  if (rule.m_searchType == kManualSearch)
1470  rule.m_dupMethod = kDupCheckNone;
1471  else
1472  rule.m_dupMethod = dupMethodFromString(sDupMethod);
1473  rule.m_dupIn = dupInFromStringAndBool(sDupIn, bNewEpisOnly);
1474 
1475  if (sRecProfile.isEmpty())
1476  sRecProfile = "Default";
1477 
1478  if (sRecGroup.isEmpty())
1479  sRecGroup = "Default";
1480 
1481  if (sStorageGroup.isEmpty())
1482  sStorageGroup = "Default";
1483 
1484  if (sPlayGroup.isEmpty())
1485  sPlayGroup = "Default";
1486 
1487  rule.m_category = sCategory;
1488  rule.m_seriesid = sSeriesId;
1489  rule.m_programid = sProgramId;
1490 
1491  rule.m_channelid = nChanId;
1492  rule.m_station = sStation;
1493 
1494  rule.m_findday = nFindDay;
1495  rule.m_findtime = tFindTime;
1496 
1497  rule.m_recProfile = sRecProfile;
1498  rule.m_recGroupID = RecordingInfo::GetRecgroupID(sRecGroup);
1499  if (rule.m_recGroupID == 0)
1500  {
1501  rule.m_recGroupID = CreateRecordingGroup(sRecGroup);
1502  if (rule.m_recGroupID <= 0)
1504  }
1505  rule.m_storageGroup = sStorageGroup;
1506  rule.m_playGroup = sPlayGroup;
1507 
1508  rule.m_parentRecID = nParentId;
1509  rule.m_isInactive = bInactive;
1510 
1511  rule.m_season = nSeason;
1512  rule.m_episode = nEpisode;
1513  rule.m_inetref = sInetref;
1514 
1515  rule.m_recPriority = nRecPriority;
1516  rule.m_prefInput = nPreferredInput;
1517  rule.m_startOffset = nStartOffset;
1518  rule.m_endOffset = nEndOffset;
1519  rule.m_filter = nFilter;
1520 
1521  rule.m_autoExpire = bAutoExpire;
1522  rule.m_maxEpisodes = nMaxEpisodes;
1523  rule.m_maxNewest = bMaxNewest;
1524 
1525  rule.m_autoCommFlag = bAutoCommflag;
1526  rule.m_autoTranscode = bAutoTranscode;
1527  rule.m_autoMetadataLookup = bAutoMetaLookup;
1528 
1529  rule.m_autoUserJob1 = bAutoUserJob1;
1530  rule.m_autoUserJob2 = bAutoUserJob2;
1531  rule.m_autoUserJob3 = bAutoUserJob3;
1532  rule.m_autoUserJob4 = bAutoUserJob4;
1533 
1534  rule.m_transcoder = nTranscoder;
1535 
1536  rule.m_lastRecorded = lastrects;
1537 
1538  QString msg;
1539  if (!rule.IsValid(msg))
1540  throw QString(msg);
1541 
1542  rule.Save();
1543 
1544  uint recid = rule.m_recordID;
1545 
1546  return recid;
1547 }
1548 
1550  const QString& sTitle,
1551  const QString& sSubtitle,
1552  const QString& sDescription,
1553  const QString& sCategory,
1554  const QDateTime& dStartTimeRaw,
1555  const QDateTime& dEndTimeRaw,
1556  const QString& sSeriesId,
1557  const QString& sProgramId,
1558  int nChanId,
1559  const QString& sStation,
1560  int nFindDay,
1561  QTime tFindTime,
1562  bool bInactive,
1563  uint nSeason,
1564  uint nEpisode,
1565  const QString& sInetref,
1566  QString sType,
1567  QString sSearchType,
1568  int nRecPriority,
1569  uint nPreferredInput,
1570  int nStartOffset,
1571  int nEndOffset,
1572  QString sDupMethod,
1573  QString sDupIn,
1574  bool bNewEpisOnly,
1575  uint nFilter,
1576  QString sRecProfile,
1577  QString sRecGroup,
1578  QString sStorageGroup,
1579  QString sPlayGroup,
1580  bool bAutoExpire,
1581  int nMaxEpisodes,
1582  bool bMaxNewest,
1583  bool bAutoCommflag,
1584  bool bAutoTranscode,
1585  bool bAutoMetaLookup,
1586  bool bAutoUserJob1,
1587  bool bAutoUserJob2,
1588  bool bAutoUserJob3,
1589  bool bAutoUserJob4,
1590  int nTranscoder)
1591 {
1592  if (nRecordId == 0 )
1593  throw QString("Record ID is invalid.");
1594 
1595  RecordingRule pRule;
1596  pRule.m_recordID = nRecordId;
1597  pRule.Load();
1598 
1599  if (!pRule.IsLoaded())
1600  throw QString("Record ID does not exist.");
1601 
1602  QDateTime recstartts = dStartTimeRaw.toUTC();
1603  QDateTime recendts = dEndTimeRaw.toUTC();
1604 
1605  pRule.m_isInactive = bInactive;
1606  if (sType.isEmpty())
1607  sType = "single";
1608 
1609  if (sSearchType.isEmpty())
1610  sSearchType = "none";
1611 
1612  if (sDupMethod.isEmpty())
1613  sDupMethod = "subtitleanddescription";
1614 
1615  if (sDupIn.isEmpty())
1616  sDupIn = "all";
1617 
1618  pRule.m_type = recTypeFromString(sType);
1619  pRule.m_searchType = searchTypeFromString(sSearchType);
1620  if (pRule.m_searchType == kManualSearch)
1621  pRule.m_dupMethod = kDupCheckNone;
1622  else
1623  pRule.m_dupMethod = dupMethodFromString(sDupMethod);
1624  pRule.m_dupIn = dupInFromStringAndBool(sDupIn, bNewEpisOnly);
1625 
1626  if (sRecProfile.isEmpty())
1627  sRecProfile = "Default";
1628 
1629  if (sRecGroup.isEmpty())
1630  sRecGroup = "Default";
1631 
1632  if (sStorageGroup.isEmpty())
1633  sStorageGroup = "Default";
1634 
1635  if (sPlayGroup.isEmpty())
1636  sPlayGroup = "Default";
1637 
1638  if (!sTitle.isEmpty())
1639  pRule.m_title = sTitle;
1640 
1641  if (!sSubtitle.isEmpty())
1642  pRule.m_subtitle = sSubtitle;
1643 
1644  if(!sDescription.isEmpty())
1645  pRule.m_description = sDescription;
1646 
1647  if (!sCategory.isEmpty())
1648  pRule.m_category = sCategory;
1649 
1650  if (!sSeriesId.isEmpty())
1651  pRule.m_seriesid = sSeriesId;
1652 
1653  if (!sProgramId.isEmpty())
1654  pRule.m_programid = sProgramId;
1655 
1656  if (nChanId)
1657  pRule.m_channelid = nChanId;
1658  if (!sStation.isEmpty())
1659  pRule.m_station = sStation;
1660 
1661  pRule.m_startdate = recstartts.date();
1662  pRule.m_starttime = recstartts.time();
1663  pRule.m_enddate = recendts.date();
1664  pRule.m_endtime = recendts.time();
1665 
1666  pRule.m_findday = nFindDay;
1667  pRule.m_findtime = tFindTime;
1668 
1669  pRule.m_recProfile = sRecProfile;
1670  pRule.m_recGroupID = RecordingInfo::GetRecgroupID(sRecGroup);
1671  if (pRule.m_recGroupID == 0)
1672  {
1673  pRule.m_recGroupID = CreateRecordingGroup(sRecGroup);
1674  if (pRule.m_recGroupID <= 0)
1676  }
1677  pRule.m_storageGroup = sStorageGroup;
1678  pRule.m_playGroup = sPlayGroup;
1679 
1680  pRule.m_isInactive = bInactive;
1681 
1682  pRule.m_season = nSeason;
1683  pRule.m_episode = nEpisode;
1684  pRule.m_inetref = sInetref;
1685 
1686  pRule.m_recPriority = nRecPriority;
1687  pRule.m_prefInput = nPreferredInput;
1688  pRule.m_startOffset = nStartOffset;
1689  pRule.m_endOffset = nEndOffset;
1690  pRule.m_filter = nFilter;
1691 
1692  pRule.m_autoExpire = bAutoExpire;
1693  pRule.m_maxEpisodes = nMaxEpisodes;
1694  pRule.m_maxNewest = bMaxNewest;
1695 
1696  pRule.m_autoCommFlag = bAutoCommflag;
1697  pRule.m_autoTranscode = bAutoTranscode;
1698  pRule.m_autoMetadataLookup = bAutoMetaLookup;
1699 
1700  pRule.m_autoUserJob1 = bAutoUserJob1;
1701  pRule.m_autoUserJob2 = bAutoUserJob2;
1702  pRule.m_autoUserJob3 = bAutoUserJob3;
1703  pRule.m_autoUserJob4 = bAutoUserJob4;
1704 
1705  pRule.m_transcoder = nTranscoder;
1706 
1707  QString msg;
1708  if (!pRule.IsValid(msg))
1709  throw QString(msg);
1710 
1711  bool bResult = pRule.Save();
1712 
1713  return bResult;
1714 }
1715 
1717 {
1718  bool bResult = false;
1719 
1720  if (nRecordId == 0 )
1721  throw QString("Record ID does not exist.");
1722 
1723  RecordingRule pRule;
1724  pRule.m_recordID = nRecordId;
1725 
1726  bResult = pRule.Delete();
1727 
1728  return bResult;
1729 }
1730 
1731 bool Dvr::AddDontRecordSchedule(int nChanId, const QDateTime &dStartTime,
1732  bool bNeverRecord)
1733 {
1734  bool bResult = true;
1735 
1736  if (nChanId <= 0 || !dStartTime.isValid())
1737  throw QString("Program does not exist.");
1738 
1739  ProgramInfo *pi = LoadProgramFromProgram(nChanId, dStartTime.toUTC());
1740 
1741  if (!pi)
1742  throw QString("Program does not exist.");
1743 
1744  // Why RecordingInfo instead of ProgramInfo? Good question ...
1745  RecordingInfo recInfo = RecordingInfo(*pi);
1746 
1747  delete pi;
1748 
1749  if (bNeverRecord)
1750  {
1751  recInfo.ApplyNeverRecord();
1752  }
1753  else
1755 
1756  return bResult;
1757 }
1758 
1760  int nCount,
1761  const QString &Sort,
1762  bool Descending )
1763 {
1765  if (Sort.toLower() == "lastrecorded")
1766  sortingColumn = Scheduler::kSortLastRecorded;
1767  else if (Sort.toLower() == "nextrecording")
1768  sortingColumn = Scheduler::kSortNextRecording;
1769  else if (Sort.toLower() == "title")
1770  sortingColumn = Scheduler::kSortTitle; // NOLINT(bugprone-branch-clone)
1771  else if (Sort.toLower() == "priority")
1772  sortingColumn = Scheduler::kSortPriority;
1773  else if (Sort.toLower() == "type")
1774  sortingColumn = Scheduler::kSortType;
1775  else
1776  sortingColumn = Scheduler::kSortTitle;
1777 
1778  RecList recList;
1779  Scheduler::GetAllScheduled(recList, sortingColumn, !Descending);
1780 
1781  // ----------------------------------------------------------------------
1782  // Build Response
1783  // ----------------------------------------------------------------------
1784 
1785  auto *pRecRules = new DTC::RecRuleList();
1786 
1787  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, (int)recList.size() ) : 0;
1788  nCount = (nCount > 0) ? std::min( nCount, (int)recList.size() ) : recList.size();
1789  int nEndIndex = std::min((nStartIndex + nCount), (int)recList.size() );
1790 
1791  for( int n = nStartIndex; n < nEndIndex; n++)
1792  {
1793  RecordingInfo *info = recList[n];
1794 
1795  if (info != nullptr)
1796  {
1797  DTC::RecRule *pRecRule = pRecRules->AddNewRecRule();
1798 
1799  FillRecRuleInfo( pRecRule, info->GetRecordingRule() );
1800  }
1801  }
1802 
1803  // ----------------------------------------------------------------------
1804 
1805  pRecRules->setStartIndex ( nStartIndex );
1806  pRecRules->setCount ( nCount );
1807  pRecRules->setTotalAvailable( recList.size() );
1808  pRecRules->setAsOf ( MythDate::current() );
1809  pRecRules->setVersion ( MYTH_BINARY_VERSION );
1810  pRecRules->setProtoVer ( MYTH_PROTO_VERSION );
1811 
1812  while (!recList.empty())
1813  {
1814  delete recList.back();
1815  recList.pop_back();
1816  }
1817 
1818  return pRecRules;
1819 }
1820 
1822  const QString& sTemplate,
1823  int nRecordedId,
1824  int nChanId,
1825  const QDateTime& dStartTimeRaw,
1826  bool bMakeOverride )
1827 {
1828  RecordingRule rule;
1829  QDateTime dStartTime = dStartTimeRaw.toUTC();
1830 
1831  if (nRecordId > 0)
1832  {
1833  rule.m_recordID = nRecordId;
1834  if (!rule.Load())
1835  throw QString("Record ID does not exist.");
1836  }
1837  else if (!sTemplate.isEmpty())
1838  {
1839  if (!rule.LoadTemplate(sTemplate))
1840  throw QString("Template does not exist.");
1841  }
1842  else if (nRecordedId > 0) // Loads from the Recorded/Recorded Program Table
1843  {
1844  // Despite the use of ProgramInfo, this only applies to Recordings.
1845  ProgramInfo recInfo(nRecordedId);
1846  if (!rule.LoadByProgram(&recInfo))
1847  throw QString("Recording does not exist");
1848  }
1849  else if (nChanId > 0 && dStartTime.isValid()) // Loads from Program Table, should NOT be used with recordings
1850  {
1851  // Despite the use of RecordingInfo, this only applies to programs in the
1852  // present or future, not to recordings? Confused yet?
1854  RecordingInfo info(nChanId, dStartTime, false, 0h, &status);
1855  if (status != RecordingInfo::kFoundProgram)
1856  throw QString("Program does not exist.");
1857  RecordingRule *pRule = info.GetRecordingRule();
1858  if (bMakeOverride && rule.m_type != kSingleRecord &&
1859  rule.m_type != kOverrideRecord && rule.m_type != kDontRecord)
1860  pRule->MakeOverride();
1861  rule = *pRule;
1862  }
1863  else
1864  {
1865  throw QString("Invalid request.");
1866  }
1867 
1868  auto *pRecRule = new DTC::RecRule();
1869  FillRecRuleInfo( pRecRule, &rule );
1870 
1871  return pRecRule;
1872 }
1873 
1875 {
1876  bool bResult = false;
1877 
1878  if (nRecordId == 0 )
1879  throw QString("Record ID appears invalid.");
1880 
1881  RecordingRule pRule;
1882  pRule.m_recordID = nRecordId;
1883  pRule.Load();
1884 
1885  if (pRule.IsLoaded())
1886  {
1887  pRule.m_isInactive = false;
1888  bResult = pRule.Save();
1889  }
1890 
1891  return bResult;
1892 }
1893 
1895 {
1896  bool bResult = false;
1897 
1898  if (nRecordId == 0 )
1899  throw QString("Record ID appears invalid.");
1900 
1901  RecordingRule pRule;
1902  pRule.m_recordID = nRecordId;
1903  pRule.Load();
1904 
1905  if (pRule.IsLoaded())
1906  {
1907  pRule.m_isInactive = true;
1908  bResult = pRule.Save();
1909  }
1910 
1911  return bResult;
1912 }
1913 
1914 int Dvr::RecordedIdForKey(int chanid, const QDateTime &recstarttsRaw)
1915 {
1916  int recordedid = 0;
1917 
1918  if (!RecordingInfo::QueryRecordedIdForKey(recordedid, chanid,
1919  recstarttsRaw))
1920  return -1;
1921 
1922  return recordedid;
1923 }
1924 
1925 int Dvr::RecordedIdForPathname(const QString & pathname)
1926 {
1927  uint recordedid = 0;
1928 
1929  if (!ProgramInfo::QueryRecordedIdFromPathname(pathname, recordedid))
1930  return -1;
1931 
1932  return recordedid;
1933 }
1934 
1936 {
1937  auto type = static_cast<RecStatus::Type>(RecStatus);
1938  return RecStatus::toString(type);
1939 }
1940 
1941 QString Dvr::RecStatusToDescription(int RecStatus, int recType,
1942  const QDateTime &StartTime)
1943 {
1944  //if (!StartTime.isValid())
1945  // throw QString("StartTime appears invalid.");
1946  auto recstatusType = static_cast<RecStatus::Type>(RecStatus);
1947  auto recordingType = static_cast<RecordingType>(recType);
1948  return RecStatus::toDescription(recstatusType, recordingType, StartTime);
1949 }
1950 
1951 QString Dvr::RecTypeToString(const QString& recType)
1952 {
1953  bool ok = false;
1954  auto enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1955  if (ok)
1956  return toString(enumType);
1957  // RecordingType type = static_cast<RecordingType>(recType);
1958  return toString(recTypeFromString(recType));
1959 }
1960 
1961 QString Dvr::RecTypeToDescription(const QString& recType)
1962 {
1963  bool ok = false;
1964  auto enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1965  if (ok)
1966  return toDescription(enumType);
1967  // RecordingType type = static_cast<RecordingType>(recType);
1968  return toDescription(recTypeFromString(recType));
1969 }
1970 
1971 QString Dvr::DupInToString(const QString& DupIn)
1972 {
1973  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1974  // return toString(type);
1975  return toString(dupInFromString(DupIn));
1976 }
1977 
1978 QString Dvr::DupInToDescription(const QString& DupIn)
1979 {
1980  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1981  //return toDescription(type);
1982  return toDescription(dupInFromString(DupIn));
1983 }
1984 
1985 QString Dvr::DupMethodToString(const QString& DupMethod)
1986 {
1987  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1988  return toString(dupMethodFromString(DupMethod));
1989 }
1990 
1991 QString Dvr::DupMethodToDescription(const QString& DupMethod)
1992 {
1993  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1994  return toDescription(dupMethodFromString(DupMethod));
1995 }
1996 
1998 //
2000 
2001 int Dvr::ManageJobQueue( const QString &sAction,
2002  const QString &sJobName,
2003  int nJobId,
2004  int nRecordedId,
2005  QDateTime jobstarttsRaw,
2006  QString sRemoteHost,
2007  QString sJobArgs )
2008 {
2009  int nReturn = -1;
2010 
2011  if (!m_parsedParams.contains("jobname") &&
2012  !m_parsedParams.contains("recordedid") )
2013  {
2014  LOG(VB_GENERAL, LOG_ERR, "JobName and RecordedId are required.");
2015  return nReturn;
2016  }
2017 
2018  if (sRemoteHost.isEmpty())
2019  sRemoteHost = gCoreContext->GetHostName();
2020 
2021  int jobType = JobQueue::GetJobTypeFromName(sJobName);
2022 
2023  if (jobType == JOB_NONE)
2024  return nReturn;
2025 
2026  RecordingInfo ri = RecordingInfo(nRecordedId);
2027 
2028  if (!ri.GetChanID())
2029  return nReturn;
2030 
2031  if ( sAction == "Remove")
2032  {
2033  if (!m_parsedParams.contains("jobid") || nJobId < 0)
2034  {
2035  LOG(VB_GENERAL, LOG_ERR, "For Remove, a valid JobId is required.");
2036  return nReturn;
2037  }
2038 
2039  if (!JobQueue::SafeDeleteJob(nJobId, jobType, ri.GetChanID(),
2040  ri.GetRecordingStartTime()))
2041  return nReturn;
2042 
2043  return nJobId;
2044  }
2045 
2046  if ( sAction != "Add")
2047  {
2048  LOG(VB_GENERAL, LOG_ERR, QString("Illegal Action name '%1'. Use: Add, "
2049  "or Remove").arg(sAction));
2050  return nReturn;
2051  }
2052 
2053  if (((jobType & JOB_USERJOB) != 0) &&
2054  gCoreContext->GetSetting(sJobName, "").isEmpty())
2055  {
2056  LOG(VB_GENERAL, LOG_ERR, QString("%1 hasn't been defined.")
2057  .arg(sJobName));
2058  return nReturn;
2059  }
2060 
2061  if (!gCoreContext->GetBoolSettingOnHost(QString("JobAllow%1").arg(sJobName),
2062  sRemoteHost, false))
2063  {
2064  LOG(VB_GENERAL, LOG_ERR, QString("%1 hasn't been allowed on host %2.")
2065  .arg(sJobName, sRemoteHost));
2066  return nReturn;
2067  }
2068 
2069  if (!jobstarttsRaw.isValid())
2070  jobstarttsRaw = QDateTime::currentDateTime();
2071 
2072  if (!JobQueue::InJobRunWindow(jobstarttsRaw))
2073  return nReturn;
2074 
2075  if (sJobArgs.isNull())
2076  sJobArgs = "";
2077 
2078  bool bReturn = JobQueue::QueueJob(jobType,
2079  ri.GetChanID(),
2080  ri.GetRecordingStartTime(),
2081  sJobArgs,
2082  QString("Dvr/ManageJobQueue"), // comment col.
2083  sRemoteHost,
2084  JOB_NO_FLAGS,
2085  JOB_QUEUED,
2086  jobstarttsRaw.toUTC());
2087 
2088  if (!bReturn)
2089  {
2090  LOG(VB_GENERAL, LOG_ERR, QString("%1 job wasn't queued because of a "
2091  "database error or because it was "
2092  "already running/stopping etc.")
2093  .arg(sJobName));
2094 
2095  return nReturn;
2096  }
2097 
2098  return JobQueue::GetJobID(jobType, ri.GetChanID(),
2099  ri.GetRecordingStartTime());
2100 }
StorageGroup::getRecordingsGroups
static QStringList getRecordingsGroups(void)
Definition: storagegroup.cpp:789
serviceUtil.h
RecordingInfo::GetRecgroupID
static uint GetRecgroupID(const QString &recGroup)
Temporary helper during transition from string to ID.
Definition: recordinginfo.cpp:1639
RecordingRule::m_channelid
int m_channelid
callsign?
Definition: recordingrule.h:97
Dvr::DupMethodToDescription
QString DupMethodToDescription(const QString &DupMethod) override
Definition: dvr.cpp:1991
RecordingRule::LoadTemplate
bool LoadTemplate(const QString &category, const QString &categoryType="Default")
Definition: recordingrule.cpp:273
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:98
Scheduler
Definition: scheduler.h:45
RecordingRule::LoadByProgram
bool LoadByProgram(const ProgramInfo *proginfo)
Definition: recordingrule.cpp:168
Scheduler::kSortNextRecording
@ kSortNextRecording
Definition: scheduler.h:86
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:807
RecStatus::Type
Type
Definition: recStatus.h:16
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
Dvr::SetRecordedMarkup
bool SetRecordedMarkup(int RecordedId, const QJsonObject &json) override
Definition: dvr.cpp:897
RecordingRule::m_autoTranscode
bool m_autoTranscode
Definition: recordingrule.h:130
mythevent.h
FillProgramInfo
void FillProgramInfo(DTC::Program *pProgram, ProgramInfo *pInfo, bool bIncChannel, bool bDetails, bool bIncCast)
Definition: serviceUtil.cpp:47
RecordingRule::m_enddate
QDate m_enddate
Definition: recordingrule.h:88
Dvr::GetRecordSchedule
DTC::RecRule * GetRecordSchedule(uint RecordId, const QString &Template, int nRecordedId, int ChanId, const QDateTime &dStartTimeRaw, bool MakeOverride) override
Definition: dvr.cpp:1821
RecordingInfo::kDefaultRecGroup
@ kDefaultRecGroup
Definition: recordinginfo.h:191
RecordingRule::m_playGroup
QString m_playGroup
Definition: recordingrule.h:120
RecordingRule::m_seriesid
QString m_seriesid
Definition: recordingrule.h:82
RecordingRule::m_parentRecID
int m_parentRecID
Definition: recordingrule.h:69
COMM_FLAG_NOT_FLAGGED
@ COMM_FLAG_NOT_FLAGGED
Definition: programtypes.h:122
Dvr::GetRecordedMarkup
DTC::MarkupList * GetRecordedMarkup(int RecordedId) override
Definition: dvr.cpp:852
RecordingInfo::QueryRecordedIdForKey
static bool QueryRecordedIdForKey(int &recordedid, uint chanid, const QDateTime &recstartts)
Definition: recordinginfo.cpp:895
FillRecRuleInfo
void FillRecRuleInfo(DTC::RecRule *pRecRule, RecordingRule *pRule)
Definition: serviceUtil.cpp:277
RecordingInfo::ApplyNeverRecord
void ApplyNeverRecord(void)
Set this program to never be recorded by inserting 'history' for it into the database with a status o...
Definition: recordinginfo.cpp:858
backendcontext.h
Dvr::GetRecRuleFilterList
DTC::RecRuleFilterList * GetRecRuleFilterList() override
Definition: dvr.cpp:1151
RecordingRule::m_description
QString m_description
Definition: recordingrule.h:79
RecordingRule::m_autoCommFlag
bool m_autoCommFlag
Definition: recordingrule.h:129
RecordingRule::m_inetref
QString m_inetref
Definition: recordingrule.h:85
RecordingInfo::kFoundProgram
@ kFoundProgram
Definition: recordinginfo.h:182
ProgramInfo::SaveBookmark
void SaveBookmark(uint64_t frame)
Clears any existing bookmark in DB and if frame is greater than 0 sets a new bookmark.
Definition: programinfo.cpp:2679
ProgramInfo::SetRecordingStatus
void SetRecordingStatus(RecStatus::Type status)
Definition: programinfo.h:582
Dvr::RecStatusToDescription
QString RecStatusToDescription(int RecStatus, int RecType, const QDateTime &StartTime) override
Definition: dvr.cpp:1941
MythCoreContext::GetScheduler
MythScheduler * GetScheduler(void)
Definition: mythcorecontext.cpp:1917
Dvr::AddRecordedProgram
int AddRecordedProgram(const QJsonObject &json) override
Definition: dvr.cpp:337
RecordingRule::m_maxNewest
bool m_maxNewest
Definition: recordingrule.h:125
LoadProgramFromProgram
ProgramInfo * LoadProgramFromProgram(const uint chanid, const QDateTime &starttime)
Definition: programinfo.cpp:5792
RecordingRule::m_category
QString m_category
Definition: recordingrule.h:80
RecordingRule::Save
bool Save(bool sendSig=true)
Definition: recordingrule.cpp:382
DTC::Program
Definition: programAndChannel.h:145
JobQueue::QueueJob
static bool QueueJob(int jobType, uint chanid, const QDateTime &recstartts, const QString &args="", const QString &comment="", QString host="", int flags=0, int status=JOB_QUEUED, QDateTime schedruntime=QDateTime())
Definition: jobqueue.cpp:522
RecordingRule::m_starttime
QTime m_starttime
Definition: recordingrule.h:89
RecordingInfo::ApplyRecordStateChange
void ApplyRecordStateChange(RecordingType newstate, bool save=true)
Sets RecordingType of "record", creating "record" if it does not exist.
Definition: recordinginfo.cpp:573
Scheduler::kSortPriority
@ kSortPriority
Definition: scheduler.h:87
searchTypeFromString
RecSearchType searchTypeFromString(const QString &type)
Definition: recordingtypes.cpp:329
Dvr::GetProgramCategories
QStringList GetProgramCategories(bool OnlyRecorded) override
Definition: dvr.cpp:1107
dupInFromString
RecordingDupInType dupInFromString(const QString &type)
Definition: recordingtypes.cpp:216
Scheduler::GetAllScheduled
static void GetAllScheduled(QStringList &strList, SchedSortColumn sortBy=kSortTitle, bool ascending=true)
Returns all scheduled programs serialized into a QStringList.
Definition: scheduler.cpp:1843
RecordingInfo
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:35
gExpirer
AutoExpire * gExpirer
Definition: backendcontext.cpp:8
RecordingInfo::ForgetHistory
void ForgetHistory(void)
Forget the recording of a program so it will be recorded again.
Definition: recordinginfo.cpp:1412
ProgramInfo::QueryMarkup
void QueryMarkup(QVector< MarkupEntry > &mapMark, QVector< MarkupEntry > &mapSeek) const
Definition: programinfo.cpp:4564
programdata.h
ProgramInfo::GetRecordingID
uint GetRecordingID(void) const
Definition: programinfo.h:446
DTC::Encoder::AddNewInput
Input * AddNewInput()
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:90
Dvr::AllowReRecord
bool AllowReRecord(int RecordedId) override
Definition: dvr.cpp:631
Dvr::GetTitleInfoList
DTC::TitleInfoList * GetTitleInfoList() override
Definition: dvr.cpp:1214
MythEvent
This class is used as a container for messages.
Definition: mythevent.h:16
RecordingRule::m_title
QString m_title
Definition: recordingrule.h:75
JOB_COMMFLAG
@ JOB_COMMFLAG
Definition: jobqueue.h:77
Dvr::GetOldRecordedList
DTC::ProgramList * GetOldRecordedList(bool Descending, int StartIndex, int Count, const QDateTime &StartTime, const QDateTime &EndTime, const QString &Title, const QString &SeriesId, int RecordId, const QString &Sort) override
Definition: dvr.cpp:167
ProgramInfo::QueryJobsRunning
static QMap< QString, bool > QueryJobsRunning(int type)
Definition: programinfo.cpp:5477
ProgramInfo::QueryPositionKeyFrame
bool QueryPositionKeyFrame(uint64_t *keyframe, uint64_t position, bool backwards) const
Definition: programinfo.cpp:4192
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:202
DTC::TitleInfoList
Definition: titleInfoList.h:24
JOB_NONE
@ JOB_NONE
Definition: jobqueue.h:73
RecordingRule
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:28
JobQueue::SafeDeleteJob
static bool SafeDeleteJob(int jobID, int jobType, int chanid, const QDateTime &recstartts)
Definition: jobqueue.cpp:885
RecordingDupMethodType
RecordingDupMethodType
Definition: recordingtypes.h:57
RecordingRule::m_endOffset
int m_endOffset
Definition: recordingrule.h:108
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:608
ProgramInfo::SaveCommFlagged
void SaveCommFlagged(CommFlagStatus flag)
Set "commflagged" field in "recorded" table to "flag".
Definition: programinfo.cpp:3343
RecStatus::Recorded
@ Recorded
Definition: recStatus.h:29
DTC::Encoder::Recording
QObject Recording
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:43
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
playgroup.h
ProgramInfo::QueryKeyFrameDuration
bool QueryKeyFrameDuration(uint64_t *duration, uint64_t keyframe, bool backwards) const
Definition: programinfo.cpp:4219
Dvr::GetInputList
DTC::InputList * GetInputList() override
Definition: dvr.cpp:1066
LoadFromRecorded
bool LoadFromRecorded(ProgramList &destination, bool possiblyInProgressRecordingsOnly, const QMap< QString, uint32_t > &inUseMap, const QMap< QString, bool > &isJobRunning, const QMap< QString, ProgramInfo * > &recMap, int sort, const QString &sortBy, bool ignoreLiveTV, bool ignoreDeleted)
Definition: programinfo.cpp:5994
AutoExpire::GetAllExpiring
void GetAllExpiring(QStringList &strList)
Gets the full list of programs that can expire in expiration order.
Definition: autoexpire.cpp:827
DTC::RecRuleFilterList
Definition: recRuleFilterList.h:16
Dvr::GetRecordedSeek
DTC::CutList * GetRecordedSeek(int RecordedId, const QString &OffsetType) override
Definition: dvr.cpp:822
RecordingRule::IsLoaded
bool IsLoaded() const
Definition: recordingrule.h:53
recordingtypes.h
RecordingRule::m_dupIn
RecordingDupInType m_dupIn
Definition: recordingrule.h:112
Dvr::RecordedIdForPathname
int RecordedIdForPathname(const QString &pathname) override
Definition: dvr.cpp:1925
RecordingRule::m_isInactive
bool m_isInactive
Recording rule is enabled?
Definition: recordingrule.h:72
Dvr::RecTypeToString
QString RecTypeToString(const QString &RecType) override
Definition: dvr.cpp:1951
RecordingRule::m_season
uint m_season
Definition: recordingrule.h:92
remoteutil.h
Dvr::GetExpiringList
DTC::ProgramList * GetExpiringList(int StartIndex, int Count) override
Definition: dvr.cpp:953
Dvr::DupMethodToString
QString DupMethodToString(const QString &DupMethod) override
Definition: dvr.cpp:1985
scheduler.h
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:15
Dvr::GetRecordScheduleList
DTC::RecRuleList * GetRecordScheduleList(int StartIndex, int Count, const QString &Sort, bool Descending) override
Definition: dvr.cpp:1759
ProgramInfo::GetRecordingStartTime
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
Definition: programinfo.h:404
ProgramInfo::IsWatched
bool IsWatched(void) const
Definition: programinfo.h:484
mythversion.h
programtypes.h
DBCredits
std::vector< DBPerson > DBCredits
Definition: programdata.h:73
JobQueue::InJobRunWindow
static bool InJobRunWindow(QDateTime jobstarttsRaw)
Definition: jobqueue.cpp:1659
ProgramInfo::IsPreserved
bool IsPreserved(void) const
Definition: programinfo.h:486
string_to_myth_category_type
ProgramInfo::CategoryType string_to_myth_category_type(const QString &category_type)
Definition: programinfo.cpp:136
ProgramInfo::QueryBookmark
uint64_t QueryBookmark(void) const
Gets any bookmark position in database, unless the ignore bookmark flag is set.
Definition: programinfo.cpp:2803
PlayGroup::GetNames
static QStringList GetNames(void)
Definition: playgroup.cpp:206
COMM_FLAG_DONE
@ COMM_FLAG_DONE
Definition: programtypes.h:123
kState_WatchingRecording
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...
Definition: tv.h:80
MythScheduler::GetRecording
virtual QMap< QString, ProgramInfo * > GetRecording(void) const =0
RecStatus::WillRecord
@ WillRecord
Definition: recStatus.h:31
Dvr::RecStatusToString
QString RecStatusToString(int RecStatus) override
Definition: dvr.cpp:1935
RecordingRule::Load
bool Load(bool asTemplate=false)
Load a single rule from the recorded table.
Definition: recordingrule.cpp:56
RecordingRule::m_startOffset
int m_startOffset
Definition: recordingrule.h:107
kDisableAutoExpire
@ kDisableAutoExpire
Definition: programtypes.h:195
RecordingDupInType
RecordingDupInType
Definition: recordingtypes.h:42
toString
QString toString(MarkTypes type)
Definition: programtypes.cpp:29
RecordingRule::m_episode
uint m_episode
Definition: recordingrule.h:93
mythdate.h
autoexpire.h
ProgramInfo::MarkupEntry::type
int type
Definition: programinfo.h:696
Dvr::StopRecording
bool StopRecording(int RecordedId) override
Definition: dvr.cpp:568
programinfo.h
CardUtil::GetAllInputInfo
static QList< InputInfo > GetAllInputInfo()
Definition: cardutil.cpp:1662
ProgramInfo::GetScheduledStartTime
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
Definition: programinfo.h:390
ProgramInfo::QueryRecordedIdFromPathname
static bool QueryRecordedIdFromPathname(const QString &pathname, uint &recordedid)
Definition: programinfo.cpp:1232
RecordingRule::IsValid
bool IsValid(QString &msg) const
Definition: recordingrule.cpp:849
kNormalAutoExpire
@ kNormalAutoExpire
Definition: programtypes.h:196
Dvr::GetRecordedCutList
DTC::CutList * GetRecordedCutList(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, const QString &OffsetType) override
Definition: dvr.cpp:756
RecordingRule::m_autoUserJob4
bool m_autoUserJob4
Definition: recordingrule.h:134
Dvr::GetEncoderList
DTC::EncoderList * GetEncoderList() override
Definition: dvr.cpp:1001
DTC::Input
Definition: input.h:24
Scheduler::kSortType
@ kSortType
Definition: scheduler.h:87
MARK_DURATION_MS
@ MARK_DURATION_MS
Definition: programtypes.h:75
ProgramInfo::MarkupEntry::data
uint64_t data
Definition: programinfo.h:698
RecStatus::toDescription
static QString toDescription(Type recstatus, RecordingType rectype, const QDateTime &recstartts)
Converts "recstatus" into a long human readable description.
Definition: recStatus.cpp:187
Dvr::RescheduleRecordings
bool RescheduleRecordings(void) override
Definition: dvr.cpp:620
FillCutList
void FillCutList(DTC::CutList *pCutList, RecordingInfo *rInfo, int marktype)
Definition: serviceUtil.cpp:640
Dvr::GetRecorded
DTC::Program * GetRecorded(int RecordedId, int ChanId, const QDateTime &recstarttsRaw) override
Definition: dvr.cpp:284
DTC::Markup
Definition: markup.h:26
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:540
DTC::RecRuleList
Definition: recRuleList.h:15
compat.h
RecordingRule::m_autoUserJob2
bool m_autoUserJob2
Definition: recordingrule.h:132
Dvr::UnDeleteRecording
bool UnDeleteRecording(int RecordedId, int ChanId, const QDateTime &recstarttsRaw) override
Definition: dvr.cpp:537
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:227
Scheduler::kSortLastRecorded
@ kSortLastRecorded
Definition: scheduler.h:86
RecordingRule::m_findtime
QTime m_findtime
Time for timeslot rules.
Definition: recordingrule.h:99
dupMethodFromString
RecordingDupMethodType dupMethodFromString(const QString &type)
Definition: recordingtypes.cpp:293
RecordingRule::m_lastRecorded
QDateTime m_lastRecorded
Definition: recordingrule.h:141
RecordingRule::m_autoExpire
bool m_autoExpire
Definition: recordingrule.h:124
markTypeFromString
MarkTypes markTypeFromString(const QString &str)
Definition: programtypes.cpp:68
RecordingRule::m_recProfile
QString m_recProfile
Definition: recordingrule.h:118
RecordingRule::m_searchType
RecSearchType m_searchType
Definition: recordingrule.h:110
pginfolist_t
std::vector< ProgramInfo * > pginfolist_t
Definition: autoexpire.h:24
recTypeFromString
RecordingType recTypeFromString(const QString &type)
Definition: recordingtypes.cpp:101
RecordingRule::m_type
RecordingType m_type
Definition: recordingrule.h:109
Scheduler::kSortTitle
@ kSortTitle
Definition: scheduler.h:86
RecStatus::Conflict
@ Conflict
Definition: recStatus.h:39
FillSeek
void FillSeek(DTC::CutList *pCutList, RecordingInfo *rInfo, MarkTypes marktype)
Definition: serviceUtil.cpp:732
Dvr::RemoveRecorded
bool RemoveRecorded(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, bool ForceDelete, bool AllowRerecord) override
Definition: dvr.cpp:493
Dvr::UpdateRecordSchedule
bool UpdateRecordSchedule(uint RecordId, const QString &Title, const QString &Subtitle, const QString &Description, const QString &Category, const QDateTime &dStartTimeRaw, const QDateTime &dEndTimeRaw, const QString &SeriesId, const QString &ProgramId, int ChanId, const QString &Station, int FindDay, QTime FindTime, bool Inactive, uint Season, uint Episode, const QString &Inetref, QString Type, QString SearchType, int RecPriority, uint PreferredInput, int StartOffset, int EndOffset, QString DupMethod, QString DupIn, bool NewEpisOnly, 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) override
Definition: dvr.cpp:1549
RecordingRule::m_subtitle
QString m_subtitle
Definition: recordingrule.h:77
dupInFromStringAndBool
RecordingDupInType dupInFromStringAndBool(const QString &type, bool newEpisodesOnly)
Definition: recordingtypes.cpp:229
ProgramInfo::MarkupEntry
Definition: programinfo.h:694
Dvr::UpdateRecordedWatchedStatus
bool UpdateRecordedWatchedStatus(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, bool Watched) override
Definition: dvr.cpp:650
Dvr::GetPlayGroupList
QStringList GetPlayGroupList() override
Definition: dvr.cpp:1142
Service::m_parsedParams
QList< QString > m_parsedParams
Definition: service.h:67
storagegroup.h
jobqueue.h
RecordingRule::m_findday
int m_findday
Day of the week for once per week etc.
Definition: recordingrule.h:102
Dvr::AddRecordedCredits
bool AddRecordedCredits(int RecordedId, const QJsonObject &json) override
Definition: dvr.cpp:308
Scheduler::SchedSortColumn
SchedSortColumn
Definition: scheduler.h:86
RecordingRule::m_filter
unsigned m_filter
Definition: recordingrule.h:113
RecordingInfo::ReactivateRecording
void ReactivateRecording(void)
Asks the scheduler to restart this recording if possible.
Definition: recordinginfo.cpp:1282
TVRec::s_inputsLock
static QReadWriteLock s_inputsLock
Definition: tv_rec.h:432
kManualSearch
@ kManualSearch
Definition: recordingtypes.h:78
uint
unsigned int uint
Definition: compat.h:79
ProgramInfo::ProgramFlagsFromNames
void ProgramFlagsFromNames(const QString &names)
Definition: programinfo.cpp:1548
gTVList
QMap< int, EncoderLink * > gTVList
Definition: backendcontext.cpp:7
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:61
DTC::InputList
Definition: inputList.h:24
Dvr::DeleteRecording
bool DeleteRecording(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, bool ForceDelete, bool AllowRerecord) override
Definition: dvr.cpp:502
toDescription
QString toDescription(RecordingType rectype)
Converts "rectype" into a human readable description.
Definition: recordingtypes.cpp:50
dvr.h
RecordingInfo::LoadStatus
LoadStatus
Definition: recordinginfo.h:180
Dvr::RecordedIdForKey
int RecordedIdForKey(int ChanId, const QDateTime &recstarttsRaw) override
Definition: dvr.cpp:1914
RecordingInfo::kNoProgram
@ kNoProgram
Definition: recordinginfo.h:181
RecordingRule::m_maxEpisodes
int m_maxEpisodes
Definition: recordingrule.h:123
ProgramInfo::AudioPropertiesFromNames
static uint AudioPropertiesFromNames(const QString &names)
Definition: programinfo.cpp:1543
RecordingRule::m_programid
QString m_programid
Definition: recordingrule.h:83
ProgramInfo::SaveAutoExpire
void SaveAutoExpire(AutoExpireType autoExpire, bool updateDelete=false)
Set "autoexpire" field in "recorded" table to "autoExpire".
Definition: programinfo.cpp:3396
channelutil.h
ProgramInfo::SubtitleTypesFromNames
static uint SubtitleTypesFromNames(const QString &names)
Definition: programinfo.cpp:1533
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:35
Dvr::GetRecStorageGroupList
QStringList GetRecStorageGroupList() override
Definition: dvr.cpp:1133
RecStatus::Pending
@ Pending
Definition: recStatus.h:17
RecordingRule::m_recGroupID
uint m_recGroupID
Definition: recordingrule.h:121
RecordingRule::m_endtime
QTime m_endtime
Definition: recordingrule.h:90
Dvr::AddDontRecordSchedule
bool AddDontRecordSchedule(int ChanId, const QDateTime &StartTime, bool NeverRecord) override
Definition: dvr.cpp:1731
AutoDeleteDeque< ProgramInfo * >
Dvr::GetUpcomingList
DTC::ProgramList * GetUpcomingList(int StartIndex, int Count, bool ShowAll, int RecordId, int RecStatus) override
Definition: dvr.cpp:1252
MYTH_BINARY_VERSION
#define MYTH_BINARY_VERSION
Update this whenever the plug-in ABI changes.
Definition: mythversion.h:15
ProgramList
AutoDeleteDeque< ProgramInfo * > ProgramList
Definition: programinfo.h:31
recordinginfo.h
Dvr::RecTypeToDescription
QString RecTypeToDescription(const QString &RecType) override
Definition: dvr.cpp:1961
MYTH_PROTO_VERSION
#define MYTH_PROTO_VERSION
Increment this whenever the MythTV network protocol changes.
Definition: mythversion.h:47
RecordingRule::m_storageGroup
QString m_storageGroup
Definition: recordingrule.h:119
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:372
RecordingRule::m_transcoder
int m_transcoder
Definition: recordingrule.h:128
RecordingRule::m_autoUserJob1
bool m_autoUserJob1
Definition: recordingrule.h:131
AutoDeleteDeque::push_back
void push_back(T info)
Definition: autodeletedeque.h:69
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
Dvr::DisableRecordSchedule
bool DisableRecordSchedule(uint RecordId) override
Definition: dvr.cpp:1894
RecordingRule::m_recordID
int m_recordID
Unique Recording Rule ID.
Definition: recordingrule.h:68
ProgramInfo::QueryKeyFramePosition
bool QueryKeyFramePosition(uint64_t *position, uint64_t keyframe, bool backwards) const
Definition: programinfo.cpp:4201
mythscheduler.h
mythcorecontext.h
JobQueue::GetJobTypeFromName
static int GetJobTypeFromName(const QString &name)
Definition: jobqueue.cpp:712
cardutil.h
kOverrideRecord
@ kOverrideRecord
Definition: recordingtypes.h:28
MARK_GOP_BYFRAME
@ MARK_GOP_BYFRAME
Definition: programtypes.h:65
DTC::TitleInfo
Definition: titleInfo.h:24
Dvr::AddRecordSchedule
uint AddRecordSchedule(const QString &Title, const QString &Subtitle, const QString &Description, const QString &Category, const QDateTime &recstarttsRaw, const QDateTime &recendtsRaw, const QString &SeriesId, const QString &ProgramId, int ChanId, const QString &Station, int FindDay, QTime FindTime, int ParentId, bool Inactive, uint Season, uint Episode, const QString &Inetref, QString Type, QString SearchType, int RecPriority, uint PreferredInput, int StartOffset, int EndOffset, const QDateTime &lastrectsRaw, QString DupMethod, QString DupIn, bool NewEpisOnly, 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) override
Definition: dvr.cpp:1395
RecordingInfo::InsertRecording
bool InsertRecording(const QString &ext, bool force_match=false)
Definition: recordinginfo.cpp:993
DTC::RecRule
Definition: recRule.h:15
RecordingRule::m_dupMethod
RecordingDupMethodType m_dupMethod
Definition: recordingrule.h:111
FillCommBreak
void FillCommBreak(DTC::CutList *pCutList, RecordingInfo *rInfo, int marktype)
Definition: serviceUtil.cpp:686
ProgramInfo::IsCommercialFlagged
bool IsCommercialFlagged(void) const
Definition: programinfo.h:480
JobQueue::GetJobID
static int GetJobID(int jobType, uint chanid, const QDateTime &recstartts)
Definition: jobqueue.cpp:652
Dvr::ReactivateRecording
bool ReactivateRecording(int RecordedId, int ChanId, const QDateTime &recstarttsRaw) override
Definition: dvr.cpp:594
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:883
kDupCheckNone
@ kDupCheckNone
Definition: recordingtypes.h:60
MarkTypes
MarkTypes
Definition: programtypes.h:48
MythDate::ISODate
@ ISODate
Default UTC.
Definition: mythdate.h:17
DTC::MarkupList
Definition: markupList.h:25
ProgInfo
Definition: programdata.h:226
Dvr::RemoveRecordSchedule
bool RemoveRecordSchedule(uint RecordId) override
Definition: dvr.cpp:1716
DTC::Encoder::Local
bool Local
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:36
kSingleRecord
@ kSingleRecord
Definition: recordingtypes.h:22
ProgramInfo::QueryInUseMap
static QMap< QString, uint32_t > QueryInUseMap(void)
Definition: programinfo.cpp:5441
ProgramInfo::SaveWatched
void SaveWatched(bool watchedFlag)
Set "watched" field in recorded/videometadata to "watchedFlag".
Definition: programinfo.cpp:3054
RecList
std::deque< RecordingInfo * > RecList
Definition: mythscheduler.h:12
ProgramInfo::IsAutoExpirable
bool IsAutoExpirable(void) const
Definition: programinfo.h:485
Dvr::GetTitleList
QStringList GetTitleList(const QString &RecGroup) override
Definition: dvr.cpp:1178
marks
static const std::array< const mark, 16 > marks
Definition: lang.cpp:22
ProgramInfo::SendUpdateEvent
void SendUpdateEvent(void) const
Sends event out that the ProgramInfo should be reloaded.
Definition: programinfo.cpp:2757
DTC::Encoder::State
int State
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:38
tv_rec.h
kState_WatchingLiveTV
@ kState_WatchingLiveTV
Watching LiveTV is the state for when we are watching a recording and the user has control over the c...
Definition: tv.h:63
ProgramInfo::SavePreserve
void SavePreserve(bool preserveEpisode)
Set "preserve" field in "recorded" table to "preserveEpisode".
Definition: programinfo.cpp:3369
inputinfo.h
ProgramInfo::MarkupEntry::isDataNull
bool isDataNull
Definition: programinfo.h:699
Dvr::GetRecGroupList
QStringList GetRecGroupList() override
Definition: dvr.cpp:1084
RecStatus
Definition: recStatus.h:11
Dvr::SetSavedBookmark
bool SetSavedBookmark(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, const QString &OffsetType, long Offset) override
Definition: dvr.cpp:718
Dvr::DupInToDescription
QString DupInToDescription(const QString &DupIn) override
Definition: dvr.cpp:1978
CreateRecordingGroup
int CreateRecordingGroup(const QString &groupName)
Definition: serviceUtil.cpp:750
JOB_NO_FLAGS
@ JOB_NO_FLAGS
Definition: jobqueue.h:57
LoadFromOldRecorded
bool LoadFromOldRecorded(ProgramList &destination, const QString &sql, const MSqlBindings &bindings)
Definition: programinfo.cpp:5828
RecordingRule::Delete
bool Delete(bool sendSig=true)
Definition: recordingrule.cpp:501
Dvr::DupInToString
QString DupInToString(const QString &DupIn) override
Definition: dvr.cpp:1971
RecordingRule::MakeOverride
bool MakeOverride(void)
Definition: recordingrule.cpp:360
MARK_UNSET
@ MARK_UNSET
Definition: programtypes.h:51
ProgramInfo::MarkupEntry::frame
uint64_t frame
Definition: programinfo.h:697
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:861
Scheduler::GetAllPending
bool GetAllPending(RecList &retList, int recRuleId=0) const
Definition: scheduler.cpp:1741
recordingprofile.h
Dvr::ManageJobQueue
int ManageJobQueue(const QString &Action, const QString &JobName, int JobId, int RecordedId, QDateTime jobstarttsRaw, QString RemoteHost, QString JobArgs) override
Definition: dvr.cpp:2001
ProgramInfo::SaveMarkup
void SaveMarkup(const QVector< MarkupEntry > &mapMark, const QVector< MarkupEntry > &mapSeek) const
Definition: programinfo.cpp:4645
DTC::ProgramList
Definition: programList.h:26
MythCoreContext::GetBoolSettingOnHost
bool GetBoolSettingOnHost(const QString &key, const QString &host, bool defaultval=false)
Definition: mythcorecontext.cpp:958
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
RecStatus::toString
static QString toString(Type recstatus, uint id)
Converts "recstatus" into a short (unreadable) string.
Definition: recStatus.cpp:39
RecordingRule::m_station
QString m_station
Definition: recordingrule.h:96
Dvr::GetConflictList
DTC::ProgramList * GetConflictList(int StartIndex, int Count, int RecordId) override
Definition: dvr.cpp:1335
ChannelUtil::GetChanNum
static QString GetChanNum(int chan_id)
Returns the channel-number string of the given channel.
Definition: channelutil.cpp:775
Dvr::GetRecordedCommBreak
DTC::CutList * GetRecordedCommBreak(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, const QString &OffsetType) override
Definition: dvr.cpp:789
RecordingInfo::GetRecordingRule
RecordingRule * GetRecordingRule(void)
Returns the "record" field, creating it if necessary.
Definition: recordinginfo.cpp:879
DTC::Encoder
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:27
ProgramInfo::QueryDurationKeyFrame
bool QueryDurationKeyFrame(uint64_t *keyframe, uint64_t duration, bool backwards) const
Definition: programinfo.cpp:4210
RecordingRule::m_recPriority
int m_recPriority
Definition: recordingrule.h:105
Dvr::EnableRecordSchedule
bool EnableRecordSchedule(uint RecordId) override
Definition: dvr.cpp:1874
Dvr::GetRecordedList
DTC::ProgramList * GetRecordedList(bool Descending, int StartIndex, int Count, const QString &TitleRegEx, const QString &RecGroup, const QString &StorageGroup, const QString &Category, const QString &Sort, bool IgnoreLiveTV, bool IgnoreDeleted) override
Definition: dvr.cpp:64
build_compdb.filename
filename
Definition: build_compdb.py:21
RecordingRule::m_autoUserJob3
bool m_autoUserJob3
Definition: recordingrule.h:133
DTC::RecRuleFilter
Definition: recRuleFilter.h:15
ScheduledRecording::RescheduleMatch
static void RescheduleMatch(uint recordid, uint sourceid, uint mplexid, const QDateTime &maxstarttime, const QString &why)
Definition: scheduledrecording.h:17
MythCoreContext::dispatch
void dispatch(const MythEvent &event)
Definition: mythcorecontext.cpp:1748
DTC::EncoderList
Definition: encoderList.h:24
RecordingType
RecordingType
Definition: recordingtypes.h:19
kState_RecordingOnly
@ kState_RecordingOnly
Recording Only is a TVRec only state for when we are recording a program, but there is no one current...
Definition: tv.h:84
Dvr::GetSavedBookmark
long GetSavedBookmark(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, const QString &OffsetType) override
Definition: dvr.cpp:679
kDontRecord
@ kDontRecord
Definition: recordingtypes.h:29
RecordingRule::m_startdate
QDate m_startdate
Definition: recordingrule.h:87
RecordingRule::m_autoMetadataLookup
bool m_autoMetadataLookup
Definition: recordingrule.h:135
ProgramInfo::HasPathname
bool HasPathname(void) const
Definition: programinfo.h:358
ProgramInfo::VideoPropertiesFromNames
static uint VideoPropertiesFromNames(const QString &names)
Definition: programinfo.cpp:1538
AutoDeleteDeque::size
size_t size(void) const
Definition: autodeletedeque.h:67
jsonCastToCredits
DBCredits * jsonCastToCredits(const QJsonObject &cast)
Definition: serviceUtil.cpp:770
RecordingRule::m_prefInput
int m_prefInput
Definition: recordingrule.h:106
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:921
RecordingInfo::InsertFile
void InsertFile(void)
Definition: recordinginfo.cpp:1200
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:832
JOB_USERJOB
@ JOB_USERJOB
Definition: jobqueue.h:81
FillInputInfo
void FillInputInfo(DTC::Input *input, const InputInfo &inputInfo)
Definition: serviceUtil.cpp:544
DTC::CutList
Definition: cutList.h:25