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 <QJsonArray>
28 #include <QMap>
29 
30 // MythTV
31 #include "libmythbase/compat.h"
33 #include "libmythbase/mythdate.h"
34 #include "libmythbase/mythevent.h"
36 #include "libmythbase/mythversion.h"
40 #include "libmythbase/remoteutil.h"
42 #include "libmythtv/cardutil.h"
43 #include "libmythtv/channelutil.h"
44 #include "libmythtv/inputinfo.h"
45 #include "libmythtv/jobqueue.h"
46 #include "libmythtv/playgroup.h"
47 #include "libmythtv/programdata.h"
50 #include "libmythtv/tv_rec.h"
51 
52 // MythBackend
53 #include "autoexpire.h"
54 #include "backendcontext.h"
55 #include "dvr.h"
56 #include "encoderlink.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  {
748  position = Offset;
749  }
750  ri.SaveBookmark(position);
751  return true;
752 }
753 
755 //
757 
759  int chanid,
760  const QDateTime &recstarttsRaw,
761  const QString &offsettype )
762 {
763  int marktype = 0;
764  if ((RecordedId <= 0) &&
765  (chanid <= 0 || !recstarttsRaw.isValid()))
766  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
767 
768  RecordingInfo ri;
769  if (RecordedId > 0)
770  ri = RecordingInfo(RecordedId);
771  else
772  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
773 
774  auto* pCutList = new DTC::CutList();
775  if (offsettype.toLower() == "position")
776  marktype = 1;
777  else if (offsettype.toLower() == "duration")
778  marktype = 2;
779  else
780  marktype = 0;
781 
782  FillCutList(pCutList, &ri, marktype);
783 
784  return pCutList;
785 }
786 
788 //
790 
792  int chanid,
793  const QDateTime &recstarttsRaw,
794  const QString &offsettype )
795 {
796  int marktype = 0;
797  if ((RecordedId <= 0) &&
798  (chanid <= 0 || !recstarttsRaw.isValid()))
799  throw QString("Recorded ID or Channel ID and StartTime appears invalid.");
800 
801  RecordingInfo ri;
802  if (RecordedId > 0)
803  ri = RecordingInfo(RecordedId);
804  else
805  ri = RecordingInfo(chanid, recstarttsRaw.toUTC());
806 
807  auto* pCutList = new DTC::CutList();
808  if (offsettype.toLower() == "position")
809  marktype = 1;
810  else if (offsettype.toLower() == "duration")
811  marktype = 2;
812  else
813  marktype = 0;
814 
815  FillCommBreak(pCutList, &ri, marktype);
816 
817  return pCutList;
818 }
819 
821 //
823 
825  const QString &offsettype )
826 {
827  MarkTypes marktype = MARK_UNSET;
828  if (RecordedId <= 0)
829  throw QString("Recorded ID appears invalid.");
830 
831  RecordingInfo ri;
832  ri = RecordingInfo(RecordedId);
833 
834  auto* pCutList = new DTC::CutList();
835  if (offsettype.toLower() == "bytes")
836  marktype = MARK_GOP_BYFRAME;
837  else if (offsettype.toLower() == "duration")
838  marktype = MARK_DURATION_MS;
839  else
840  {
841  delete pCutList;
842  throw QString("Type must be 'BYTES' or 'DURATION'.");
843  }
844 
845  FillSeek(pCutList, &ri, marktype);
846 
847  return pCutList;
848 }
849 
851 //
853 
855 {
856  RecordingInfo ri;
857  ri = RecordingInfo(RecordedId);
858 
859  if (!ri.HasPathname())
860  throw QString("Invalid RecordedId %1").arg(RecordedId);
861 
862  QVector<ProgramInfo::MarkupEntry> mapMark;
863  QVector<ProgramInfo::MarkupEntry> mapSeek;
864 
865  ri.QueryMarkup(mapMark, mapSeek);
866 
867  auto* pMarkupList = new DTC::MarkupList();
868  for (const auto& entry : std::as_const(mapMark))
869  {
870  DTC::Markup *pMarkup = pMarkupList->AddNewMarkup();
871  QString typestr = toString(static_cast<MarkTypes>(entry.type));
872  pMarkup->setType(typestr);
873  pMarkup->setFrame(entry.frame);
874  if (entry.isDataNull)
875  pMarkup->setData("NULL");
876  else
877  pMarkup->setData(QString::number(entry.data));
878  }
879  for (const auto& entry : std::as_const(mapSeek))
880  {
881  DTC::Markup *pSeek = pMarkupList->AddNewSeek();
882  QString typestr = toString(static_cast<MarkTypes>(entry.type));
883  pSeek->setType(typestr);
884  pSeek->setFrame(entry.frame);
885  if (entry.isDataNull)
886  pSeek->setData("NULL");
887  else
888  pSeek->setData(QString::number(entry.data));
889  }
890 
891 
892  return pMarkupList;
893 }
894 
896 //
898 
899 bool Dvr::SetRecordedMarkup (int RecordedId, const QJsonObject &jsonObj)
900 {
901  RecordingInfo ri;
902  ri = RecordingInfo(RecordedId);
903 
904  if (!ri.HasPathname())
905  throw QString("Invalid RecordedId %1").arg(RecordedId);
906 
907  QVector<ProgramInfo::MarkupEntry> mapMark;
908  QVector<ProgramInfo::MarkupEntry> mapSeek;
909 
910  QJsonObject markuplist = jsonObj["MarkupList"].toObject();
911 
912  QJsonArray marks = markuplist["Mark"].toArray();
913  for (const auto & m : std::as_const(marks))
914  {
915  QJsonObject markup = m.toObject();
917 
918  QString typestr = markup.value("Type").toString("");
919  entry.type = markTypeFromString(typestr);
920  entry.frame = markup.value("Frame").toString("-1").toLongLong();
921  QString data = markup.value("Data").toString("NULL");
922  entry.isDataNull = (data == "NULL");
923  if (!entry.isDataNull)
924  entry.data = data.toLongLong();
925 
926  mapMark.append(entry);
927  }
928 
929  QJsonArray seeks = markuplist["Seek"].toArray();
930  for (const auto & m : std::as_const(seeks))
931  {
932  QJsonObject markup = m.toObject();
934 
935  QString typestr = markup.value("Type").toString("");
936  entry.type = markTypeFromString(typestr);
937  entry.frame = markup.value("Frame").toString("-1").toLongLong();
938  QString data = markup.value("Data").toString("NULL");
939  entry.isDataNull = (data == "NULL");
940  if (!entry.isDataNull)
941  entry.data = data.toLongLong();
942 
943  mapSeek.append(entry);
944  }
945 
946  ri.SaveMarkup(mapMark, mapSeek);
947 
948  return true;
949 }
950 
952 //
954 
956  int nCount )
957 {
958  pginfolist_t infoList;
959 
960  if (gExpirer)
961  gExpirer->GetAllExpiring( infoList );
962 
963  // ----------------------------------------------------------------------
964  // Build Response
965  // ----------------------------------------------------------------------
966 
967  auto *pPrograms = new DTC::ProgramList();
968 
969  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, (int)infoList.size() ) : 0;
970  nCount = (nCount > 0) ? std::min( nCount, (int)infoList.size() ) : infoList.size();
971  int nEndIndex = std::min((nStartIndex + nCount), (int)infoList.size() );
972 
973  for( int n = nStartIndex; n < nEndIndex; n++)
974  {
975  ProgramInfo *pInfo = infoList[ n ];
976 
977  if (pInfo != nullptr)
978  {
979  DTC::Program *pProgram = pPrograms->AddNewProgram();
980 
981  FillProgramInfo( pProgram, pInfo, true );
982 
983  delete pInfo;
984  }
985  }
986 
987  // ----------------------------------------------------------------------
988 
989  pPrograms->setStartIndex ( nStartIndex );
990  pPrograms->setCount ( nCount );
991  pPrograms->setTotalAvailable( infoList.size() );
992  pPrograms->setAsOf ( MythDate::current() );
993  pPrograms->setVersion ( MYTH_BINARY_VERSION );
994  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
995 
996  return pPrograms;
997 }
998 
1000 //
1002 
1004 {
1005  auto* pList = new DTC::EncoderList();
1006 
1007  QReadLocker tvlocker(&TVRec::s_inputsLock);
1008  QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo(true);
1009  for (auto * elink : std::as_const(gTVList))
1010  {
1011  if (elink != nullptr)
1012  {
1013  DTC::Encoder *pEncoder = pList->AddNewEncoder();
1014 
1015  pEncoder->setId ( elink->GetInputID() );
1016  pEncoder->setState ( elink->GetState() );
1017  pEncoder->setLocal ( elink->IsLocal() );
1018  pEncoder->setConnected ( elink->IsConnected() );
1019  pEncoder->setSleepStatus ( elink->GetSleepStatus() );
1020  // pEncoder->setLowOnFreeSpace( elink->isLowOnFreeSpace());
1021 
1022  if (pEncoder->Local())
1023  pEncoder->setHostName( gCoreContext->GetHostName() );
1024  else
1025  pEncoder->setHostName( elink->GetHostName() );
1026 
1027  for (const auto & inputInfo : std::as_const(inputInfoList))
1028  {
1029  if (inputInfo.m_inputId == static_cast<uint>(elink->GetInputID()))
1030  {
1031  DTC::Input *input = pEncoder->AddNewInput();
1032  FillInputInfo(input, inputInfo);
1033  }
1034  }
1035 
1036  switch ( pEncoder->State() )
1037  {
1038  case kState_WatchingLiveTV:
1039  case kState_RecordingOnly:
1041  {
1042  ProgramInfo *pInfo = elink->GetRecording();
1043 
1044  if (pInfo)
1045  {
1046  DTC::Program *pProgram = pEncoder->Recording();
1047 
1048  FillProgramInfo( pProgram, pInfo, true, true );
1049 
1050  delete pInfo;
1051  }
1052 
1053  break;
1054  }
1055 
1056  default:
1057  break;
1058  }
1059  }
1060  }
1061  return pList;
1062 }
1063 
1065 //
1067 
1069 {
1070  auto *pList = new DTC::InputList();
1071 
1072  QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo(false);
1073  for (const auto & inputInfo : std::as_const(inputInfoList))
1074  {
1075  DTC::Input *input = pList->AddNewInput();
1076  FillInputInfo(input, inputInfo);
1077  }
1078 
1079  return pList;
1080 }
1081 
1083 //
1085 
1087 {
1088  MSqlQuery query(MSqlQuery::InitCon());
1089  query.prepare("SELECT recgroup FROM recgroups WHERE recgroup <> 'Deleted' "
1090  "ORDER BY recgroup");
1091 
1092  QStringList result;
1093  if (!query.exec())
1094  {
1095  MythDB::DBError("GetRecGroupList", query);
1096  return result;
1097  }
1098 
1099  while (query.next())
1100  result << query.value(0).toString();
1101 
1102  return result;
1103 }
1104 
1106 //
1108 
1109 QStringList Dvr::GetProgramCategories( bool OnlyRecorded )
1110 {
1111  MSqlQuery query(MSqlQuery::InitCon());
1112 
1113  if (OnlyRecorded)
1114  query.prepare("SELECT DISTINCT category FROM recorded ORDER BY category");
1115  else
1116  query.prepare("SELECT DISTINCT category FROM program ORDER BY category");
1117 
1118  QStringList result;
1119  if (!query.exec())
1120  {
1121  MythDB::DBError("GetProgramCategories", query);
1122  return result;
1123  }
1124 
1125  while (query.next())
1126  result << query.value(0).toString();
1127 
1128  return result;
1129 }
1130 
1132 //
1134 
1136 {
1138 }
1139 
1141 //
1143 
1145 {
1146  return PlayGroup::GetNames();
1147 }
1148 
1150 //
1152 
1154 {
1155  auto* filterList = new DTC::RecRuleFilterList();
1156 
1157  MSqlQuery query(MSqlQuery::InitCon());
1158 
1159  query.prepare("SELECT filterid, description, newruledefault "
1160  "FROM recordfilter ORDER BY filterid");
1161 
1162  if (query.exec())
1163  {
1164  while (query.next())
1165  {
1166  DTC::RecRuleFilter* ruleFilter = filterList->AddNewRecRuleFilter();
1167  ruleFilter->setId(query.value(0).toInt());
1168  ruleFilter->setDescription(QObject::tr(query.value(1).toString()
1169  .toUtf8().constData()));
1170  }
1171  }
1172 
1173  return filterList;
1174 }
1175 
1177 //
1179 
1180 QStringList Dvr::GetTitleList(const QString& RecGroup)
1181 {
1182  MSqlQuery query(MSqlQuery::InitCon());
1183 
1184  QString querystr = "SELECT DISTINCT title FROM recorded "
1185  "WHERE deletepending = 0";
1186 
1187  if (!RecGroup.isEmpty())
1188  querystr += " AND recgroup = :RECGROUP";
1189  else
1190  querystr += " AND recgroup != 'Deleted'";
1191 
1192  querystr += " ORDER BY title";
1193 
1194  query.prepare(querystr);
1195 
1196  if (!RecGroup.isEmpty())
1197  query.bindValue(":RECGROUP", RecGroup);
1198 
1199  QStringList result;
1200  if (!query.exec())
1201  {
1202  MythDB::DBError("GetTitleList recorded", query);
1203  return result;
1204  }
1205 
1206  while (query.next())
1207  result << query.value(0).toString();
1208 
1209  return result;
1210 }
1211 
1213 //
1215 
1217 {
1218  MSqlQuery query(MSqlQuery::InitCon());
1219 
1220  QString querystr = QString(
1221  "SELECT title, inetref, count(title) as count "
1222  " FROM recorded AS r "
1223  " JOIN recgroups AS g ON r.recgroupid = g.recgroupid "
1224  " WHERE g.recgroup NOT IN ('Deleted', 'LiveTV') "
1225  " AND r.deletepending = 0 "
1226  " GROUP BY title, inetref "
1227  " ORDER BY title");
1228 
1229  query.prepare(querystr);
1230 
1231  auto *pTitleInfos = new DTC::TitleInfoList();
1232  if (!query.exec())
1233  {
1234  MythDB::DBError("GetTitleList recorded", query);
1235  return pTitleInfos;
1236  }
1237 
1238  while (query.next())
1239  {
1240  DTC::TitleInfo *pTitleInfo = pTitleInfos->AddNewTitleInfo();
1241 
1242  pTitleInfo->setTitle(query.value(0).toString());
1243  pTitleInfo->setInetref(query.value(1).toString());
1244  pTitleInfo->setCount(query.value(2).toInt());
1245  }
1246 
1247  return pTitleInfos;
1248 }
1249 
1251 //
1253 
1255  int nCount,
1256  bool bShowAll,
1257  int nRecordId,
1258  int nRecStatus )
1259 {
1260  RecordingList recordingList; // Auto-delete deque
1261  RecList tmpList; // Standard deque, objects must be deleted
1262 
1263  if (nRecordId <= 0)
1264  nRecordId = -1;
1265 
1266  // NOTE: Fetching this information directly from the schedule is
1267  // significantly faster than using ProgramInfo::LoadFromScheduler()
1268  auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
1269  if (scheduler)
1270  scheduler->GetAllPending(tmpList, nRecordId);
1271 
1272  // Sort the upcoming into only those which will record
1273  // NOLINTNEXTLINE(modernize-loop-convert)
1274  for (auto it = tmpList.begin(); it < tmpList.end(); ++it)
1275  {
1276  if ((nRecStatus != 0) &&
1277  ((*it)->GetRecordingStatus() != nRecStatus))
1278  {
1279  delete *it;
1280  *it = nullptr;
1281  continue;
1282  }
1283 
1284  if (!bShowAll && ((((*it)->GetRecordingStatus() >= RecStatus::Pending) &&
1285  ((*it)->GetRecordingStatus() <= RecStatus::WillRecord)) ||
1286  ((*it)->GetRecordingStatus() == RecStatus::Recorded) ||
1287  ((*it)->GetRecordingStatus() == RecStatus::Conflict)) &&
1288  ((*it)->GetRecordingEndTime() > MythDate::current()))
1289  { // NOLINT(bugprone-branch-clone)
1290  recordingList.push_back(new RecordingInfo(**it));
1291  }
1292  else if (bShowAll &&
1293  ((*it)->GetRecordingEndTime() > MythDate::current()))
1294  {
1295  recordingList.push_back(new RecordingInfo(**it));
1296  }
1297 
1298  delete *it;
1299  *it = nullptr;
1300  }
1301 
1302  // ----------------------------------------------------------------------
1303  // Build Response
1304  // ----------------------------------------------------------------------
1305 
1306  auto *pPrograms = new DTC::ProgramList();
1307 
1308  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, (int)recordingList.size() ) : 0;
1309  nCount = (nCount > 0) ? std::min( nCount, (int)recordingList.size() ) : recordingList.size();
1310  int nEndIndex = std::min((nStartIndex + nCount), (int)recordingList.size() );
1311 
1312  for( int n = nStartIndex; n < nEndIndex; n++)
1313  {
1314  ProgramInfo *pInfo = recordingList[ n ];
1315 
1316  DTC::Program *pProgram = pPrograms->AddNewProgram();
1317 
1318  FillProgramInfo( pProgram, pInfo, true );
1319  }
1320 
1321  // ----------------------------------------------------------------------
1322 
1323  pPrograms->setStartIndex ( nStartIndex );
1324  pPrograms->setCount ( nCount );
1325  pPrograms->setTotalAvailable( recordingList.size() );
1326  pPrograms->setAsOf ( MythDate::current() );
1327  pPrograms->setVersion ( MYTH_BINARY_VERSION );
1328  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
1329 
1330  return pPrograms;
1331 }
1332 
1334 //
1336 
1338  int nCount,
1339  int nRecordId )
1340 {
1341  RecordingList recordingList; // Auto-delete deque
1342  RecList tmpList; // Standard deque, objects must be deleted
1343 
1344  if (nRecordId <= 0)
1345  nRecordId = -1;
1346 
1347  // NOTE: Fetching this information directly from the schedule is
1348  // significantly faster than using ProgramInfo::LoadFromScheduler()
1349  auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
1350  if (scheduler)
1351  scheduler->GetAllPending(tmpList, nRecordId);
1352 
1353  // Sort the upcoming into only those which are conflicts
1354  // NOLINTNEXTLINE(modernize-loop-convert)
1355  for (auto it = tmpList.begin(); it < tmpList.end(); ++it)
1356  {
1357  if (((*it)->GetRecordingStatus() == RecStatus::Conflict) &&
1358  ((*it)->GetRecordingStartTime() >= MythDate::current()))
1359  {
1360  recordingList.push_back(new RecordingInfo(**it));
1361  }
1362  delete *it;
1363  *it = nullptr;
1364  }
1365 
1366  // ----------------------------------------------------------------------
1367  // Build Response
1368  // ----------------------------------------------------------------------
1369 
1370  auto *pPrograms = new DTC::ProgramList();
1371 
1372  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, (int)recordingList.size() ) : 0;
1373  nCount = (nCount > 0) ? std::min( nCount, (int)recordingList.size() ) : recordingList.size();
1374  int nEndIndex = std::min((nStartIndex + nCount), (int)recordingList.size() );
1375 
1376  for( int n = nStartIndex; n < nEndIndex; n++)
1377  {
1378  ProgramInfo *pInfo = recordingList[ n ];
1379 
1380  DTC::Program *pProgram = pPrograms->AddNewProgram();
1381 
1382  FillProgramInfo( pProgram, pInfo, true );
1383  }
1384 
1385  // ----------------------------------------------------------------------
1386 
1387  pPrograms->setStartIndex ( nStartIndex );
1388  pPrograms->setCount ( nCount );
1389  pPrograms->setTotalAvailable( recordingList.size() );
1390  pPrograms->setAsOf ( MythDate::current() );
1391  pPrograms->setVersion ( MYTH_BINARY_VERSION );
1392  pPrograms->setProtoVer ( MYTH_PROTO_VERSION );
1393 
1394  return pPrograms;
1395 }
1396 
1398  const QString& sTitle,
1399  const QString& sSubtitle,
1400  const QString& sDescription,
1401  const QString& sCategory,
1402  const QDateTime& recstarttsRaw,
1403  const QDateTime& recendtsRaw,
1404  const QString& sSeriesId,
1405  const QString& sProgramId,
1406  int nChanId,
1407  const QString& sStation,
1408  int nFindDay,
1409  QTime tFindTime,
1410  int nParentId,
1411  bool bInactive,
1412  uint nSeason,
1413  uint nEpisode,
1414  const QString& sInetref,
1415  QString sType,
1416  QString sSearchType,
1417  int nRecPriority,
1418  uint nPreferredInput,
1419  int nStartOffset,
1420  int nEndOffset,
1421  const QDateTime& lastrectsRaw,
1422  QString sDupMethod,
1423  QString sDupIn,
1424  bool bNewEpisOnly,
1425  uint nFilter,
1426  QString sRecProfile,
1427  QString sRecGroup,
1428  QString sStorageGroup,
1429  QString sPlayGroup,
1430  bool bAutoExpire,
1431  int nMaxEpisodes,
1432  bool bMaxNewest,
1433  bool bAutoCommflag,
1434  bool bAutoTranscode,
1435  bool bAutoMetaLookup,
1436  bool bAutoUserJob1,
1437  bool bAutoUserJob2,
1438  bool bAutoUserJob3,
1439  bool bAutoUserJob4,
1440  int nTranscoder)
1441 {
1442  QDateTime recstartts = recstarttsRaw.toUTC();
1443  QDateTime recendts = recendtsRaw.toUTC();
1444  QDateTime lastrects = lastrectsRaw.toUTC();
1445  RecordingRule rule;
1446  rule.LoadTemplate("Default");
1447 
1448  if (sType.isEmpty())
1449  sType = "single";
1450 
1451  if (sSearchType.isEmpty())
1452  sSearchType = "none";
1453 
1454  if (sDupMethod.isEmpty())
1455  sDupMethod = "subtitleanddescription";
1456 
1457  if (sDupIn.isEmpty())
1458  sDupIn = "all";
1459 
1460  rule.m_title = sTitle;
1461  rule.m_subtitle = sSubtitle;
1462  rule.m_description = sDescription;
1463 
1464  rule.m_startdate = recstartts.date();
1465  rule.m_starttime = recstartts.time();
1466  rule.m_enddate = recendts.date();
1467  rule.m_endtime = recendts.time();
1468 
1469  rule.m_type = recTypeFromString(sType);
1470  rule.m_searchType = searchTypeFromString(sSearchType);
1471  if (rule.m_searchType == kManualSearch)
1472  rule.m_dupMethod = kDupCheckNone;
1473  else
1474  rule.m_dupMethod = dupMethodFromString(sDupMethod);
1475  rule.m_dupIn = dupInFromStringAndBool(sDupIn, bNewEpisOnly);
1476 
1477  if (sRecProfile.isEmpty())
1478  sRecProfile = "Default";
1479 
1480  if (sRecGroup.isEmpty())
1481  sRecGroup = "Default";
1482 
1483  if (sStorageGroup.isEmpty())
1484  sStorageGroup = "Default";
1485 
1486  if (sPlayGroup.isEmpty())
1487  sPlayGroup = "Default";
1488 
1489  rule.m_category = sCategory;
1490  rule.m_seriesid = sSeriesId;
1491  rule.m_programid = sProgramId;
1492 
1493  rule.m_channelid = nChanId;
1494  rule.m_station = sStation;
1495 
1496  rule.m_findday = nFindDay;
1497  rule.m_findtime = tFindTime;
1498 
1499  rule.m_recProfile = sRecProfile;
1500  rule.m_recGroupID = RecordingInfo::GetRecgroupID(sRecGroup);
1501  if (rule.m_recGroupID == 0)
1502  {
1503  rule.m_recGroupID = CreateRecordingGroup(sRecGroup);
1504  if (rule.m_recGroupID <= 0)
1506  }
1507  rule.m_storageGroup = sStorageGroup;
1508  rule.m_playGroup = sPlayGroup;
1509 
1510  rule.m_parentRecID = nParentId;
1511  rule.m_isInactive = bInactive;
1512 
1513  rule.m_season = nSeason;
1514  rule.m_episode = nEpisode;
1515  rule.m_inetref = sInetref;
1516 
1517  rule.m_recPriority = nRecPriority;
1518  rule.m_prefInput = nPreferredInput;
1519  rule.m_startOffset = nStartOffset;
1520  rule.m_endOffset = nEndOffset;
1521  rule.m_filter = nFilter;
1522 
1523  rule.m_autoExpire = bAutoExpire;
1524  rule.m_maxEpisodes = nMaxEpisodes;
1525  rule.m_maxNewest = bMaxNewest;
1526 
1527  rule.m_autoCommFlag = bAutoCommflag;
1528  rule.m_autoTranscode = bAutoTranscode;
1529  rule.m_autoMetadataLookup = bAutoMetaLookup;
1530 
1531  rule.m_autoUserJob1 = bAutoUserJob1;
1532  rule.m_autoUserJob2 = bAutoUserJob2;
1533  rule.m_autoUserJob3 = bAutoUserJob3;
1534  rule.m_autoUserJob4 = bAutoUserJob4;
1535 
1536  rule.m_transcoder = nTranscoder;
1537 
1538  rule.m_lastRecorded = lastrects;
1539 
1540  QString msg;
1541  if (!rule.IsValid(msg))
1542  throw QString(msg);
1543 
1544  rule.Save();
1545 
1546  uint recid = rule.m_recordID;
1547 
1548  return recid;
1549 }
1550 
1552  const QString& sTitle,
1553  const QString& sSubtitle,
1554  const QString& sDescription,
1555  const QString& sCategory,
1556  const QDateTime& dStartTimeRaw,
1557  const QDateTime& dEndTimeRaw,
1558  const QString& sSeriesId,
1559  const QString& sProgramId,
1560  int nChanId,
1561  const QString& sStation,
1562  int nFindDay,
1563  QTime tFindTime,
1564  bool bInactive,
1565  uint nSeason,
1566  uint nEpisode,
1567  const QString& sInetref,
1568  QString sType,
1569  QString sSearchType,
1570  int nRecPriority,
1571  uint nPreferredInput,
1572  int nStartOffset,
1573  int nEndOffset,
1574  QString sDupMethod,
1575  QString sDupIn,
1576  bool bNewEpisOnly,
1577  uint nFilter,
1578  QString sRecProfile,
1579  QString sRecGroup,
1580  QString sStorageGroup,
1581  QString sPlayGroup,
1582  bool bAutoExpire,
1583  int nMaxEpisodes,
1584  bool bMaxNewest,
1585  bool bAutoCommflag,
1586  bool bAutoTranscode,
1587  bool bAutoMetaLookup,
1588  bool bAutoUserJob1,
1589  bool bAutoUserJob2,
1590  bool bAutoUserJob3,
1591  bool bAutoUserJob4,
1592  int nTranscoder)
1593 {
1594  if (nRecordId == 0 )
1595  throw QString("Record ID is invalid.");
1596 
1597  RecordingRule pRule;
1598  pRule.m_recordID = nRecordId;
1599  pRule.Load();
1600 
1601  if (!pRule.IsLoaded())
1602  throw QString("Record ID does not exist.");
1603 
1604  QDateTime recstartts = dStartTimeRaw.toUTC();
1605  QDateTime recendts = dEndTimeRaw.toUTC();
1606 
1607  pRule.m_isInactive = bInactive;
1608  if (sType.isEmpty())
1609  sType = "single";
1610 
1611  if (sSearchType.isEmpty())
1612  sSearchType = "none";
1613 
1614  if (sDupMethod.isEmpty())
1615  sDupMethod = "subtitleanddescription";
1616 
1617  if (sDupIn.isEmpty())
1618  sDupIn = "all";
1619 
1620  pRule.m_type = recTypeFromString(sType);
1621  pRule.m_searchType = searchTypeFromString(sSearchType);
1622  if (pRule.m_searchType == kManualSearch)
1623  pRule.m_dupMethod = kDupCheckNone;
1624  else
1625  pRule.m_dupMethod = dupMethodFromString(sDupMethod);
1626  pRule.m_dupIn = dupInFromStringAndBool(sDupIn, bNewEpisOnly);
1627 
1628  if (sRecProfile.isEmpty())
1629  sRecProfile = "Default";
1630 
1631  if (sRecGroup.isEmpty())
1632  sRecGroup = "Default";
1633 
1634  if (sStorageGroup.isEmpty())
1635  sStorageGroup = "Default";
1636 
1637  if (sPlayGroup.isEmpty())
1638  sPlayGroup = "Default";
1639 
1640  if (!sTitle.isEmpty())
1641  pRule.m_title = sTitle;
1642 
1643  if (!sSubtitle.isEmpty())
1644  pRule.m_subtitle = sSubtitle;
1645 
1646  if(!sDescription.isEmpty())
1647  pRule.m_description = sDescription;
1648 
1649  if (!sCategory.isEmpty())
1650  pRule.m_category = sCategory;
1651 
1652  if (!sSeriesId.isEmpty())
1653  pRule.m_seriesid = sSeriesId;
1654 
1655  if (!sProgramId.isEmpty())
1656  pRule.m_programid = sProgramId;
1657 
1658  if (nChanId)
1659  pRule.m_channelid = nChanId;
1660  if (!sStation.isEmpty())
1661  pRule.m_station = sStation;
1662 
1663  pRule.m_startdate = recstartts.date();
1664  pRule.m_starttime = recstartts.time();
1665  pRule.m_enddate = recendts.date();
1666  pRule.m_endtime = recendts.time();
1667 
1668  pRule.m_findday = nFindDay;
1669  pRule.m_findtime = tFindTime;
1670 
1671  pRule.m_recProfile = sRecProfile;
1672  pRule.m_recGroupID = RecordingInfo::GetRecgroupID(sRecGroup);
1673  if (pRule.m_recGroupID == 0)
1674  {
1675  pRule.m_recGroupID = CreateRecordingGroup(sRecGroup);
1676  if (pRule.m_recGroupID <= 0)
1678  }
1679  pRule.m_storageGroup = sStorageGroup;
1680  pRule.m_playGroup = sPlayGroup;
1681 
1682  pRule.m_isInactive = bInactive;
1683 
1684  pRule.m_season = nSeason;
1685  pRule.m_episode = nEpisode;
1686  pRule.m_inetref = sInetref;
1687 
1688  pRule.m_recPriority = nRecPriority;
1689  pRule.m_prefInput = nPreferredInput;
1690  pRule.m_startOffset = nStartOffset;
1691  pRule.m_endOffset = nEndOffset;
1692  pRule.m_filter = nFilter;
1693 
1694  pRule.m_autoExpire = bAutoExpire;
1695  pRule.m_maxEpisodes = nMaxEpisodes;
1696  pRule.m_maxNewest = bMaxNewest;
1697 
1698  pRule.m_autoCommFlag = bAutoCommflag;
1699  pRule.m_autoTranscode = bAutoTranscode;
1700  pRule.m_autoMetadataLookup = bAutoMetaLookup;
1701 
1702  pRule.m_autoUserJob1 = bAutoUserJob1;
1703  pRule.m_autoUserJob2 = bAutoUserJob2;
1704  pRule.m_autoUserJob3 = bAutoUserJob3;
1705  pRule.m_autoUserJob4 = bAutoUserJob4;
1706 
1707  pRule.m_transcoder = nTranscoder;
1708 
1709  QString msg;
1710  if (!pRule.IsValid(msg))
1711  throw QString(msg);
1712 
1713  bool bResult = pRule.Save();
1714 
1715  return bResult;
1716 }
1717 
1719 {
1720  bool bResult = false;
1721 
1722  if (nRecordId == 0 )
1723  throw QString("Record ID does not exist.");
1724 
1725  RecordingRule pRule;
1726  pRule.m_recordID = nRecordId;
1727 
1728  bResult = pRule.Delete();
1729 
1730  return bResult;
1731 }
1732 
1733 bool Dvr::AddDontRecordSchedule(int nChanId, const QDateTime &dStartTime,
1734  bool bNeverRecord)
1735 {
1736  bool bResult = true;
1737 
1738  if (nChanId <= 0 || !dStartTime.isValid())
1739  throw QString("Program does not exist.");
1740 
1741  ProgramInfo *pi = LoadProgramFromProgram(nChanId, dStartTime.toUTC());
1742 
1743  if (!pi)
1744  throw QString("Program does not exist.");
1745 
1746  // Why RecordingInfo instead of ProgramInfo? Good question ...
1747  RecordingInfo recInfo = RecordingInfo(*pi);
1748 
1749  delete pi;
1750 
1751  if (bNeverRecord)
1752  {
1753  recInfo.ApplyNeverRecord();
1754  }
1755  else
1756  {
1758  }
1759 
1760  return bResult;
1761 }
1762 
1764  int nCount,
1765  const QString &Sort,
1766  bool Descending )
1767 {
1769  if (Sort.toLower() == "lastrecorded")
1770  sortingColumn = Scheduler::kSortLastRecorded;
1771  else if (Sort.toLower() == "nextrecording")
1772  sortingColumn = Scheduler::kSortNextRecording;
1773  else if (Sort.toLower() == "title")
1774  sortingColumn = Scheduler::kSortTitle; // NOLINT(bugprone-branch-clone)
1775  else if (Sort.toLower() == "priority")
1776  sortingColumn = Scheduler::kSortPriority;
1777  else if (Sort.toLower() == "type")
1778  sortingColumn = Scheduler::kSortType;
1779  else
1780  sortingColumn = Scheduler::kSortTitle;
1781 
1782  RecList recList;
1783  Scheduler::GetAllScheduled(recList, sortingColumn, !Descending);
1784 
1785  // ----------------------------------------------------------------------
1786  // Build Response
1787  // ----------------------------------------------------------------------
1788 
1789  auto *pRecRules = new DTC::RecRuleList();
1790 
1791  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, (int)recList.size() ) : 0;
1792  nCount = (nCount > 0) ? std::min( nCount, (int)recList.size() ) : recList.size();
1793  int nEndIndex = std::min((nStartIndex + nCount), (int)recList.size() );
1794 
1795  for( int n = nStartIndex; n < nEndIndex; n++)
1796  {
1797  RecordingInfo *info = recList[n];
1798 
1799  if (info != nullptr)
1800  {
1801  DTC::RecRule *pRecRule = pRecRules->AddNewRecRule();
1802 
1803  FillRecRuleInfo( pRecRule, info->GetRecordingRule() );
1804  }
1805  }
1806 
1807  // ----------------------------------------------------------------------
1808 
1809  pRecRules->setStartIndex ( nStartIndex );
1810  pRecRules->setCount ( nCount );
1811  pRecRules->setTotalAvailable( recList.size() );
1812  pRecRules->setAsOf ( MythDate::current() );
1813  pRecRules->setVersion ( MYTH_BINARY_VERSION );
1814  pRecRules->setProtoVer ( MYTH_PROTO_VERSION );
1815 
1816  while (!recList.empty())
1817  {
1818  delete recList.back();
1819  recList.pop_back();
1820  }
1821 
1822  return pRecRules;
1823 }
1824 
1826  const QString& sTemplate,
1827  int nRecordedId,
1828  int nChanId,
1829  const QDateTime& dStartTimeRaw,
1830  bool bMakeOverride )
1831 {
1832  RecordingRule rule;
1833  QDateTime dStartTime = dStartTimeRaw.toUTC();
1834 
1835  if (nRecordId > 0)
1836  {
1837  rule.m_recordID = nRecordId;
1838  if (!rule.Load())
1839  throw QString("Record ID does not exist.");
1840  }
1841  else if (!sTemplate.isEmpty())
1842  {
1843  if (!rule.LoadTemplate(sTemplate))
1844  throw QString("Template does not exist.");
1845  }
1846  else if (nRecordedId > 0) // Loads from the Recorded/Recorded Program Table
1847  {
1848  // Despite the use of ProgramInfo, this only applies to Recordings.
1849  ProgramInfo recInfo(nRecordedId);
1850  if (!rule.LoadByProgram(&recInfo))
1851  throw QString("Recording does not exist");
1852  }
1853  else if (nChanId > 0 && dStartTime.isValid()) // Loads from Program Table, should NOT be used with recordings
1854  {
1855  // Despite the use of RecordingInfo, this only applies to programs in the
1856  // present or future, not to recordings? Confused yet?
1858  RecordingInfo info(nChanId, dStartTime, false, 0h, &status);
1859  if (status != RecordingInfo::kFoundProgram)
1860  throw QString("Program does not exist.");
1861  RecordingRule *pRule = info.GetRecordingRule();
1862  if (bMakeOverride && rule.m_type != kSingleRecord &&
1863  rule.m_type != kOverrideRecord && rule.m_type != kDontRecord)
1864  pRule->MakeOverride();
1865  rule = *pRule;
1866  }
1867  else
1868  {
1869  throw QString("Invalid request.");
1870  }
1871 
1872  auto *pRecRule = new DTC::RecRule();
1873  FillRecRuleInfo( pRecRule, &rule );
1874 
1875  return pRecRule;
1876 }
1877 
1879 {
1880  bool bResult = false;
1881 
1882  if (nRecordId == 0 )
1883  throw QString("Record ID appears invalid.");
1884 
1885  RecordingRule pRule;
1886  pRule.m_recordID = nRecordId;
1887  pRule.Load();
1888 
1889  if (pRule.IsLoaded())
1890  {
1891  pRule.m_isInactive = false;
1892  bResult = pRule.Save();
1893  }
1894 
1895  return bResult;
1896 }
1897 
1899 {
1900  bool bResult = false;
1901 
1902  if (nRecordId == 0 )
1903  throw QString("Record ID appears invalid.");
1904 
1905  RecordingRule pRule;
1906  pRule.m_recordID = nRecordId;
1907  pRule.Load();
1908 
1909  if (pRule.IsLoaded())
1910  {
1911  pRule.m_isInactive = true;
1912  bResult = pRule.Save();
1913  }
1914 
1915  return bResult;
1916 }
1917 
1918 int Dvr::RecordedIdForKey(int chanid, const QDateTime &recstarttsRaw)
1919 {
1920  int recordedid = 0;
1921 
1922  if (!RecordingInfo::QueryRecordedIdForKey(recordedid, chanid,
1923  recstarttsRaw))
1924  return -1;
1925 
1926  return recordedid;
1927 }
1928 
1929 int Dvr::RecordedIdForPathname(const QString & pathname)
1930 {
1931  uint recordedid = 0;
1932 
1933  if (!ProgramInfo::QueryRecordedIdFromPathname(pathname, recordedid))
1934  return -1;
1935 
1936  return recordedid;
1937 }
1938 
1940 {
1941  auto type = static_cast<RecStatus::Type>(RecStatus);
1942  return RecStatus::toString(type);
1943 }
1944 
1945 QString Dvr::RecStatusToDescription(int RecStatus, int recType,
1946  const QDateTime &StartTime)
1947 {
1948  //if (!StartTime.isValid())
1949  // throw QString("StartTime appears invalid.");
1950  auto recstatusType = static_cast<RecStatus::Type>(RecStatus);
1951  auto recordingType = static_cast<RecordingType>(recType);
1952  return RecStatus::toDescription(recstatusType, recordingType, StartTime);
1953 }
1954 
1955 QString Dvr::RecTypeToString(const QString& recType)
1956 {
1957  bool ok = false;
1958  auto enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1959  if (ok)
1960  return toString(enumType);
1961  // RecordingType type = static_cast<RecordingType>(recType);
1962  return toString(recTypeFromString(recType));
1963 }
1964 
1965 QString Dvr::RecTypeToDescription(const QString& recType)
1966 {
1967  bool ok = false;
1968  auto enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
1969  if (ok)
1970  return toDescription(enumType);
1971  // RecordingType type = static_cast<RecordingType>(recType);
1972  return toDescription(recTypeFromString(recType));
1973 }
1974 
1975 QString Dvr::DupInToString(const QString& DupIn)
1976 {
1977  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1978  // return toString(type);
1979  return toString(dupInFromString(DupIn));
1980 }
1981 
1982 QString Dvr::DupInToDescription(const QString& DupIn)
1983 {
1984  // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
1985  //return toDescription(type);
1986  return toDescription(dupInFromString(DupIn));
1987 }
1988 
1989 QString Dvr::DupMethodToString(const QString& DupMethod)
1990 {
1991  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1992  return toString(dupMethodFromString(DupMethod));
1993 }
1994 
1995 QString Dvr::DupMethodToDescription(const QString& DupMethod)
1996 {
1997  // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
1998  return toDescription(dupMethodFromString(DupMethod));
1999 }
2000 
2002 //
2004 
2005 int Dvr::ManageJobQueue( const QString &sAction,
2006  const QString &sJobName,
2007  int nJobId,
2008  int nRecordedId,
2009  QDateTime jobstarttsRaw,
2010  QString sRemoteHost,
2011  QString sJobArgs )
2012 {
2013  int nReturn = -1;
2014 
2015  if (!m_parsedParams.contains("jobname") &&
2016  !m_parsedParams.contains("recordedid") )
2017  {
2018  LOG(VB_GENERAL, LOG_ERR, "JobName and RecordedId are required.");
2019  return nReturn;
2020  }
2021 
2022  if (sRemoteHost.isEmpty())
2023  sRemoteHost = gCoreContext->GetHostName();
2024 
2025  int jobType = JobQueue::GetJobTypeFromName(sJobName);
2026 
2027  if (jobType == JOB_NONE)
2028  return nReturn;
2029 
2030  RecordingInfo ri = RecordingInfo(nRecordedId);
2031 
2032  if (!ri.GetChanID())
2033  return nReturn;
2034 
2035  if ( sAction == "Remove")
2036  {
2037  if (!m_parsedParams.contains("jobid") || nJobId < 0)
2038  {
2039  LOG(VB_GENERAL, LOG_ERR, "For Remove, a valid JobId is required.");
2040  return nReturn;
2041  }
2042 
2043  if (!JobQueue::SafeDeleteJob(nJobId, jobType, ri.GetChanID(),
2044  ri.GetRecordingStartTime()))
2045  return nReturn;
2046 
2047  return nJobId;
2048  }
2049 
2050  if ( sAction != "Add")
2051  {
2052  LOG(VB_GENERAL, LOG_ERR, QString("Illegal Action name '%1'. Use: Add, "
2053  "or Remove").arg(sAction));
2054  return nReturn;
2055  }
2056 
2057  if (((jobType & JOB_USERJOB) != 0) &&
2058  gCoreContext->GetSetting(sJobName, "").isEmpty())
2059  {
2060  LOG(VB_GENERAL, LOG_ERR, QString("%1 hasn't been defined.")
2061  .arg(sJobName));
2062  return nReturn;
2063  }
2064 
2065  if (!gCoreContext->GetBoolSettingOnHost(QString("JobAllow%1").arg(sJobName),
2066  sRemoteHost, false))
2067  {
2068  LOG(VB_GENERAL, LOG_ERR, QString("%1 hasn't been allowed on host %2.")
2069  .arg(sJobName, sRemoteHost));
2070  return nReturn;
2071  }
2072 
2073  if (!jobstarttsRaw.isValid())
2074  jobstarttsRaw = QDateTime::currentDateTime();
2075 
2076  if (!JobQueue::InJobRunWindow(jobstarttsRaw))
2077  return nReturn;
2078 
2079  if (sJobArgs.isNull())
2080  sJobArgs = "";
2081 
2082  bool bReturn = JobQueue::QueueJob(jobType,
2083  ri.GetChanID(),
2084  ri.GetRecordingStartTime(),
2085  sJobArgs,
2086  QString("Dvr/ManageJobQueue"), // comment col.
2087  sRemoteHost,
2088  JOB_NO_FLAGS,
2089  JOB_QUEUED,
2090  jobstarttsRaw.toUTC());
2091 
2092  if (!bReturn)
2093  {
2094  LOG(VB_GENERAL, LOG_ERR, QString("%1 job wasn't queued because of a "
2095  "database error or because it was "
2096  "already running/stopping etc.")
2097  .arg(sJobName));
2098 
2099  return nReturn;
2100  }
2101 
2102  return JobQueue::GetJobID(jobType, ri.GetChanID(),
2103  ri.GetRecordingStartTime());
2104 }
StorageGroup::getRecordingsGroups
static QStringList getRecordingsGroups(void)
Definition: storagegroup.cpp:784
serviceUtil.h
RecordingInfo::GetRecgroupID
static uint GetRecgroupID(const QString &recGroup)
Temporary helper during transition from string to ID.
Definition: recordinginfo.cpp:1686
RecordingRule::m_channelid
int m_channelid
callsign?
Definition: recordingrule.h:99
Dvr::DupMethodToDescription
QString DupMethodToDescription(const QString &DupMethod) override
Definition: dvr.cpp:1995
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:100
Scheduler
Definition: scheduler.h:45
RecordingRule::LoadByProgram
bool LoadByProgram(const ProgramInfo *proginfo)
Definition: recordingrule.cpp:168
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:812
RecStatus::Type
Type
Definition: recordingstatus.h:16
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:127
Dvr::SetRecordedMarkup
bool SetRecordedMarkup(int RecordedId, const QJsonObject &json) override
Definition: dvr.cpp:899
RecordingRule::m_autoTranscode
bool m_autoTranscode
Definition: recordingrule.h:132
mythevent.h
FillProgramInfo
void FillProgramInfo(DTC::Program *pProgram, ProgramInfo *pInfo, bool bIncChannel, bool bDetails, bool bIncCast)
Definition: serviceUtil.cpp:49
RecordingRule::m_enddate
QDate m_enddate
Definition: recordingrule.h:90
Dvr::GetRecordSchedule
DTC::RecRule * GetRecordSchedule(uint RecordId, const QString &Template, int nRecordedId, int ChanId, const QDateTime &dStartTimeRaw, bool MakeOverride) override
Definition: dvr.cpp:1825
RecordingRule::m_playGroup
QString m_playGroup
Definition: recordingrule.h:122
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:84
RecordingRule::m_seriesid
QString m_seriesid
Definition: recordingrule.h:84
RecordingRule::m_parentRecID
int m_parentRecID
Definition: recordingrule.h:71
Dvr::GetRecordedMarkup
DTC::MarkupList * GetRecordedMarkup(int RecordedId) override
Definition: dvr.cpp:854
RecordingInfo::QueryRecordedIdForKey
static bool QueryRecordedIdForKey(int &recordedid, uint chanid, const QDateTime &recstartts)
Definition: recordinginfo.cpp:942
FillRecRuleInfo
void FillRecRuleInfo(DTC::RecRule *pRecRule, RecordingRule *pRule)
Definition: serviceUtil.cpp:279
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:905
backendcontext.h
Dvr::GetRecRuleFilterList
DTC::RecRuleFilterList * GetRecRuleFilterList() override
Definition: dvr.cpp:1153
RecordingRule::m_description
QString m_description
Definition: recordingrule.h:81
RecordingRule::m_autoCommFlag
bool m_autoCommFlag
Definition: recordingrule.h:131
RecordingRule::m_inetref
QString m_inetref
Definition: recordingrule.h:87
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:2674
ProgramInfo::SetRecordingStatus
void SetRecordingStatus(RecStatus::Type status)
Definition: programinfo.h:584
Dvr::RecStatusToDescription
QString RecStatusToDescription(int RecStatus, int RecType, const QDateTime &StartTime) override
Definition: dvr.cpp:1945
RecordingInfo::kFoundProgram
@ kFoundProgram
Definition: recordinginfo.h:182
MythCoreContext::GetScheduler
MythScheduler * GetScheduler(void)
Definition: mythcorecontext.cpp:1913
Dvr::AddRecordedProgram
int AddRecordedProgram(const QJsonObject &json) override
Definition: dvr.cpp:337
RecordingRule::m_maxNewest
bool m_maxNewest
Definition: recordingrule.h:127
LoadProgramFromProgram
ProgramInfo * LoadProgramFromProgram(const uint chanid, const QDateTime &starttime)
Definition: programinfo.cpp:5890
RecordingRule::m_category
QString m_category
Definition: recordingrule.h:82
RecordingRule::Save
bool Save(bool sendSig=true)
Definition: recordingrule.cpp:390
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:506
RecordingRule::m_starttime
QTime m_starttime
Definition: recordingrule.h:91
RecordingInfo::ApplyRecordStateChange
void ApplyRecordStateChange(RecordingType newstate, bool save=true)
Sets RecordingType of "record", creating "record" if it does not exist.
Definition: recordinginfo.cpp:573
searchTypeFromString
RecSearchType searchTypeFromString(const QString &type)
Definition: recordingtypes.cpp:329
Dvr::GetProgramCategories
QStringList GetProgramCategories(bool OnlyRecorded) override
Definition: dvr.cpp:1109
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:1847
RecordingInfo
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:35
MarkTypes
MarkTypes
Definition: programtypes.h:47
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:1459
ProgramInfo::QueryMarkup
void QueryMarkup(QVector< MarkupEntry > &mapMark, QVector< MarkupEntry > &mapSeek) const
Definition: programinfo.cpp:4658
programdata.h
ProgramInfo::GetRecordingID
uint GetRecordingID(void) const
Definition: programinfo.h:450
DTC::Encoder::AddNewInput
Input * AddNewInput()
Definition: encoder.h:90
Dvr::AllowReRecord
bool AllowReRecord(int RecordedId) override
Definition: dvr.cpp:631
Dvr::GetTitleInfoList
DTC::TitleInfoList * GetTitleInfoList() override
Definition: dvr.cpp:1216
MythEvent
This class is used as a container for messages.
Definition: mythevent.h:16
RecordingRule::m_title
QString m_title
Definition: recordingrule.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:5575
ProgramInfo::QueryPositionKeyFrame
bool QueryPositionKeyFrame(uint64_t *keyframe, uint64_t position, bool backwards) const
Definition: programinfo.cpp:4205
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:204
Scheduler::kSortType
@ kSortType
Definition: scheduler.h:88
DTC::TitleInfoList
Definition: titleInfoList.h:24
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:869
RecordingRule::m_endOffset
int m_endOffset
Definition: recordingrule.h:110
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:618
ProgramInfo::SaveCommFlagged
void SaveCommFlagged(CommFlagStatus flag)
Set "commflagged" field in "recorded" table to "flag".
Definition: programinfo.cpp:3345
RecStatus::Recorded
@ Recorded
Definition: recordingstatus.h:29
DTC::Encoder::Recording
QObject Recording
Definition: encoder.h:43
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
playgroup.h
ProgramInfo::QueryKeyFrameDuration
bool QueryKeyFrameDuration(uint64_t *duration, uint64_t keyframe, bool backwards) const
Definition: programinfo.cpp:4232
Dvr::GetInputList
DTC::InputList * GetInputList() override
Definition: dvr.cpp:1068
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:6091
AutoExpire::GetAllExpiring
void GetAllExpiring(QStringList &strList)
Gets the full list of programs that can expire in expiration order.
Definition: autoexpire.cpp:834
DTC::RecRuleFilterList
Definition: recRuleFilterList.h:16
Dvr::GetRecordedSeek
DTC::CutList * GetRecordedSeek(int RecordedId, const QString &OffsetType) override
Definition: dvr.cpp:824
RecordingRule::IsLoaded
bool IsLoaded() const
Definition: recordingrule.h:55
kSingleRecord
@ kSingleRecord
Definition: recordingtypes.h:23
recordingtypes.h
Scheduler::kSortTitle
@ kSortTitle
Definition: scheduler.h:87
RecordingRule::m_dupIn
RecordingDupInType m_dupIn
Definition: recordingrule.h:114
Dvr::RecordedIdForPathname
int RecordedIdForPathname(const QString &pathname) override
Definition: dvr.cpp:1929
RecordingRule::m_isInactive
bool m_isInactive
Recording rule is enabled?
Definition: recordingrule.h:74
Dvr::RecTypeToString
QString RecTypeToString(const QString &RecType) override
Definition: dvr.cpp:1955
RecordingRule::m_season
uint m_season
Definition: recordingrule.h:94
remoteutil.h
kNormalAutoExpire
@ kNormalAutoExpire
Definition: programtypes.h:195
Dvr::GetExpiringList
DTC::ProgramList * GetExpiringList(int StartIndex, int Count) override
Definition: dvr.cpp:955
Dvr::DupMethodToString
QString DupMethodToString(const QString &DupMethod) override
Definition: dvr.cpp:1989
scheduler.h
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:14
JOB_NO_FLAGS
@ JOB_NO_FLAGS
Definition: jobqueue.h:59
Dvr::GetRecordScheduleList
DTC::RecRuleList * GetRecordScheduleList(int StartIndex, int Count, const QString &Sort, bool Descending) override
Definition: dvr.cpp:1763
ProgramInfo::GetRecordingStartTime
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
Definition: programinfo.h:405
ProgramInfo::IsWatched
bool IsWatched(void) const
Definition: programinfo.h:486
programtypes.h
DBCredits
std::vector< DBPerson > DBCredits
Definition: programdata.h:73
RecStatus::toString
static QString toString(RecStatus::Type recstatus, uint id)
Converts "recstatus" into a short (unreadable) string.
Definition: recordingstatus.cpp:40
JobQueue::InJobRunWindow
static bool InJobRunWindow(QDateTime jobstarttsRaw)
Definition: jobqueue.cpp:1646
kDontRecord
@ kDontRecord
Definition: recordingtypes.h:30
ProgramInfo::IsPreserved
bool IsPreserved(void) const
Definition: programinfo.h:488
string_to_myth_category_type
ProgramInfo::CategoryType string_to_myth_category_type(const QString &category_type)
Definition: programinfo.cpp:137
ProgramInfo::QueryBookmark
uint64_t QueryBookmark(void) const
Gets any bookmark position in database, unless the ignore bookmark flag is set.
Definition: programinfo.cpp:2798
PlayGroup::GetNames
static QStringList GetNames(void)
Definition: playgroup.cpp:210
MythScheduler::GetRecording
virtual QMap< QString, ProgramInfo * > GetRecording(void) const =0
RecStatus::WillRecord
@ WillRecord
Definition: recordingstatus.h:31
kDupCheckNone
@ kDupCheckNone
Definition: recordingtypes.h:65
Dvr::RecStatusToString
QString RecStatusToString(int RecStatus) override
Definition: dvr.cpp:1939
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:109
Scheduler::kSortLastRecorded
@ kSortLastRecorded
Definition: scheduler.h:87
RecordingInfo::kNoProgram
@ kNoProgram
Definition: recordinginfo.h:181
RecordingRule::m_episode
uint m_episode
Definition: recordingrule.h:95
mythdate.h
autoexpire.h
ProgramInfo::MarkupEntry::type
int type
Definition: programinfo.h:698
Dvr::StopRecording
bool StopRecording(int RecordedId) override
Definition: dvr.cpp:568
programinfo.h
ProgramInfo::GetScheduledStartTime
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
Definition: programinfo.h:391
ProgramInfo::QueryRecordedIdFromPathname
static bool QueryRecordedIdFromPathname(const QString &pathname, uint &recordedid)
Definition: programinfo.cpp:1236
RecordingRule::IsValid
bool IsValid(QString &msg) const
Definition: recordingrule.cpp:859
Dvr::GetRecordedCutList
DTC::CutList * GetRecordedCutList(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, const QString &OffsetType) override
Definition: dvr.cpp:758
RecordingRule::m_autoUserJob4
bool m_autoUserJob4
Definition: recordingrule.h:136
Dvr::GetEncoderList
DTC::EncoderList * GetEncoderList() override
Definition: dvr.cpp:1003
DTC::Input
Definition: input.h:24
ProgramInfo::MarkupEntry::data
uint64_t data
Definition: programinfo.h:700
RecStatus::toDescription
static QString toDescription(Type recstatus, RecordingType rectype, const QDateTime &recstartts)
Converts "recstatus" into a long human readable description.
Definition: recordingstatus.cpp:188
Dvr::RescheduleRecordings
bool RescheduleRecordings(void) override
Definition: dvr.cpp:620
FillCutList
void FillCutList(DTC::CutList *pCutList, RecordingInfo *rInfo, int marktype)
Definition: serviceUtil.cpp:642
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:550
DTC::RecRuleList
Definition: recRuleList.h:15
compat.h
RecordingRule::m_autoUserJob2
bool m_autoUserJob2
Definition: recordingrule.h:134
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:225
RecordingRule::m_findtime
QTime m_findtime
Time for timeslot rules.
Definition: recordingrule.h:101
dupMethodFromString
RecordingDupMethodType dupMethodFromString(const QString &type)
Definition: recordingtypes.cpp:293
Scheduler::kSortPriority
@ kSortPriority
Definition: scheduler.h:88
RecordingRule::m_lastRecorded
QDateTime m_lastRecorded
Definition: recordingrule.h:143
RecordingRule::m_autoExpire
bool m_autoExpire
Definition: recordingrule.h:126
markTypeFromString
MarkTypes markTypeFromString(const QString &str)
Definition: programtypes.cpp:68
RecordingRule::m_recProfile
QString m_recProfile
Definition: recordingrule.h:120
kManualSearch
@ kManualSearch
Definition: recordingtypes.h:85
RecordingRule::m_searchType
RecSearchType m_searchType
Definition: recordingrule.h:112
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:111
JOB_COMMFLAG
@ JOB_COMMFLAG
Definition: jobqueue.h:79
RecStatus::Conflict
@ Conflict
Definition: recordingstatus.h:39
FillSeek
void FillSeek(DTC::CutList *pCutList, RecordingInfo *rInfo, MarkTypes marktype)
Definition: serviceUtil.cpp:734
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:1551
RecordingRule::m_subtitle
QString m_subtitle
Definition: recordingrule.h:79
dupInFromStringAndBool
RecordingDupInType dupInFromStringAndBool(const QString &type, bool newEpisodesOnly)
Definition: recordingtypes.cpp:229
Scheduler::kSortNextRecording
@ kSortNextRecording
Definition: scheduler.h:87
ProgramInfo::MarkupEntry
Definition: programinfo.h:696
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:1144
Service::m_parsedParams
QList< QString > m_parsedParams
Definition: service.h:68
kOverrideRecord
@ kOverrideRecord
Definition: recordingtypes.h:29
storagegroup.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:66
jobqueue.h
RecordingRule::m_findday
int m_findday
Day of the week for once per week etc.
Definition: recordingrule.h:104
Dvr::AddRecordedCredits
bool AddRecordedCredits(int RecordedId, const QJsonObject &json) override
Definition: dvr.cpp:308
RecordingRule::m_filter
unsigned m_filter
Definition: recordingrule.h:115
RecordingInfo::ReactivateRecording
void ReactivateRecording(void)
Asks the scheduler to restart this recording if possible.
Definition: recordinginfo.cpp:1329
TVRec::s_inputsLock
static QReadWriteLock s_inputsLock
Definition: tv_rec.h:432
uint
unsigned int uint
Definition: compat.h:81
ProgramInfo::ProgramFlagsFromNames
void ProgramFlagsFromNames(const QString &names)
Definition: programinfo.cpp:1539
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:55
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
COMM_FLAG_DONE
@ COMM_FLAG_DONE
Definition: programtypes.h:122
dvr.h
kDisableAutoExpire
@ kDisableAutoExpire
Definition: programtypes.h:194
Dvr::RecordedIdForKey
int RecordedIdForKey(int ChanId, const QDateTime &recstarttsRaw) override
Definition: dvr.cpp:1918
RecordingRule::m_maxEpisodes
int m_maxEpisodes
Definition: recordingrule.h:125
ProgramInfo::AudioPropertiesFromNames
static uint AudioPropertiesFromNames(const QString &names)
Definition: programinfo.cpp:1534
RecordingRule::m_programid
QString m_programid
Definition: recordingrule.h:85
MARK_UNSET
@ MARK_UNSET
Definition: programtypes.h:50
ProgramInfo::SaveAutoExpire
void SaveAutoExpire(AutoExpireType autoExpire, bool updateDelete=false)
Set "autoexpire" field in "recorded" table to "autoExpire".
Definition: programinfo.cpp:3398
kState_WatchingRecording
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...
Definition: tv.h:83
Scheduler::SchedSortColumn
SchedSortColumn
Definition: scheduler.h:86
channelutil.h
MARK_GOP_BYFRAME
@ MARK_GOP_BYFRAME
Definition: programtypes.h:64
ProgramInfo::SubtitleTypesFromNames
static uint SubtitleTypesFromNames(const QString &names)
Definition: programinfo.cpp:1524
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:34
Dvr::GetRecStorageGroupList
QStringList GetRecStorageGroupList() override
Definition: dvr.cpp:1135
RecStatus::Pending
@ Pending
Definition: recordingstatus.h:17
RecordingRule::m_recGroupID
uint m_recGroupID
Definition: recordingrule.h:123
RecordingRule::m_endtime
QTime m_endtime
Definition: recordingrule.h:92
JOB_NONE
@ JOB_NONE
Definition: jobqueue.h:75
Dvr::AddDontRecordSchedule
bool AddDontRecordSchedule(int ChanId, const QDateTime &StartTime, bool NeverRecord) override
Definition: dvr.cpp:1733
AutoDeleteDeque< ProgramInfo * >
Dvr::GetUpcomingList
DTC::ProgramList * GetUpcomingList(int StartIndex, int Count, bool ShowAll, int RecordId, int RecStatus) override
Definition: dvr.cpp:1254
RecordingInfo::kDefaultRecGroup
@ kDefaultRecGroup
Definition: recordinginfo.h:191
MARK_DURATION_MS
@ MARK_DURATION_MS
Definition: programtypes.h:74
ProgramList
AutoDeleteDeque< ProgramInfo * > ProgramList
Definition: programinfo.h:31
recordinginfo.h
Dvr::RecTypeToDescription
QString RecTypeToDescription(const QString &RecType) override
Definition: dvr.cpp:1965
RecordingRule::m_storageGroup
QString m_storageGroup
Definition: recordingrule.h:121
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:373
RecordingRule::m_transcoder
int m_transcoder
Definition: recordingrule.h:130
RecordingRule::m_autoUserJob1
bool m_autoUserJob1
Definition: recordingrule.h:133
AutoDeleteDeque::push_back
void push_back(T info)
Definition: autodeletedeque.h:69
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
RecordingRule::LoadTemplate
bool LoadTemplate(const QString &title, const QString &category="Default", const QString &categoryType="Default")
Definition: recordingrule.cpp:276
Dvr::DisableRecordSchedule
bool DisableRecordSchedule(uint RecordId) override
Definition: dvr.cpp:1898
COMM_FLAG_NOT_FLAGGED
@ COMM_FLAG_NOT_FLAGGED
Definition: programtypes.h:121
RecordingRule::m_recordID
int m_recordID
Unique Recording Rule ID.
Definition: recordingrule.h:70
ProgramInfo::QueryKeyFramePosition
bool QueryKeyFramePosition(uint64_t *position, uint64_t keyframe, bool backwards) const
Definition: programinfo.cpp:4214
RecordingInfo::LoadStatus
LoadStatus
Definition: recordinginfo.h:180
mythscheduler.h
mythcorecontext.h
JobQueue::GetJobTypeFromName
static int GetJobTypeFromName(const QString &name)
Definition: jobqueue.cpp:696
cardutil.h
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:1397
RecordingInfo::InsertRecording
bool InsertRecording(const QString &ext, bool force_match=false)
Definition: recordinginfo.cpp:1040
DTC::RecRule
Definition: recRule.h:15
RecordingRule::m_dupMethod
RecordingDupMethodType m_dupMethod
Definition: recordingrule.h:113
FillCommBreak
void FillCommBreak(DTC::CutList *pCutList, RecordingInfo *rInfo, int marktype)
Definition: serviceUtil.cpp:688
ProgramInfo::IsCommercialFlagged
bool IsCommercialFlagged(void) const
Definition: programinfo.h:482
JobQueue::GetJobID
static int GetJobID(int jobType, uint chanid, const QDateTime &recstartts)
Definition: jobqueue.cpp:636
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:888
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:1718
DTC::Encoder::Local
bool Local
Definition: encoder.h:36
RecordingDupMethodType
RecordingDupMethodType
Definition: recordingtypes.h:62
ProgramInfo::QueryInUseMap
static QMap< QString, uint32_t > QueryInUseMap(void)
Definition: programinfo.cpp:5539
ProgramInfo::SaveWatched
void SaveWatched(bool watchedFlag)
Set "watched" field in recorded/videometadata to "watchedFlag".
Definition: programinfo.cpp:3056
JOB_USERJOB
@ JOB_USERJOB
Definition: jobqueue.h:83
RecList
std::deque< RecordingInfo * > RecList
Definition: mythscheduler.h:12
ProgramInfo::IsAutoExpirable
bool IsAutoExpirable(void) const
Definition: programinfo.h:487
Dvr::GetTitleList
QStringList GetTitleList(const QString &RecGroup) override
Definition: dvr.cpp:1180
RecordingType
RecordingType
Definition: recordingtypes.h:20
marks
static const std::array< const mark, 16 > marks
Definition: lang.cpp:23
ProgramInfo::SendUpdateEvent
void SendUpdateEvent(void) const
Sends event out that the ProgramInfo should be reloaded.
Definition: programinfo.cpp:2752
DTC::Encoder::State
int State
Definition: encoder.h:38
tv_rec.h
ProgramInfo::SavePreserve
void SavePreserve(bool preserveEpisode)
Set "preserve" field in "recorded" table to "preserveEpisode".
Definition: programinfo.cpp:3371
inputinfo.h
ProgramInfo::MarkupEntry::isDataNull
bool isDataNull
Definition: programinfo.h:701
Dvr::GetRecGroupList
QStringList GetRecGroupList() override
Definition: dvr.cpp:1086
RecStatus
Definition: recordingstatus.h:10
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:1982
CreateRecordingGroup
int CreateRecordingGroup(const QString &groupName)
Definition: serviceUtil.cpp:752
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:87
LoadFromOldRecorded
bool LoadFromOldRecorded(ProgramList &destination, const QString &sql, const MSqlBindings &bindings)
Definition: programinfo.cpp:5926
RecordingRule::Delete
bool Delete(bool sendSig=true)
Definition: recordingrule.cpp:509
Dvr::DupInToString
QString DupInToString(const QString &DupIn) override
Definition: dvr.cpp:1975
RecordingRule::MakeOverride
bool MakeOverride(void)
Definition: recordingrule.cpp:368
ProgramInfo::MarkupEntry::frame
uint64_t frame
Definition: programinfo.h:699
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:842
Scheduler::GetAllPending
bool GetAllPending(RecList &retList, int recRuleId=0) const
Definition: scheduler.cpp:1745
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:2005
ProgramInfo::SaveMarkup
void SaveMarkup(const QVector< MarkupEntry > &mapMark, const QVector< MarkupEntry > &mapSeek) const
Definition: programinfo.cpp:4739
azlyrics.info
dictionary info
Definition: azlyrics.py:7
DTC::ProgramList
Definition: programList.h:26
MythCoreContext::GetBoolSettingOnHost
bool GetBoolSettingOnHost(const QString &key, const QString &host, bool defaultval=false)
Definition: mythcorecontext.cpp:939
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
RecordingRule::m_station
QString m_station
Definition: recordingrule.h:98
Dvr::GetConflictList
DTC::ProgramList * GetConflictList(int StartIndex, int Count, int RecordId) override
Definition: dvr.cpp:1337
ChannelUtil::GetChanNum
static QString GetChanNum(int chan_id)
Returns the channel-number string of the given channel.
Definition: channelutil.cpp:777
Dvr::GetRecordedCommBreak
DTC::CutList * GetRecordedCommBreak(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, const QString &OffsetType) override
Definition: dvr.cpp:791
CardUtil::GetAllInputInfo
static QList< InputInfo > GetAllInputInfo(bool virtTuners)
Definition: cardutil.cpp:1733
DTC::Encoder
Definition: encoder.h:27
ProgramInfo::QueryDurationKeyFrame
bool QueryDurationKeyFrame(uint64_t *keyframe, uint64_t duration, bool backwards) const
Definition: programinfo.cpp:4223
RecordingRule::m_recPriority
int m_recPriority
Definition: recordingrule.h:107
Dvr::EnableRecordSchedule
bool EnableRecordSchedule(uint RecordId) override
Definition: dvr.cpp:1878
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:135
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
RecordingDupInType
RecordingDupInType
Definition: recordingtypes.h:45
MythCoreContext::dispatch
void dispatch(const MythEvent &event)
Definition: mythcorecontext.cpp:1727
DTC::EncoderList
Definition: encoderList.h:24
Dvr::GetSavedBookmark
long GetSavedBookmark(int RecordedId, int ChanId, const QDateTime &recstarttsRaw, const QString &OffsetType) override
Definition: dvr.cpp:679
RecordingRule::m_startdate
QDate m_startdate
Definition: recordingrule.h:89
RecordingRule::m_autoMetadataLookup
bool m_autoMetadataLookup
Definition: recordingrule.h:137
ProgramInfo::HasPathname
bool HasPathname(void) const
Definition: programinfo.h:359
ProgramInfo::VideoPropertiesFromNames
static uint VideoPropertiesFromNames(const QString &names)
Definition: programinfo.cpp:1529
AutoDeleteDeque::size
size_t size(void) const
Definition: autodeletedeque.h:67
jsonCastToCredits
DBCredits * jsonCastToCredits(const QJsonObject &cast)
Definition: serviceUtil.cpp:772
RecordingRule::m_prefInput
int m_prefInput
Definition: recordingrule.h:108
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:902
RecordingInfo::InsertFile
void InsertFile(void)
Definition: recordinginfo.cpp:1247
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:837
FillInputInfo
void FillInputInfo(DTC::Input *input, const InputInfo &inputInfo)
Definition: serviceUtil.cpp:546
DTC::CutList
Definition: cutList.h:25