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 <QChar> // Fix Qt6 GCC SFINAE warning
6#include <QDateTime>
7#include <QDate>
8#include <QTime>
9#include <QStringList>
10#include <QCoreApplication>
11
12// MythTV
13#include "libmythtv/mythtvexp.h"
19
31{
33
34 public:
35 static const int kNumFilters = 16;
36
38 ~RecordingRule() = default;
39
40 void ensureSortFields(void);
41 bool Load(bool asTemplate = false);
42 bool LoadByProgram(const ProgramInfo* proginfo);
43 bool LoadBySearch(RecSearchType lsearch, const QString& textname, const QString& forwhat,
44 QString joininfo = "", ProgramInfo *pginfo = nullptr);
45 bool LoadTemplate(const QString& title,
46 const QString& category = "Default",
47 const QString& categoryType = "Default");
48
49 bool ModifyPowerSearchByID(int rid, const QString& textname, QString forwhat,
50 QString joininfo = "");
51 bool MakeOverride(void);
52 bool MakeTemplate(QString category);
53
54 bool Save(bool sendSig = true);
55 bool Delete(bool sendSig = true);
56
57 bool IsLoaded() const { return m_loaded; }
58 void UseTempTable(bool usetemp, const QString& table = "record_tmp");
59 static unsigned GetDefaultFilter(void);
60
61 void ToMap(InfoMap &infoMap, uint date_format = 0) const;
62
64 { return m_autoExpire ? kNormalAutoExpire : kDisableAutoExpire; }
65
66 bool IsValid(QString &msg) const;
67
68 static QString SearchTypeToString(RecSearchType searchType);
69 static QStringList GetTemplateNames(void);
70
72 int m_recordID {-1};
73 int m_parentRecID {0};
74
76 bool m_isInactive {false};
77
78 // Recording metadata
79 QString m_title;
80 QString m_sortTitle;
81 QString m_subtitle;
84 QString m_category;
85
86 QString m_seriesid;
87 QString m_programid;
88 // String could be null when we trying to insert into DB
89 QString m_inetref;
90
92 QDate m_enddate;
94 QTime m_endtime;
95
96 uint m_season {0};
97 uint m_episode {0};
98
99 // Associated data for rule types
100 QString m_station;
101 int m_channelid {0};
106 int m_findday {0};
107
108 // Scheduling Options
109 int m_recPriority {0};
110 int m_prefInput {0};
111 int m_startOffset {0};
112 int m_endOffset {0};
114 RecSearchType m_searchType {kNoSearch};
117 unsigned m_filter {0};
119
120 // Storage Options
121 // TODO: These should all be converted to integer IDs instead
122 QString m_recProfile {tr("Default")};
123 QString m_storageGroup {tr("Default")};
124 QString m_playGroup {tr("Default")};
126
127 int m_maxEpisodes {0};
128 bool m_autoExpire {false};
129 bool m_maxNewest {false};
130
131 // Post Processing Options
133 bool m_autoCommFlag {true};
134 bool m_autoTranscode {false};
135 bool m_autoUserJob1 {false};
136 bool m_autoUserJob2 {false};
137 bool m_autoUserJob3 {false};
138 bool m_autoUserJob4 {false};
139 bool m_autoMetadataLookup {true};
140
141 // Statistic fields - Used to generate statistics about particular rules
142 // and influence watch list weighting
143 int m_averageDelay {100};
145 QDateTime m_lastRecorded;
146 QDateTime m_lastDeleted;
147
148 // Temporary table related - Used for schedule previews
149 QString m_recordTable {"record"};
150 int m_tempID {0};
151
152 // Is this an override rule? Purely for the benefit of the UI, we display
153 // different options for override rules
154 bool m_isOverride {false};
155
156 // Is this a template rule? Purely for the benefit of the UI, we
157 // display all options for template rules
158 bool m_isTemplate {false};
159
160 private:
161 // Populate variables from a ProgramInfo object
162 void AssignProgramInfo();
163
164 // Name of template used for new rule.
165 QString m_template;
166
167 // Pointer for ProgramInfo, exists only if we loaded from ProgramInfo in
168 // the first place
169 const ProgramInfo *m_progInfo {nullptr};
170
171 // Indicate that a rule has been loaded, for new rules this is still true
172 // after any of the Load* methods is called
173 bool m_loaded {false};
174};
175
177
178#endif
Holds information on recordings and videos.
Definition: programinfo.h:74
static const uint kTranscoderAutodetect
sentinel value
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:31
QString m_sortSubtitle
Definition: recordingrule.h:82
QString m_station
QString m_programid
Definition: recordingrule.h:87
QString m_category
Definition: recordingrule.h:84
AutoExpireType GetAutoExpire(void) const
Definition: recordingrule.h:63
QString m_inetref
Definition: recordingrule.h:89
Q_DECLARE_TR_FUNCTIONS(RecordingRule)
QTime m_findtime
Time for timeslot rules.
QString m_description
Definition: recordingrule.h:83
QDateTime m_nextRecording
QString m_title
Definition: recordingrule.h:79
QString m_subtitle
Definition: recordingrule.h:81
QDateTime m_lastDeleted
~RecordingRule()=default
QString m_template
QString m_seriesid
Definition: recordingrule.h:86
QDateTime m_lastRecorded
bool IsLoaded() const
Definition: recordingrule.h:57
QString m_sortTitle
Definition: recordingrule.h:80
unsigned int uint
Definition: compat.h:60
Q_DECLARE_METATYPE(std::chrono::seconds)
#define MTV_PUBLIC
Definition: mythtvexp.h:8
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
AutoExpireType
Definition: programtypes.h:192
@ kDisableAutoExpire
Definition: programtypes.h:193
@ kNormalAutoExpire
Definition: programtypes.h:194
RecSearchType
@ kNoSearch
AutoExtendType
RecordingDupInType
@ kDupsInAll
RecordingType
@ kNotRecording
RecordingDupMethodType
@ kDupCheckSubThenDesc