MythTV  master
recordingrule.cpp
Go to the documentation of this file.
1 
2 #include "recordingrule.h"
3 
4 #include <utility>
5 
6 // libmythbase
8 #include "libmythbase/mythdate.h"
9 #include "libmythbase/mythdb.h"
11 
12 // libmythtv
13 #include "scheduledrecording.h" // For RescheduleMatch()
14 #include "playgroup.h" // For GetInitialName()
15 #include "recordingprofile.h" // For constants
16 
17 static inline QString null_to_empty(const QString &str)
18 {
19  return str.isEmpty() ? "" : str;
20 }
21 
22 // If the GetNumSetting() calls here are ever removed, update schema
23 // upgrade 1302 in dbcheck.cpp to manually apply them to the Default
24 // template. Failing to do so will cause users upgrading from older
25 // versions to lose those settings.
26 
28  : m_findtime(QTime::fromString("00:00:00", Qt::ISODate)),
29  m_findid(QDate(1970, 1, 1).daysTo(MythDate::current().toLocalTime().date())
30  + 719528),
31  m_transcoder(RecordingProfile::kTranscoderAutodetect)
32 {
33  QDateTime dt = MythDate::current();
34  m_enddate = m_startdate = dt.date();
35  m_endtime = m_starttime = dt.time();
36 
38 }
39 
44 {
45  std::shared_ptr<MythSortHelper>sh = getMythSortHelper();
46 
47  if (m_sortTitle.isEmpty() and not m_title.isEmpty())
49  if (m_sortSubtitle.isEmpty() and not m_subtitle.isEmpty())
51 }
52 
56 bool RecordingRule::Load(bool asTemplate)
57 {
58  if (m_recordID <= 0)
59  return false;
60 
62  query.prepare("SELECT type, search, " // 00-01
63  "recpriority, prefinput, startoffset, endoffset, dupmethod, dupin, " // 02-07
64  "inactive, profile, recgroup, storagegroup, playgroup, autoexpire, " // 08-13
65  "maxepisodes, maxnewest, autocommflag, autotranscode, transcoder, " // 14-18
66  "autouserjob1, autouserjob2, autouserjob3, autouserjob4, " // 19-22
67  "autometadata, parentid, title, subtitle, description, season, episode, " // 23-29
68  "category, starttime, startdate, endtime, enddate, seriesid, programid, " // 30-36
69  "inetref, chanid, station, findday, findtime, findid, " // 37-42
70  "next_record, last_record, last_delete, avg_delay, filter, recgroupid, " // 43-48
71  "autoextend " // 49
72  "FROM record WHERE recordid = :RECORDID ;");
73 
74  query.bindValue(":RECORDID", m_recordID);
75 
76  if (!query.exec())
77  {
78  MythDB::DBError("SELECT record", query);
79  return false;
80  }
81 
82  if (!query.next())
83  return false;
84 
85  // Schedule
86  if (!asTemplate)
87  {
88  m_type = static_cast<RecordingType>(query.value(0).toInt());
89  m_searchType = static_cast<RecSearchType>(query.value(1).toInt());
90  }
91  m_recPriority = query.value(2).toInt();
92  m_prefInput = query.value(3).toInt();
93  m_startOffset = query.value(4).toInt();
94  m_endOffset = query.value(5).toInt();
95  m_dupMethod = static_cast<RecordingDupMethodType>
96  (query.value(6).toInt());
97  m_dupIn = static_cast<RecordingDupInType>(query.value(7).toInt());
98  m_filter = query.value(47).toUInt();
99  m_isInactive = query.value(8).toBool();
100  m_autoExtend = static_cast<AutoExtendType>(query.value(49).toUInt());
101 
102  // Storage
103  m_recProfile = query.value(9).toString();
104  m_recGroupID = query.value(48).toUInt();
105  m_storageGroup = query.value(11).toString();
106  m_playGroup = query.value(12).toString();
107  m_autoExpire = query.value(13).toBool();
108  m_maxEpisodes = query.value(14).toInt();
109  m_maxNewest = query.value(15).toBool();
110 
111  // Post Process
112  m_autoCommFlag = query.value(16).toBool();
113  m_autoTranscode = query.value(17).toBool();
114  m_transcoder = query.value(18).toInt();
115  m_autoUserJob1 = query.value(19).toBool();
116  m_autoUserJob2 = query.value(20).toBool();
117  m_autoUserJob3 = query.value(21).toBool();
118  m_autoUserJob4 = query.value(22).toBool();
119  m_autoMetadataLookup = query.value(23).toBool();
120 
121  if (!asTemplate)
122  {
123  // Original rule id for override rule
124  m_parentRecID = query.value(24).toInt();
125 
126  // Recording metadata
127  m_title = query.value(25).toString();
128  m_subtitle = query.value(26).toString();
129  m_description = query.value(27).toString();
130  m_season = query.value(28).toUInt();
131  m_episode = query.value(29).toUInt();
132  m_category = query.value(30).toString();
133  m_starttime = query.value(31).toTime();
134  m_startdate = query.value(32).toDate();
135  m_endtime = query.value(33).toTime();
136  m_enddate = query.value(34).toDate();
137  m_seriesid = query.value(35).toString();
138  m_programid = query.value(36).toString();
139  m_inetref = query.value(37).toString();
140 
141  // Associated data for rule types
142  m_channelid = query.value(38).toInt();
143  m_station = query.value(39).toString();
144  m_findday = query.value(40).toInt();
145  m_findtime = query.value(41).toTime();
146  m_findid = query.value(42).toInt();
147 
148  // Statistic fields - Used to generate statistics about particular rules
149  // and influence watch list weighting
150  m_nextRecording = MythDate::as_utc(query.value(43).toDateTime());
151  m_lastRecorded = MythDate::as_utc(query.value(44).toDateTime());
152  m_lastDeleted = MythDate::as_utc(query.value(45).toDateTime());
153  m_averageDelay = query.value(46).toInt();
154  }
155 
158  m_template = (asTemplate || m_isTemplate) ?
159  query.value(30).toString() : "";
160 
161  if (!asTemplate)
162  m_loaded = true;
163 
165  return true;
166 }
167 
169 {
170  if (!proginfo)
171  return false;
172 
173  m_progInfo = proginfo;
174 
175  m_recordID = proginfo->GetRecordingRuleID();
176  if (m_recordID)
177  {
178  if (!Load())
179  return false;
180  }
181  else
182  {
183  LoadTemplate(proginfo->GetTitle(), proginfo->GetCategory(),
184  proginfo->GetCategoryTypeString());
185  }
186 
187  if (m_type != kTemplateRecord &&
189  {
191  if (!proginfo->GetRecordingRuleID())
193  }
194 
196  m_loaded = true;
197  return true;
198 }
199 
216 bool RecordingRule::LoadBySearch(RecSearchType lsearch, const QString& textname,
217  const QString& forwhat, QString joininfo,
218  ProgramInfo *pginfo)
219 {
220  MSqlQuery query(MSqlQuery::InitCon());
221 
222  int rid = 0;
223  query.prepare("SELECT recordid FROM record WHERE "
224  "search = :SEARCH AND description LIKE :FORWHAT");
225  query.bindValue(":SEARCH", lsearch);
226  query.bindValue(":FORWHAT", forwhat);
227 
228  if (query.exec())
229  {
230  if (query.next())
231  rid = query.value(0).toInt();
232  // else rid is zero, which is valid, we're looking at a new rule
233  }
234  else
235  {
236  MythDB::DBError("loadBySearch", query);
237  return false;
238  }
239 
240  if (rid)
241  {
242  m_recordID = rid;
243  if (!Load())
244  return false;
245  }
246  else
247  {
248  LoadTemplate("Default");
249 
250  QString searchType;
251  m_searchType = lsearch;
252  searchType = SearchTypeToString(m_searchType);
253 
254  QString ltitle = QString("%1 (%2)").arg(textname, searchType);
255  m_title = ltitle;
256  m_sortTitle = nullptr;
257  m_subtitle = m_sortSubtitle = std::move(joininfo);
258  m_description = forwhat;
259 
260  if (pginfo)
261  {
262  m_findday =
263  (pginfo->GetScheduledStartTime().toLocalTime().date()
264  .dayOfWeek() + 1) % 7;
265  m_findtime = pginfo->GetScheduledStartTime().toLocalTime().time();
266  m_findid = QDate(1970, 1, 1).daysTo(
267  pginfo->GetScheduledStartTime().toLocalTime().date()) + 719528;
268  }
269  }
270 
272  m_loaded = true;
273  return true;
274 }
275 
276 bool RecordingRule::LoadTemplate(const QString& title,
277  const QString& category,
278  const QString& categoryType)
279 {
280  QString lcategory = category.isEmpty() ? "Default" : category;
281  QString lcategoryType = categoryType.isEmpty() ? "Default" : categoryType;
282 
283  MSqlQuery query(MSqlQuery::InitCon());
284  query.prepare("SELECT recordid, category, "
285  " (category = :TITLE1) AS titlematch, "
286  " (category = :CAT1) AS catmatch, "
287  " (category = :CATTYPE1) AS typematch "
288  "FROM record "
289  "WHERE type = :TEMPLATE AND "
290  " (category IN (:TITLE2, :CAT2, :CATTYPE2) "
291  " OR category = 'Default') "
292  "ORDER BY titlematch DESC, catmatch DESC, typematch DESC"
293  );
294  query.bindValue(":TEMPLATE", kTemplateRecord);
295  query.bindValue(":TITLE1", title);
296  query.bindValue(":TITLE2", title);
297  query.bindValue(":CAT1", lcategory);
298  query.bindValue(":CAT2", lcategory);
299  query.bindValue(":CATTYPE1", lcategoryType);
300  query.bindValue(":CATTYPE2", lcategoryType);
301 
302  if (!query.exec())
303  {
304  MythDB::DBError("LoadByTemplate", query);
305  return false;
306  }
307 
308  if (!query.next())
309  return false;
310 
311  int savedRecordID = m_recordID;
312  m_recordID = query.value(0).toInt();
313  bool result = Load(true);
314  m_recordID = savedRecordID;
315 
316  return result;
317 }
318 
319 bool RecordingRule::MakeTemplate(QString category)
320 {
321  if (m_recordID > 0)
322  return false;
323 
324  if (category.compare(tr("Default"), Qt::CaseInsensitive) == 0)
325  {
326  category = "Default";
327  m_title = tr("Default (Template)");
329  }
330  else
331  {
332  //: %1 is the category
333  m_title = tr("%1 (Template)").arg(category);
335  }
336 
337  LoadTemplate(category);
338  m_recordID = 0;
340  m_category = category;
341  m_loaded = true;
342  m_isTemplate = true;
343 
344  return true;
345 }
346 
347 bool RecordingRule::ModifyPowerSearchByID(int rid, const QString& textname,
348  QString forwhat, QString joininfo)
349 {
350  if (rid <= 0)
351  return false;
352 
353  m_recordID = rid;
354  if (!Load() || m_searchType != kPowerSearch)
355  return false;
356 
357  QString ltitle = QString("%1 (%2)").arg(textname, tr("Power Search"));
358  m_title = ltitle;
359  m_sortTitle = nullptr;
360  m_subtitle = m_sortSubtitle = std::move(joininfo);
361  m_description = std::move(forwhat);
362 
364  m_loaded = true;
365  return true;
366 }
367 
369 {
370  if (m_recordID <= 0)
371  return false;
372 
374  return false;
375 
376  m_isOverride = true;
378  m_recordID = 0;
380  m_isInactive = false;
381 
384 
386 
387  return true;
388 }
389 
390 bool RecordingRule::Save(bool sendSig)
391 {
392  QString sql = "SET type = :TYPE, search = :SEARCHTYPE, "
393  "recpriority = :RECPRIORITY, prefinput = :INPUT, "
394  "startoffset = :STARTOFFSET, endoffset = :ENDOFFSET, "
395  "dupmethod = :DUPMETHOD, dupin = :DUPIN, "
396  "filter = :FILTER, autoextend = :AUTOEXTEND, "
397  "inactive = :INACTIVE, profile = :RECPROFILE, "
398  "recgroup = :RECGROUP, "
399  "recgroupid = :RECGROUPID, "
400  "storagegroup = :STORAGEGROUP, "
401  "playgroup = :PLAYGROUP, autoexpire = :AUTOEXPIRE, "
402  "maxepisodes = :MAXEPISODES, maxnewest = :MAXNEWEST, "
403  "autocommflag = :AUTOCOMMFLAG, "
404  "autotranscode = :AUTOTRANSCODE, "
405  "transcoder = :TRANSCODER, autouserjob1 = :AUTOUSERJOB1, "
406  "autouserjob2 = :AUTOUSERJOB2, "
407  "autouserjob3 = :AUTOUSERJOB3, "
408  "autouserjob4 = :AUTOUSERJOB4, "
409  "autometadata = :AUTOMETADATA, "
410  "parentid = :PARENTID, title = :TITLE, "
411  "subtitle = :SUBTITLE, season = :SEASON, episode = :EPISODE, "
412  "description = :DESCRIPTION, category = :CATEGORY, "
413  "starttime = :STARTTIME, startdate = :STARTDATE, "
414  "endtime = :ENDTIME, enddate = :ENDDATE, seriesid = :SERIESID, "
415  "programid = :PROGRAMID, inetref = :INETREF, chanid = :CHANID, "
416  "station = :STATION, findday = :FINDDAY, "
417  "findtime = :FINDTIME, findid = :FINDID, "
418  "next_record = :NEXTREC, last_record = :LASTREC, "
419  "last_delete = :LASTDELETE, avg_delay = :AVGDELAY ";
420 
421  QString sqlquery;
422  if (m_recordID > 0 || (m_recordTable != "record" && m_tempID > 0))
423  {
424  sqlquery = QString("UPDATE %1 %2 WHERE recordid = :RECORDID;")
425  .arg(m_recordTable, sql);
426  }
427  else
428  {
429  sqlquery = QString("INSERT INTO %1 %2;").arg(m_recordTable, sql);
430  }
431 
432  MSqlQuery query(MSqlQuery::InitCon());
433  query.prepare(sqlquery);
434  query.bindValue(":TYPE", m_type);
435  query.bindValue(":SEARCHTYPE", m_searchType);
436  query.bindValue(":RECPRIORITY", m_recPriority);
437  query.bindValue(":INPUT", m_prefInput);
438  query.bindValue(":STARTOFFSET", m_startOffset);
439  query.bindValue(":ENDOFFSET", m_endOffset);
440  query.bindValue(":DUPMETHOD", m_dupMethod);
441  query.bindValue(":DUPIN", m_dupIn);
442  query.bindValue(":FILTER", m_filter);
443  query.bindValue(":AUTOEXTEND", static_cast<int>(m_autoExtend));
444  query.bindValue(":INACTIVE", m_isInactive);
445  query.bindValue(":RECPROFILE", null_to_empty(m_recProfile));
446  // Temporary, remove once transition to recgroupid is complete
448  query.bindValue(":RECGROUPID", m_recGroupID);
449  query.bindValue(":STORAGEGROUP", null_to_empty(m_storageGroup));
450  query.bindValue(":PLAYGROUP", null_to_empty(m_playGroup));
451  query.bindValue(":AUTOEXPIRE", m_autoExpire);
452  query.bindValue(":MAXEPISODES", m_maxEpisodes);
453  query.bindValue(":MAXNEWEST", m_maxNewest);
454  query.bindValue(":AUTOCOMMFLAG", m_autoCommFlag);
455  query.bindValue(":AUTOTRANSCODE", m_autoTranscode);
456  query.bindValue(":TRANSCODER", m_transcoder);
457  query.bindValue(":AUTOUSERJOB1", m_autoUserJob1);
458  query.bindValue(":AUTOUSERJOB2", m_autoUserJob2);
459  query.bindValue(":AUTOUSERJOB3", m_autoUserJob3);
460  query.bindValue(":AUTOUSERJOB4", m_autoUserJob4);
461  query.bindValue(":AUTOMETADATA", m_autoMetadataLookup);
462  query.bindValue(":PARENTID", m_parentRecID);
463  query.bindValue(":TITLE", m_title);
464  query.bindValue(":SUBTITLE", null_to_empty(m_subtitle));
465  query.bindValue(":DESCRIPTION", null_to_empty(m_description));
466  query.bindValue(":SEASON", m_season);
467  query.bindValue(":EPISODE", m_episode);
468  query.bindValue(":CATEGORY", null_to_empty(m_category));
469  query.bindValue(":STARTTIME", m_starttime);
470  query.bindValue(":STARTDATE", m_startdate);
471  query.bindValue(":ENDTIME", m_endtime);
472  query.bindValue(":ENDDATE", m_enddate);
473  query.bindValue(":SERIESID", null_to_empty(m_seriesid));
474  query.bindValue(":PROGRAMID", null_to_empty(m_programid));
475  query.bindValue(":INETREF", null_to_empty(m_inetref));
476  query.bindValue(":CHANID", m_channelid);
477  query.bindValue(":STATION", null_to_empty(m_station));
478  query.bindValue(":FINDDAY", m_findday);
479  query.bindValue(":FINDTIME", m_findtime);
480  query.bindValue(":FINDID", m_findid);
481  query.bindValue(":NEXTREC", m_nextRecording);
482  query.bindValue(":LASTREC", m_lastRecorded);
483  query.bindValue(":LASTDELETE", m_lastDeleted);
484  query.bindValue(":AVGDELAY", m_averageDelay);
485 
486  if (m_recordTable != "record" && m_tempID > 0)
487  query.bindValue(":RECORDID", m_tempID);
488  else if (m_recordID > 0)
489  query.bindValue(":RECORDID", m_recordID);
490 
491  if (!query.exec())
492  {
493  MythDB::DBError("UPDATE/INSERT record", query);
494  return false;
495  }
496 
497  if (m_recordTable != "record" && m_tempID <= 0)
498  m_tempID = query.lastInsertId().toInt();
499  else if (m_recordID <= 0)
500  m_recordID = query.lastInsertId().toInt();
501 
502  if (sendSig)
504  QString("SaveRule %1").arg(m_title));
505 
506  return true;
507 }
508 
509 bool RecordingRule::Delete(bool sendSig)
510 {
511  if (m_recordID < 0)
512  return false;
513 
514  MSqlQuery query(MSqlQuery::InitCon());
515  query.prepare("DELETE FROM record WHERE recordid = :RECORDID");
516  query.bindValue(":RECORDID", m_recordID);
517  if (!query.exec())
518  {
519  MythDB::DBError("ScheduledRecording::remove -- record", query);
520  return false;
521  }
522 
523  query.prepare("DELETE FROM oldfind WHERE recordid = :RECORDID");
524  query.bindValue(":RECORDID", m_recordID);
525  if (!query.exec())
526  {
527  MythDB::DBError("ScheduledRecording::remove -- oldfind", query);
528  }
529 
531  {
532  query.prepare("DELETE FROM program WHERE manualid = :RECORDID");
533  query.bindValue(":RECORDID", m_recordID);
534  if (!query.exec())
535  {
536  MythDB::DBError("ScheduledRecording::remove -- oldfind", query);
537  }
538  }
539 
540  if (sendSig)
542  QString("DeleteRule %1").arg(m_title));
543 
544  // Set m_recordID to zero, the rule is no longer in the database so it's
545  // not valid. Should you want, this allows a rule to be removed from the
546  // database and then re-inserted with Save()
547  m_recordID = 0;
548 
549  return true;
550 }
551 
552 void RecordingRule::ToMap(InfoMap &infoMap, uint date_format) const
553 {
554  if (m_title == "Default (Template)")
555  {
556  infoMap["title"] = tr("Default (Template)");
557  infoMap["sorttitle"] = tr("Default (Template)");
558  }
559  else
560  {
561  infoMap["title"] = m_title;
562  infoMap["sorttitle"] = m_sortTitle;
563  }
564  infoMap["subtitle"] = m_subtitle;
565  infoMap["sortsubtitle"] = m_sortSubtitle;
566  infoMap["description"] = m_description;
567  infoMap["season"] = QString::number(m_season);
568  infoMap["episode"] = QString::number(m_episode);
569 
570  if (m_category == "Default")
571  infoMap["category"] = tr("Default", "category");
572  else
573  infoMap["category"] = m_category;
574  infoMap["callsign"] = m_station;
575 
576  QDateTime starttm(m_startdate, m_starttime, Qt::UTC);
577  infoMap["starttime"] = MythDate::toString(starttm, date_format | MythDate::kTime);
578  infoMap["startdate"] = MythDate::toString(
579  starttm, date_format | MythDate::kDateFull | MythDate::kSimplify);
580 
581  QDateTime endtm(m_enddate, m_endtime, Qt::UTC);
582  infoMap["endtime"] = MythDate::toString(endtm, date_format | MythDate::kTime);
583  infoMap["enddate"] = MythDate::toString(
584  endtm, date_format | MythDate::kDateFull | MythDate::kSimplify);
585 
586  infoMap["inetref"] = m_inetref;
587  infoMap["chanid"] = QString::number(m_channelid);
588  infoMap["channel"] = m_station;
589 
590  QDateTime startts(m_startdate, m_starttime, Qt::UTC);
591  QDateTime endts(m_enddate, m_endtime, Qt::UTC);
592 
593  int seconds = startts.secsTo(endts);
594  int minutes = seconds / 60;
595  int hours = minutes / 60;
596  minutes = minutes % 60;
597 
598  infoMap["lenmins"] = QCoreApplication::translate("(Common)", "%n minute(s)",
599  "", minutes);
600 
601  QString minstring = QCoreApplication::translate("(Common)", "%n minute(s)",
602  "", minutes);
603 
604  QString hourstring = QCoreApplication::translate("(Common)", "%n hour(s)",
605  "", hours);
606 
607  if (hours > 0)
608  {
609  //: Time duration, %1 is replaced by the hours, %2 by the minutes
610  infoMap["lentime"] = QCoreApplication::translate("(Common)", "%1 %2",
611  "Hours and minutes").arg(hourstring, minstring);
612  }
613  else
614  {
615  infoMap["lentime"] = minstring;
616  }
617 
618 
619  infoMap["timedate"] = MythDate::toString(
620  startts, date_format | MythDate::kDateTimeFull | MythDate::kSimplify) + " - " +
621  MythDate::toString(endts, date_format | MythDate::kTime);
622 
623  infoMap["shorttimedate"] =
625  startts, date_format | MythDate::kDateTimeShort | MythDate::kSimplify) + " - " +
626  MythDate::toString(endts, date_format | MythDate::kTime);
627 
629  {
630  QDateTime ldt =
631  QDateTime(MythDate::current().toLocalTime().date(), m_findtime,
632  Qt::LocalTime);
633  QString findfrom = MythDate::toString(ldt, date_format | MythDate::kTime);
634  if (m_type == kWeeklyRecord)
635  {
636  int daynum = ((m_findday + 5) % 7) + 1;
637  findfrom = QString("%1, %2")
638  .arg(gCoreContext->GetQLocale().dayName(daynum, QLocale::ShortFormat),
639  findfrom);
640  }
641  infoMap["subtitle"] = tr("(%1 or later) %3",
642  "e.g. (Sunday or later) program "
643  "subtitle").arg(findfrom, m_subtitle);
644  }
645 
646  infoMap["searchtype"] = SearchTypeToString(m_searchType);
647  if (m_searchType != kNoSearch)
648  infoMap["searchforwhat"] = m_description;
649 
650  using namespace MythDate;
651  if (m_nextRecording.isValid())
652  {
653  infoMap["nextrecording"] = MythDate::toString(
654  m_nextRecording, date_format | kDateFull | kAddYear);
655  }
656  if (m_lastRecorded.isValid())
657  {
658  infoMap["lastrecorded"] = MythDate::toString(
659  m_lastRecorded, date_format | kDateFull | kAddYear);
660  }
661  if (m_lastDeleted.isValid())
662  {
663  infoMap["lastdeleted"] = MythDate::toString(
664  m_lastDeleted, date_format | kDateFull | kAddYear);
665  }
666 
667  infoMap["ruletype"] = toString(m_type);
668  infoMap["rectype"] = toString(m_type);
669  infoMap["autoextend"] = toString(m_autoExtend);
670 
671  if (m_template == "Default")
672  infoMap["template"] = tr("Default", "Default template");
673  else
674  infoMap["template"] = m_template;
675 }
676 
677 void RecordingRule::UseTempTable(bool usetemp, const QString& table)
678 {
680 
681  if (usetemp)
682  {
683  m_recordTable = table;
684 
685  query.prepare("SELECT GET_LOCK(:LOCK, 2);");
686  query.bindValue(":LOCK", "DiffSchedule");
687  if (!query.exec())
688  {
689  MythDB::DBError("Obtaining lock in testRecording", query);
690  return;
691  }
692 
693  query.prepare(QString("DROP TABLE IF EXISTS %1;").arg(table));
694  if (!query.exec())
695  {
696  MythDB::DBError("Deleting old table in testRecording", query);
697  return;
698  }
699 
700  query.prepare(QString("CREATE TABLE %1 SELECT * FROM record;")
701  .arg(table));
702  if (!query.exec())
703  {
704  MythDB::DBError("Create new temp table", query);
705  return;
706  }
707 
708  query.prepare(QString("ALTER TABLE %1 MODIFY recordid int(10) "
709  "UNSIGNED NOT NULL AUTO_INCREMENT primary key;")
710  .arg(table));
711  if (!query.exec())
712  {
713  MythDB::DBError("Modify recordid column to include "
714  "auto-increment", query);
715  return;
716  }
717 
718  if (m_recordID > 0)
720 
721  Save(false);
722  }
723  else
724  {
725  query.prepare("SELECT RELEASE_LOCK(:LOCK);");
726  query.bindValue(":LOCK", "DiffSchedule");
727  if (!query.exec())
728  {
729  MythDB::DBError("Free lock", query);
730  return;
731  }
732  m_recordTable = "record";
733  m_tempID = 0;
734  }
735 }
736 
738 {
739  if (!m_progInfo)
740  return;
741 
755  if (m_recordID <= 0)
756  {
757  m_findday =
758  (m_progInfo->GetScheduledStartTime().toLocalTime().date()
759  .dayOfWeek() + 1) % 7;
760  m_findtime = m_progInfo->GetScheduledStartTime().toLocalTime().time();
761  m_findid = QDate(1970, 1, 1).daysTo(
762  m_progInfo->GetScheduledStartTime().toLocalTime().date()) + 719528;
763  }
764  else
765  {
766  if (m_findid > 0)
768  else
769  {
770  QDate epoch(1970, 1, 1);
771  m_findid = epoch.daysTo(
772  m_progInfo->GetScheduledStartTime().toLocalTime().date())
773  + 719528;
774  }
775  }
777 
778  if (m_inetref.isEmpty())
779  {
783  }
785 }
786 
788 {
789  MSqlQuery query(MSqlQuery::InitCon());
790  query.prepare("SELECT SUM(1 << filterid) FROM recordfilter "
791  "WHERE filterid >= 0 AND filterid < :NUMFILTERS AND "
792  " TRIM(clause) <> '' AND newruledefault <> 0");
793  query.bindValue(":NUMFILTERS", RecordingRule::kNumFilters);
794  if (!query.exec())
795  {
796  MythDB::DBError("GetDefaultFilter", query);
797  return 0;
798  }
799 
800  if (!query.next())
801  return 0;
802 
803  return query.value(0).toUInt();
804 }
805 
807 {
808  QString searchTypeString;
809 
810  switch (searchType)
811  {
812  case kNoSearch:
813  searchTypeString = ""; // Allow themers to decide what to display
814  break;
815  case kPowerSearch:
816  searchTypeString = tr("Power Search");
817  break;
818  case kTitleSearch:
819  searchTypeString = tr("Title Search");
820  break;
821  case kKeywordSearch:
822  searchTypeString = tr("Keyword Search");
823  break;
824  case kPeopleSearch:
825  searchTypeString = tr("People Search");
826  break;
827  default:
828  searchTypeString = tr("Unknown Search");
829  break;
830  }
831 
832  return searchTypeString;
833 }
834 
836 {
837  QStringList result;
838 
839  MSqlQuery query(MSqlQuery::InitCon());
840  query.prepare("SELECT category "
841  "FROM record "
842  "WHERE type = :TEMPLATE "
843  "ORDER BY category = 'Default' DESC, category"
844  );
845  query.bindValue(":TEMPLATE", kTemplateRecord);
846 
847  if (!query.exec())
848  {
849  MythDB::DBError("LoadByTemplate", query);
850  return result;
851  }
852 
853  while (query.next())
854  result << query.value(0).toString();
855 
856  return result;
857 }
858 
859 bool RecordingRule::IsValid(QString &msg) const
860 {
861  bool isOverride = false;
862  switch (m_type)
863  {
864  case kSingleRecord:
865  case kDailyRecord:
866  case kAllRecord:
867  case kWeeklyRecord:
868  case kOneRecord:
869  case kTemplateRecord:
870  break;
871  case kOverrideRecord:
872  case kDontRecord:
873  isOverride = true;
874  break;
875  case kNotRecording:
876  default:
877  msg = QString("Invalid recording type.");
878  return false;
879  }
880 
881  bool isNormal = false;
882  bool isSearch = false;
883  bool isManual = false;
884  switch (m_searchType)
885  {
886  case kNoSearch:
887  isNormal = true;
888  break;
889  case kPowerSearch:
890  case kTitleSearch:
891  case kKeywordSearch:
892  case kPeopleSearch:
893  isSearch = true;
894  break;
895  case kManualSearch:
896  isManual = true;
897  break;
898  default:
899  msg = QString("Invalid search type.");
900  return false;
901  }
902 
903  if ((isNormal && (m_type == kDailyRecord || m_type == kWeeklyRecord)) ||
904  (isSearch && (m_type != kDailyRecord && m_type != kWeeklyRecord &&
905  m_type != kOneRecord && m_type != kAllRecord)) ||
906  (isManual && (m_type != kDailyRecord && m_type != kWeeklyRecord &&
908  {
909  msg = QString("Invalid recording type/search type.");
910  return false;
911  }
912 
913  if ((m_parentRecID && !isOverride) ||
914  (!m_parentRecID && isOverride))
915  {
916  msg = QString("Invalid parentID/override.");
917  return false;
918  }
919 
920  // Inactive overrides cause errors so are disallowed.
921  if (isOverride && m_isInactive)
922  {
923  msg = QString("Invalid Inactive Override.");
924  return false;
925  }
926 
927  if (m_title.isEmpty())
928  {
929  msg = QString("Invalid title.");
930  return false;
931  }
932 
933  if (m_searchType == kPowerSearch)
934  {
935  if (m_description.contains(';') || m_subtitle.contains(';'))
936  {
937  msg = QString("Invalid SQL, contains semicolon");
938  return false;
939  }
940  MSqlQuery query(MSqlQuery::InitCon());
941  query.prepare(QString("SELECT NULL FROM (program, channel, oldrecorded AS oldrecstatus) "
942  "%1 WHERE %2 LIMIT 5")
943  .arg(m_subtitle, m_description));
944  if (!query.exec())
945  {
946  msg = QString("Invalid SQL Where clause." + query.lastError().databaseText());
947  return false;
948  }
949  }
950  else if (isSearch)
951  {
952  if (m_description.isEmpty())
953  {
954  msg = QString("Invalid search value.");
955  return false;
956  }
957  }
958 
959  if (m_type != kTemplateRecord && !isSearch)
960  {
961  if (!m_startdate.isValid() || !m_starttime.isValid() ||
962  !m_enddate.isValid() || !m_endtime.isValid())
963  {
964  msg = QString("Invalid start/end date/time.");
965  return false;
966  }
967  qint64 secsto = QDateTime(m_startdate, m_starttime, Qt::UTC)
968  .secsTo(QDateTime(m_enddate, m_endtime, Qt::UTC));
969  if (secsto <= 0 || secsto > (8 * 3600))
970  {
971  msg = QString("Invalid duration.");
972  return false;
973  }
974 
975  if (!m_channelid || m_station.isEmpty())
976  {
977  msg = QString("Invalid channel.");
978  return false;
979  }
980  }
981 
982  if (m_type != kTemplateRecord
983  && (m_findday < 0 || m_findday > 6 || !m_findtime.isValid()) )
984  {
985  msg = QString("Invalid find values.");
986  return false;
987  }
988 
989  if (m_recPriority < -99 || m_recPriority > 99)
990  {
991  msg = QString("Invalid priority.");
992  return false;
993  }
994 
995  if (m_startOffset < -480 || m_startOffset > 480 ||
996  m_endOffset < -480 || m_endOffset > 480)
997  {
998  msg = QString("Invalid start/end offset.");
999  return false;
1000  }
1001 
1002  if (m_prefInput < 0)
1003  {
1004  msg = QString("Invalid preferred input.");
1005  return false;
1006  }
1007 
1008  unsigned valid_mask = (1 << kNumFilters) - 1;
1009  if ((m_filter & valid_mask) != m_filter)
1010  {
1011  msg = QString("Invalid filter value.");
1012  return false;
1013  }
1014 
1015  if (m_recProfile.isEmpty() || (m_recGroupID == 0) ||
1016  m_storageGroup.isEmpty() || m_playGroup.isEmpty())
1017  {
1018  msg = QString("Invalid group value.");
1019  return false;
1020  }
1021 
1022  if (m_maxEpisodes < 0)
1023  {
1024  msg = QString("Invalid max episodes value.");
1025  return false;
1026  }
1027 
1028  if (m_dupIn & ~(kDupsInAll | kDupsNewEpi))
1029  {
1030  msg = QString("Invalid duplicate scope.");
1031  return false;
1032  }
1033 
1036  {
1037  msg = QString("Invalid duplicate method.");
1038  return false;
1039  }
1040 
1041  if (m_transcoder < 0)
1042  {
1043  msg = QString("Invalid transcoder value.");
1044  return false;
1045  }
1046 
1048  {
1049  msg = QString("Invalid auto extend value.");
1050  return false;
1051  }
1052 
1053  return true;
1054 }
RecordingRule::m_isOverride
bool m_isOverride
Definition: recordingrule.h:152
RecordingRule::m_channelid
int m_channelid
callsign?
Definition: recordingrule.h:99
ProgramInfo::GetSortTitle
QString GetSortTitle(void) const
Definition: programinfo.h:363
kDupsNewEpi
@ kDupsNewEpi
Definition: recordingtypes.h:51
RecordingRule::LoadByProgram
bool LoadByProgram(const ProgramInfo *proginfo)
Definition: recordingrule.cpp:168
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:812
kKeywordSearch
@ kKeywordSearch
Definition: recordingtypes.h:83
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:127
RecordingRule::m_autoTranscode
bool m_autoTranscode
Definition: recordingrule.h:132
RecordingRule::ModifyPowerSearchByID
bool ModifyPowerSearchByID(int rid, const QString &textname, QString forwhat, QString joininfo="")
Definition: recordingrule.cpp:347
RecordingRule::m_enddate
QDate m_enddate
Definition: recordingrule.h:90
RecordingRule::m_recordTable
QString m_recordTable
Definition: recordingrule.h:147
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
kWeeklyRecord
@ kWeeklyRecord
Definition: recordingtypes.h:27
RecordingRule::m_description
QString m_description
Definition: recordingrule.h:81
RecordingRule::m_template
QString m_template
Definition: recordingrule.h:163
RecordingRule::m_autoCommFlag
bool m_autoCommFlag
Definition: recordingrule.h:131
RecordingRule::m_inetref
QString m_inetref
Definition: recordingrule.h:87
getMythSortHelper
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
Definition: mythsorthelper.cpp:129
kDupsInAll
@ kDupsInAll
Definition: recordingtypes.h:50
mythdb.h
RecordingRule::m_maxNewest
bool m_maxNewest
Definition: recordingrule.h:127
RecordingRule::m_category
QString m_category
Definition: recordingrule.h:82
RecordingRule::Save
bool Save(bool sendSig=true)
Definition: recordingrule.cpp:390
RecordingRule::m_nextRecording
QDateTime m_nextRecording
Definition: recordingrule.h:142
RecordingRule::m_starttime
QTime m_starttime
Definition: recordingrule.h:91
MythDate::as_utc
QDateTime as_utc(const QDateTime &old_dt)
Returns copy of QDateTime with TimeSpec set to UTC.
Definition: mythdate.cpp:27
PlayGroup::GetInitialName
static QString GetInitialName(const ProgramInfo *pi)
Definition: playgroup.cpp:228
RecordingRule::GetDefaultFilter
static unsigned GetDefaultFilter(void)
Definition: recordingrule.cpp:787
RecordingRule::m_progInfo
const ProgramInfo * m_progInfo
Definition: recordingrule.h:167
kTitleSearch
@ kTitleSearch
Definition: recordingtypes.h:82
RecordingRule::ToMap
void ToMap(InfoMap &infoMap, uint date_format=0) const
Definition: recordingrule.cpp:552
MSqlQuery::lastInsertId
QVariant lastInsertId()
Return the id of the last inserted row.
Definition: mythdbcon.cpp:935
RecordingRule::m_title
QString m_title
Definition: recordingrule.h:77
RecordingRule::m_sortSubtitle
QString m_sortSubtitle
Definition: recordingrule.h:80
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:204
kNotRecording
@ kNotRecording
Definition: recordingtypes.h:22
ProgramInfo::GetChannelSchedulingID
QString GetChannelSchedulingID(void) const
This is the unique programming identifier of a channel.
Definition: programinfo.h:384
ProgramInfo::GetCategory
QString GetCategory(void) const
Definition: programinfo.h:370
RecordingRule::m_averageDelay
int m_averageDelay
Definition: recordingrule.h:141
RecordingRule::m_lastDeleted
QDateTime m_lastDeleted
Definition: recordingrule.h:144
RecSearchType
RecSearchType
Definition: recordingtypes.h:78
RecordingRule::m_endOffset
int m_endOffset
Definition: recordingrule.h:110
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:618
RecordingRule::kNumFilters
static const int kNumFilters
Definition: recordingrule.h:33
ProgramInfo::GetScheduledEndTime
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
Definition: programinfo.h:398
playgroup.h
kSingleRecord
@ kSingleRecord
Definition: recordingtypes.h:23
kPeopleSearch
@ kPeopleSearch
Definition: recordingtypes.h:84
mythsorthelper.h
RecordingRule::m_dupIn
RecordingDupInType m_dupIn
Definition: recordingrule.h:114
AutoExtendType
AutoExtendType
Definition: recordingtypes.h:93
RecordingRule::m_isInactive
bool m_isInactive
Recording rule is enabled?
Definition: recordingrule.h:74
RecordingRule::m_season
uint m_season
Definition: recordingrule.h:94
MythDate::kDateTimeShort
@ kDateTimeShort
Default local time.
Definition: mythdate.h:24
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:14
kDupCheckDesc
@ kDupCheckDesc
Definition: recordingtypes.h:67
RecordingRule::m_findid
int m_findid
Definition: recordingrule.h:102
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
kDontRecord
@ kDontRecord
Definition: recordingtypes.h:30
kDupCheckNone
@ kDupCheckNone
Definition: recordingtypes.h:65
RecordingRule::Load
bool Load(bool asTemplate=false)
Load a single rule from the recorded table.
Definition: recordingrule.cpp:56
ProgramInfo::GetInetRef
QString GetInetRef(void) const
Definition: programinfo.h:441
RecordingRule::m_startOffset
int m_startOffset
Definition: recordingrule.h:109
RecordingRule::GetTemplateNames
static QStringList GetTemplateNames(void)
Definition: recordingrule.cpp:835
RecordingRule::m_isTemplate
bool m_isTemplate
Definition: recordingrule.h:156
RecordingRule::m_episode
uint m_episode
Definition: recordingrule.h:95
mythdate.h
RecordingRule::RecordingRule
RecordingRule()
Definition: recordingrule.cpp:27
ProgramInfo::GetScheduledStartTime
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
Definition: programinfo.h:391
RecordingRule::IsValid
bool IsValid(QString &msg) const
Definition: recordingrule.cpp:859
kOneRecord
@ kOneRecord
Definition: recordingtypes.h:28
MythSortHelper::doTitle
QString doTitle(const QString &title) const
Create the sortable form of an title string.
Definition: mythsorthelper.cpp:163
AutoExtendType::Last
@ Last
MythCoreContext::GetQLocale
QLocale GetQLocale(void)
Definition: mythcorecontext.cpp:1882
RecordingRule::m_autoUserJob4
bool m_autoUserJob4
Definition: recordingrule.h:136
RecordingInfo::GetRecgroupString
static QString GetRecgroupString(uint recGroupID)
Temporary helper during transition from string to ID.
Definition: recordinginfo.cpp:1705
ProgramInfo::GetTitle
QString GetTitle(void) const
Definition: programinfo.h:362
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:550
ProgramInfo::GetDescription
QString GetDescription(void) const
Definition: programinfo.h:366
RecordingRule::m_autoUserJob2
bool m_autoUserJob2
Definition: recordingrule.h:134
kDupCheckSub
@ kDupCheckSub
Definition: recordingtypes.h:66
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:225
RecordingRule::AssignProgramInfo
void AssignProgramInfo()
Definition: recordingrule.cpp:737
RecordingRule::m_findtime
QTime m_findtime
Time for timeslot rules.
Definition: recordingrule.h:101
RecordingRule::m_lastRecorded
QDateTime m_lastRecorded
Definition: recordingrule.h:143
RecordingRule::m_autoExpire
bool m_autoExpire
Definition: recordingrule.h:126
kNoSearch
@ kNoSearch
Definition: recordingtypes.h:80
RecordingRule::m_recProfile
QString m_recProfile
Definition: recordingrule.h:120
RecordingRule::m_tempID
int m_tempID
Definition: recordingrule.h:148
kManualSearch
@ kManualSearch
Definition: recordingtypes.h:85
RecordingRule::m_searchType
RecSearchType m_searchType
Definition: recordingrule.h:112
RecordingRule::m_type
RecordingType m_type
Definition: recordingrule.h:111
kDupCheckSubThenDesc
@ kDupCheckSubThenDesc
Definition: recordingtypes.h:69
RecordingRule::m_subtitle
QString m_subtitle
Definition: recordingrule.h:79
RecordingRule::UseTempTable
void UseTempTable(bool usetemp, const QString &table="record_tmp")
Definition: recordingrule.cpp:677
MSqlQuery::SchedCon
static MSqlQueryInfo SchedCon()
Returns dedicated connection. (Required for using temporary SQL tables.)
Definition: mythdbcon.cpp:580
scheduledrecording.h
kOverrideRecord
@ kOverrideRecord
Definition: recordingtypes.h:29
RecordingRule::m_findday
int m_findday
Day of the week for once per week etc.
Definition: recordingrule.h:104
RecordingRule::m_filter
unsigned m_filter
Definition: recordingrule.h:115
ProgramInfo::GetFindID
uint GetFindID(void) const
Definition: programinfo.h:472
kDailyRecord
@ kDailyRecord
Definition: recordingtypes.h:24
uint
unsigned int uint
Definition: compat.h:81
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
ProgramInfo::GetSeriesID
QString GetSeriesID(void) const
Definition: programinfo.h:439
RecordingRule::MakeTemplate
bool MakeTemplate(QString category)
Definition: recordingrule.cpp:319
RecordingRule::m_maxEpisodes
int m_maxEpisodes
Definition: recordingrule.h:125
ProgramInfo::GetSortSubtitle
QString GetSortSubtitle(void) const
Definition: programinfo.h:365
RecordingRule::m_programid
QString m_programid
Definition: recordingrule.h:85
RecordingRule::m_sortTitle
QString m_sortTitle
Definition: recordingrule.h:78
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:34
RecordingRule::m_recGroupID
uint m_recGroupID
Definition: recordingrule.h:123
RecordingRule::m_endtime
QTime m_endtime
Definition: recordingrule.h:92
MythDate::kSimplify
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
Definition: mythdate.h:26
MSqlQuery::lastError
QSqlError lastError(void) const
Definition: mythdbcon.h:213
RecordingRule::m_storageGroup
QString m_storageGroup
Definition: recordingrule.h:121
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:373
ProgramInfo::GetEpisode
uint GetEpisode(void) const
Definition: programinfo.h:368
RecordingRule::m_transcoder
int m_transcoder
Definition: recordingrule.h:130
RecordingRule::m_autoUserJob1
bool m_autoUserJob1
Definition: recordingrule.h:133
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
RecordingRule::LoadTemplate
bool LoadTemplate(const QString &title, const QString &category="Default", const QString &categoryType="Default")
Definition: recordingrule.cpp:276
RecordingRule::m_recordID
int m_recordID
Unique Recording Rule ID.
Definition: recordingrule.h:70
MythDate::kAddYear
@ kAddYear
Add year to string if not included.
Definition: mythdate.h:25
ProgramInfo::GetSeason
uint GetSeason(void) const
Definition: programinfo.h:367
mythcorecontext.h
RecordingRule::m_dupMethod
RecordingDupMethodType m_dupMethod
Definition: recordingrule.h:113
kTemplateRecord
@ kTemplateRecord
Definition: recordingtypes.h:33
MythDate
Definition: mythdate.cpp:11
ProgramInfo::GetCategoryTypeString
QString GetCategoryTypeString(void) const
Returns catType as a string.
Definition: programinfo.cpp:1892
kPowerSearch
@ kPowerSearch
Definition: recordingtypes.h:81
RecordingRule::ensureSortFields
void ensureSortFields(void)
Ensure that the sortTitle and sortSubtitle fields are set.
Definition: recordingrule.cpp:43
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:888
MythDate::ISODate
@ ISODate
Default UTC.
Definition: mythdate.h:17
RecordingDupMethodType
RecordingDupMethodType
Definition: recordingtypes.h:62
RecordingType
RecordingType
Definition: recordingtypes.h:20
RecordingRule::m_autoExtend
AutoExtendType m_autoExtend
Definition: recordingrule.h:116
RecordingRule::m_loaded
bool m_loaded
Definition: recordingrule.h:171
kAllRecord
@ kAllRecord
Definition: recordingtypes.h:26
RecordingRule::Delete
bool Delete(bool sendSig=true)
Definition: recordingrule.cpp:509
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:19
RecordingRule::MakeOverride
bool MakeOverride(void)
Definition: recordingrule.cpp:368
recordingprofile.h
ProgramInfo::GetProgramID
QString GetProgramID(void) const
Definition: programinfo.h:440
RecordingProfile
Definition: recordingprofile.h:41
MythDate::kDateTimeFull
@ kDateTimeFull
Default local time.
Definition: mythdate.h:23
RecordingRule::m_station
QString m_station
Definition: recordingrule.h:98
MythDate::kTime
@ kTime
Default local time.
Definition: mythdate.h:22
ProgramInfo::GetRecordingRuleID
uint GetRecordingRuleID(void) const
Definition: programinfo.h:453
recordingrule.h
RecordingRule::m_recPriority
int m_recPriority
Definition: recordingrule.h:107
RecordingRule::m_autoUserJob3
bool m_autoUserJob3
Definition: recordingrule.h:135
ScheduledRecording::RescheduleMatch
static void RescheduleMatch(uint recordid, uint sourceid, uint mplexid, const QDateTime &maxstarttime, const QString &why)
Definition: scheduledrecording.h:17
RecordingRule::LoadBySearch
bool LoadBySearch(RecSearchType lsearch, const QString &textname, const QString &forwhat, QString joininfo="", ProgramInfo *pginfo=nullptr)
Load a recording rule based on search parameters.
Definition: recordingrule.cpp:216
RecordingDupInType
RecordingDupInType
Definition: recordingtypes.h:45
RecordingRule::m_startdate
QDate m_startdate
Definition: recordingrule.h:89
RecordingRule::m_autoMetadataLookup
bool m_autoMetadataLookup
Definition: recordingrule.h:137
null_to_empty
static QString null_to_empty(const QString &str)
Definition: recordingrule.cpp:17
RecordingRule::m_prefInput
int m_prefInput
Definition: recordingrule.h:108
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:837
RecordingRule::SearchTypeToString
static QString SearchTypeToString(RecSearchType searchType)
Definition: recordingrule.cpp:806
ProgramInfo::GetSubtitle
QString GetSubtitle(void) const
Definition: programinfo.h:364