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