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