MythTV  master
recordingrule.h
Go to the documentation of this file.
1 #ifndef RECORDING_RULE_H
2 #define RECORDING_RULE_H
3 
4 // QT
5 #include <QDateTime>
6 #include <QDate>
7 #include <QTime>
8 #include <QStringList>
9 #include <QCoreApplication>
10 
11 // libmythbase
12 #include "mythtvexp.h"
13 
14 // libmyth
15 #include "programinfo.h"
16 
17 // libmythtv
18 #include "programtypes.h"
19 #include "recordingtypes.h"
20 
32 {
33  Q_DECLARE_TR_FUNCTIONS(RecordingRule);
34 
35  public:
36  static const int kNumFilters = 12;
37 
38  RecordingRule();
39  ~RecordingRule() = default;
40 
41  void ensureSortFields(void);
42  bool Load(bool asTemplate = false);
43  bool LoadByProgram(const ProgramInfo* proginfo);
44  bool LoadBySearch(RecSearchType lsearch, QString textname, QString forwhat,
45  QString joininfo = "", ProgramInfo *pginfo = nullptr);
46  bool LoadTemplate(QString category, QString categoryType = "Default");
47 
48  bool ModifyPowerSearchByID(int rid, QString textname, QString forwhat,
49  QString joininfo = "");
50  bool MakeOverride(void);
51  bool MakeTemplate(QString category);
52 
53  bool Save(bool sendSig = true);
54  bool Delete(bool sendSig = true);
55 
56  bool IsLoaded() const { return m_loaded; }
57  void UseTempTable(bool usetemp, QString table = "record_tmp");
58  static unsigned GetDefaultFilter(void);
59 
60  void ToMap(InfoMap &infoMap) const;
61 
63  { return m_autoExpire ? kNormalAutoExpire : kDisableAutoExpire; }
64 
65  bool IsValid(QString &text);
66 
67  static QString SearchTypeToString(const RecSearchType searchType);
68  static QStringList GetTemplateNames(void);
69 
70  int m_recordID;
72 
73  bool m_isInactive;
74 
75  // Recording metadata
76  QString m_title;
77  QString m_sortTitle;
78  QString m_subtitle;
79  QString m_sortSubtitle;
80  QString m_description;
83  QString m_category;
84 
85  QTime m_starttime;
86  QDate m_startdate;
87  QTime m_endtime;
88  QDate m_enddate;
89 
90  QString m_seriesid;
91  QString m_programid;
92  QString m_inetref;
93 
94  // Associated data for rule types
96  QString m_station;
97  int m_findday;
98  QTime m_findtime;
99  int m_findid;
100 
101  // Scheduling Options
110  unsigned m_filter;
111 
112  // Storage Options
113  // TODO: These should all be converted to integer IDs instead
114  QString m_recProfile;
116  QString m_storageGroup;
117  QString m_playGroup;
118 
122 
123  // Post Processing Options
132 
133  // Statistic fields - Used to generate statistics about particular rules
134  // and influence watch list weighting
135  QDateTime m_nextRecording;
136  QDateTime m_lastRecorded;
137  QDateTime m_lastDeleted;
139 
140  // Temporary table related - Used for schedule previews
141  QString m_recordTable;
142  int m_tempID;
143 
144  // Is this an override rule? Purely for the benefit of the UI, we display
145  // different options for override rules
147 
148  // Is this a template rule? Purely for the benefit of the UI, we
149  // display all options for template rules
151 
152  private:
153  // Populate variables from a ProgramInfo object
154  void AssignProgramInfo();
155 
156  // Name of template used for new rule.
157  QString m_template;
158 
159  // Pointer for ProgramInfo, exists only if we loaded from ProgramInfo in
160  // the first place
162 
163  // Indicate that a rule has been loaded, for new rules this is still true
164  // after any of the Load* methods is called
165  bool m_loaded;
166 };
167 
169 
170 #endif
QString m_subtitle
Definition: recordingrule.h:78
enum RecSearchTypes RecSearchType
QTime m_findtime
Day of the week for once per week etc.
Definition: recordingrule.h:98
QString m_programid
Definition: recordingrule.h:91
QString m_sortTitle
Definition: recordingrule.h:77
enum RecordingDupInTypes RecordingDupInType
QString m_storageGroup
QString m_station
Definition: recordingrule.h:96
unsigned int uint
Definition: compat.h:140
RecordingType m_type
RecordingDupMethodType m_dupMethod
Q_DECLARE_METATYPE(GrabberScript *)
QDateTime m_nextRecording
RecordingDupMethodType
Holds information on recordings and videos.
Definition: programinfo.h:66
QDateTime m_lastRecorded
#define MTV_PUBLIC
Definition: mythtvexp.h:15
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
QString m_recordTable
bool m_autoMetadataLookup
int m_findday
callsign?
Definition: recordingrule.h:97
QString m_playGroup
QString m_description
Definition: recordingrule.h:80
QString m_template
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:31
QString m_seriesid
Definition: recordingrule.h:90
int m_parentRecID
Unique Recording Rule ID.
Definition: recordingrule.h:71
RecordingDupInType m_dupIn
QString m_inetref
Definition: recordingrule.h:92
bool IsLoaded() const
Definition: recordingrule.h:56
QString m_title
Recording rule is enabled?
Definition: recordingrule.h:76
const ProgramInfo * m_progInfo
QDateTime m_lastDeleted
QString m_sortSubtitle
Definition: recordingrule.h:79
enum AutoExpireTypes AutoExpireType
QString m_recProfile
unsigned m_filter
QString m_category
Definition: recordingrule.h:83
AutoExpireType GetAutoExpire(void) const
Definition: recordingrule.h:62
int m_findid
Time for timeslot rules.
Definition: recordingrule.h:99
RecSearchType m_searchType