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