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