Skip to content

Commit a1f9793

Browse files
committed
Remove and restrict the use of some recording rule types.
This is another change in the series of changes to remove some scheduler related features and settings that the developers no longer believe are needed or want to support. Remove the Timeslot and Weekslot recording rule types. These rule types are too rigid and don't work when a broadcaster shifts the starting time of a program by a few minutes. Users should now use Channel recording rules in place of Timeslot and Weekslot rules. To approximate the old functionality, two new schedule filters have been added. In addition, the new "This time" and "This day and time" filters are less strict and match any program starting within 10 minutes of the recording rule time. Restrict the use of the FindDaily and FindWeekly recording rule types (now simply called Daily and Weekly) to search and manual recording rules. These rule types are rarely needed and limiting their use to the most powerful cases simplifies the user interface for the more common cases. Users should now use Daily and Weekly, custom search rules in place of FindDaily and FindWeekly rules. Any existing recording rules using the no longer supported or allowed types are automatically converted to the suggested alternatives.
1 parent 3872d27 commit a1f9793

20 files changed

+199
-267
lines changed

mythtv/bindings/perl/MythTV.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ package MythTV;
115115
# schema version supported in the main code. We need to check that the schema
116116
# version in the database is as expected by the bindings, which are expected
117117
# to be kept in sync with the main code.
118-
our $SCHEMA_VERSION = "1308";
118+
our $SCHEMA_VERSION = "1309";
119119

120120
# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
121121
# the number of items in a ProgramInfo QStringList group used by

mythtv/bindings/python/MythTV/dataheap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ def fromPowerRule(cls, title='unnamed (Power Search)', where='', args=None,
214214
join='', db=None, type=RECTYPE.kAllRecord,
215215
searchtype=RECSEARCHTYPE.kPowerSearch, wait=False):
216216

217-
if type not in (RECTYPE.kAllRecord, RECTYPE.kFindDailyRecord,
218-
RECTYPE.kFindWeeklyRecord, RECTYPE.kFindOneRecord):
217+
if type not in (RECTYPE.kAllRecord, RECTYPE.kDailyRecord,
218+
RECTYPE.kWeeklyRecord, RECTYPE.kOneRecord):
219219
raise MythDBError("Invalid 'type' set for power recording rule.")
220220

221221
rec = cls(None, db=db)

mythtv/bindings/python/MythTV/static.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66

77
OWN_VERSION = (0,27,-1,0)
8-
SCHEMA_VERSION = 1308
8+
SCHEMA_VERSION = 1309
99
NVSCHEMA_VERSION = 1007
1010
MUSICSCHEMA_VERSION = 1018
1111
PROTO_VERSION = '76'
@@ -38,15 +38,16 @@ class MARKUP( object ):
3838
class RECTYPE( object ):
3939
kNotRecording = 0
4040
kSingleRecord = 1
41-
kTimeslotRecord = 2
41+
kDailyRecord = 2
4242
kChannelRecord = 3
4343
kAllRecord = 4
44-
kWeekslotRecord = 5
45-
kFindOneRecord = 6
44+
kWeeklyRecord = 5
45+
kOneRecord = 6
4646
kOverrideRecord = 7
4747
kDontRecord = 8
48-
kFindDailyRecord = 9
49-
kFindWeeklyRecord = 10
48+
#kFindDailyRecord = 9 (Obsolete)
49+
#kFindWeeklyRecord = 10 (Obsolete)
50+
kTemplateRecord = 11
5051

5152
class RECSEARCHTYPE( object ):
5253
kNoSearch = 0

mythtv/libs/libmyth/programinfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ bool ProgramInfo::IsSameProgramWeakCheck(const ProgramInfo &other) const
19771977
*/
19781978
bool ProgramInfo::IsSameProgram(const ProgramInfo& other) const
19791979
{
1980-
if (GetRecordingRuleType() == kFindOneRecord)
1980+
if (GetRecordingRuleType() == kOneRecord)
19811981
return recordid == other.recordid;
19821982

19831983
if (findid && findid == other.findid &&

mythtv/libs/libmyth/recordingtypes.cpp

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ int RecTypePrecedence(RecordingType rectype)
1212
case kDontRecord: return 1; break;
1313
case kOverrideRecord: return 2; break;
1414
case kSingleRecord: return 3; break;
15-
case kFindOneRecord: return 4; break;
16-
case kWeekslotRecord: return 5; break;
17-
case kFindWeeklyRecord: return 6; break;
18-
case kTimeslotRecord: return 7; break;
19-
case kFindDailyRecord: return 8; break;
15+
case kOneRecord: return 4; break;
16+
case kWeeklyRecord: return 6; break;
17+
case kDailyRecord: return 8; break;
2018
case kChannelRecord: return 9; break;
2119
case kAllRecord: return 10; break;
2220
case kTemplateRecord: return 0; break;
@@ -31,20 +29,16 @@ QString toString(RecordingType rectype)
3129
{
3230
case kSingleRecord:
3331
return QObject::tr("Single Record");
34-
case kTimeslotRecord:
35-
return QObject::tr("Record Daily");
36-
case kWeekslotRecord:
37-
return QObject::tr("Record Weekly");
3832
case kChannelRecord:
3933
return QObject::tr("Channel Record");
4034
case kAllRecord:
4135
return QObject::tr("Record All");
42-
case kFindOneRecord:
43-
return QObject::tr("Find One");
44-
case kFindDailyRecord:
45-
return QObject::tr("Find Daily");
46-
case kFindWeeklyRecord:
47-
return QObject::tr("Find Weekly");
36+
case kOneRecord:
37+
return QObject::tr("Record One");
38+
case kDailyRecord:
39+
return QObject::tr("Record Daily");
40+
case kWeeklyRecord:
41+
return QObject::tr("Record Weekly");
4842
case kOverrideRecord:
4943
case kDontRecord:
5044
return QObject::tr("Override Recording");
@@ -62,20 +56,16 @@ QString toRawString(RecordingType rectype)
6256
{
6357
case kSingleRecord:
6458
return QString("Single Record");
65-
case kTimeslotRecord:
66-
return QString("Record Daily");
67-
case kWeekslotRecord:
68-
return QString("Record Weekly");
6959
case kChannelRecord:
7060
return QString("Channel Record");
7161
case kAllRecord:
7262
return QString("Record All");
73-
case kFindOneRecord:
74-
return QString("Find One");
75-
case kFindDailyRecord:
76-
return QString("Find Daily");
77-
case kFindWeeklyRecord:
78-
return QString("Find Weekly");
63+
case kOneRecord:
64+
return QString("Record One");
65+
case kDailyRecord:
66+
return QString("Record Daily");
67+
case kWeeklyRecord:
68+
return QString("Record Weekly");
7969
case kOverrideRecord:
8070
case kDontRecord:
8171
return QString("Override Recording");
@@ -90,20 +80,19 @@ RecordingType recTypeFromString(QString type)
9080
return kNotRecording;
9181
if (type.toLower() == "single record" || type.toLower() == "single")
9282
return kSingleRecord;
93-
else if (type.toLower() == "record daily" || type.toLower() == "daily")
94-
return kTimeslotRecord;
95-
else if (type.toLower() == "record weekly" || type.toLower() == "weekly")
96-
return kWeekslotRecord;
9783
else if (type.toLower() == "channel record" || type.toLower() == "channel")
9884
return kChannelRecord;
9985
else if (type.toLower() == "record all" || type.toLower() == "all")
10086
return kAllRecord;
101-
else if (type.toLower() == "find one" || type.toLower() == "findone")
102-
return kFindOneRecord;
103-
else if (type.toLower() == "find daily" || type.toLower() == "finddaily")
104-
return kFindDailyRecord;
105-
else if (type.toLower() == "find weekly" || type.toLower() == "findweekly")
106-
return kFindWeeklyRecord;
87+
else if (type.toLower() == "record one" || type.toLower() == "one" ||
88+
type.toLower() == "find one" || type.toLower() == "findone")
89+
return kOneRecord;
90+
else if (type.toLower() == "record daily" || type.toLower() == "daily" ||
91+
type.toLower() == "find daily" || type.toLower() == "finddaily")
92+
return kDailyRecord;
93+
else if (type.toLower() == "record weekly" || type.toLower() == "weekly" ||
94+
type.toLower() == "find weekly" || type.toLower() == "findweekly")
95+
return kWeeklyRecord;
10796
else if (type.toLower() == "template" || type.toLower() == "template")
10897
return kTemplateRecord;
10998
else if (type.toLower() == "override recording" || type.toLower() == "override")
@@ -120,26 +109,22 @@ QChar toQChar(RecordingType rectype)
120109
{
121110
case kSingleRecord:
122111
ret = QObject::tr("S", "RecTypeChar kSingleRecord"); break;
123-
case kTimeslotRecord:
124-
ret = QObject::tr("T", "RecTypeChar kTimeslotRecord"); break;
125-
case kWeekslotRecord:
126-
ret = QObject::tr("W", "RecTypeChar kWeekslotRecord"); break;
127112
case kChannelRecord:
128113
ret = QObject::tr("C", "RecTypeChar kChannelRecord"); break;
129114
case kAllRecord:
130115
ret = QObject::tr("A", "RecTypeChar kAllRecord"); break;
131-
case kFindOneRecord:
132-
ret = QObject::tr("F", "RecTypeChar kFindOneRecord"); break;
133-
case kFindDailyRecord:
134-
ret = QObject::tr("d", "RecTypeChar kFindDailyRecord"); break;
135-
case kFindWeeklyRecord:
136-
ret = QObject::tr("w", "RecTypeChar kFindWeeklyRecord"); break;
116+
case kOneRecord:
117+
ret = QObject::tr("1", "RecTypeChar kOneRecord"); break;
118+
case kDailyRecord:
119+
ret = QObject::tr("D", "RecTypeChar kDailyRecord"); break;
120+
case kWeeklyRecord:
121+
ret = QObject::tr("W", "RecTypeChar kWeeklyRecord"); break;
137122
case kOverrideRecord:
138123
case kDontRecord:
139124
ret = QObject::tr("O", "RecTypeChar kOverrideRecord/kDontRecord");
140125
break;
141126
case kTemplateRecord:
142-
ret = QObject::tr("t", "RecTypeChar kTemplateRecord"); break;
127+
ret = QObject::tr("T", "RecTypeChar kTemplateRecord"); break;
143128
case kNotRecording:
144129
default:
145130
ret = " ";

mythtv/libs/libmyth/recordingtypes.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ typedef enum RecordingTypes
2020
{
2121
kNotRecording = 0,
2222
kSingleRecord = 1,
23-
kTimeslotRecord,
24-
kChannelRecord,
25-
kAllRecord,
26-
kWeekslotRecord,
27-
kFindOneRecord,
28-
kOverrideRecord,
29-
kDontRecord,
30-
kFindDailyRecord,
31-
kFindWeeklyRecord,
32-
kTemplateRecord
23+
kDailyRecord = 2,
24+
kChannelRecord = 3,
25+
kAllRecord = 4,
26+
kWeeklyRecord = 5,
27+
kOneRecord = 6,
28+
kOverrideRecord = 7,
29+
kDontRecord = 8,
30+
//kFindDailyRecord = 9, (Obsolete)
31+
//kFindWeeklyRecord = 10, (Obsolete)
32+
kTemplateRecord = 11
3333
} RecordingType; // note stored in uint8_t in ProgramInfo
3434
MPUBLIC QString toString(RecordingType);
3535
MPUBLIC QString toRawString(RecordingType);

mythtv/libs/libmythbase/mythversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/// Update this whenever the plug-in API changes.
1313
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
1414
/// libmythui class methods used by plug-ins.
15-
#define MYTH_BINARY_VERSION "0.27.20121204-1"
15+
#define MYTH_BINARY_VERSION "0.27.20121204-2"
1616

1717
/** \brief Increment this whenever the MythTV network protocol changes.
1818
*
@@ -57,7 +57,7 @@
5757
* mythtv/bindings/php/MythBackend.php
5858
#endif
5959

60-
#define MYTH_DATABASE_VERSION "1308"
60+
#define MYTH_DATABASE_VERSION "1309"
6161

6262

6363
MBASE_PUBLIC const char *GetMythSourceVersion();

mythtv/libs/libmythtv/dbcheck.cpp

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,6 @@ NULL
22792279

22802280
if (dbver == "1307")
22812281
{
2282-
22832282
const char *updates[] = {
22842283
"ALTER TABLE channel MODIFY COLUMN icon varchar(255) NOT NULL DEFAULT '';",
22852284
"UPDATE channel SET icon='' WHERE icon='none';",
@@ -2289,6 +2288,45 @@ NULL
22892288
return false;
22902289
}
22912290

2291+
if (dbver == "1308")
2292+
{
2293+
const char *updates[] = {
2294+
// Add this time filter
2295+
"REPLACE INTO recordfilter (filterid, description, clause, newruledefault) "
2296+
" VALUES (8, 'This time', 'ABS(TIMESTAMPDIFF(MINUTE, CONVERT_TZ("
2297+
" ADDTIME(RECTABLE.startdate, RECTABLE.starttime), ''UTC'', ''SYSTEM''), "
2298+
" CONVERT_TZ(program.starttime, ''UTC'', ''SYSTEM''))) MOD 1440 <= 10', 0)",
2299+
// Add this day and time filter
2300+
"REPLACE INTO recordfilter (filterid, description, clause, newruledefault) "
2301+
" VALUES (9, 'This day and time', 'ABS(TIMESTAMPDIFF(MINUTE, CONVERT_TZ("
2302+
" ADDTIME(RECTABLE.startdate, RECTABLE.starttime), ''UTC'', ''SYSTEM''), "
2303+
" CONVERT_TZ(program.starttime, ''UTC'', ''SYSTEM''))) MOD 10080 <= 10', 0)",
2304+
// Convert old, normal Timeslot rules to Channel with time filter
2305+
"UPDATE record SET type = 3, filter = filter|256 "
2306+
" WHERE type = 2 AND search = 0",
2307+
// Convert old, normal Weekslot rules to Channel with day and time filter
2308+
"UPDATE record SET type = 3, filter = filter|512 "
2309+
" WHERE type = 5 AND search = 0",
2310+
// Convert old, normal find daily to new, power search, find daily
2311+
"UPDATE record SET type = 2, search = 1, chanid = 0, station = '', "
2312+
" subtitle = '', description = CONCAT('program.title = ''', "
2313+
" REPLACE(title, '''', ''''''), ''''), "
2314+
" title = CONCAT(title, ' (Power Search)') WHERE type = 9 AND search = 0",
2315+
// Convert old, normal find weekly to new, power search, find weekly
2316+
"UPDATE record SET type = 5, search = 1, chanid = 0, station = '', "
2317+
" subtitle = '', description = CONCAT('program.title = ''', "
2318+
" REPLACE(title, '''', ''''''), ''''), "
2319+
" title = CONCAT(title, ' (Power Search)') WHERE type = 10 AND search = 0",
2320+
// Convert old, find daily to new, find daily
2321+
"UPDATE record SET type = 2 WHERE type = 9",
2322+
// Convert old, find weekly to new, find weekly
2323+
"UPDATE record SET type = 5 WHERE type = 10",
2324+
NULL
2325+
};
2326+
if (!performActualUpdate(&updates[0], "1309", dbver))
2327+
return false;
2328+
}
2329+
22922330
return true;
22932331
}
22942332

mythtv/libs/libmythtv/recordinginfo.cpp

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -772,12 +772,11 @@ void RecordingInfo::ApplyTranscoderProfileChange(const QString &profile) const
772772
* If the program recording status is kNotRecording,
773773
* ApplyRecordStateChange(kSingleRecord) is called.
774774
* If the program recording status is kSingleRecording,
775-
* ApplyRecordStateChange(kFindOneRecord) is called.
775+
* ApplyRecordStateChange(kOneRecord) is called.
776776
* <br>etc...
777777
*
778-
* The states in order are: kNotRecording, kSingleRecord, kFindOneRecord,
779-
* kWeekslotRecord, kFindWeeklyRecord, kTimeslotRecord, kFindDailyRecord,
780-
* kChannelRecord, kAllRecord.<br>
778+
* The states in order are: kNotRecording, kSingleRecord, kOneRecord,
779+
* kWeeklyRecord, kDailyRecord, kChannelRecord, kAllRecord.<br>
781780
* And: kOverrideRecord, kDontRecord.
782781
*
783782
* That is if you the recording is in any of the first set of states,
@@ -794,9 +793,9 @@ void RecordingInfo::ToggleRecord(void)
794793
ApplyRecordStateChange(kSingleRecord);
795794
break;
796795
case kSingleRecord:
797-
ApplyRecordStateChange(kFindOneRecord);
796+
ApplyRecordStateChange(kOneRecord);
798797
break;
799-
case kFindOneRecord:
798+
case kOneRecord:
800799
ApplyRecordStateChange(kAllRecord);
801800
break;
802801
case kAllRecord:
@@ -813,42 +812,6 @@ void RecordingInfo::ToggleRecord(void)
813812
default:
814813
ApplyRecordStateChange(kAllRecord);
815814
break;
816-
/*
817-
case kNotRecording:
818-
ApplyRecordStateChange(kSingleRecord);
819-
break;
820-
case kSingleRecord:
821-
ApplyRecordStateChange(kFindOneRecord);
822-
break;
823-
case kFindOneRecord:
824-
ApplyRecordStateChange(kWeekslotRecord);
825-
break;
826-
case kWeekslotRecord:
827-
ApplyRecordStateChange(kFindWeeklyRecord);
828-
break;
829-
case kFindWeeklyRecord:
830-
ApplyRecordStateChange(kTimeslotRecord);
831-
break;
832-
case kTimeslotRecord:
833-
ApplyRecordStateChange(kFindDailyRecord);
834-
break;
835-
case kFindDailyRecord:
836-
ApplyRecordStateChange(kChannelRecord);
837-
break;
838-
case kChannelRecord:
839-
ApplyRecordStateChange(kAllRecord);
840-
break;
841-
case kAllRecord:
842-
default:
843-
ApplyRecordStateChange(kNotRecording);
844-
break;
845-
case kOverrideRecord:
846-
ApplyRecordStateChange(kDontRecord);
847-
break;
848-
case kDontRecord:
849-
ApplyRecordStateChange(kOverrideRecord);
850-
break;
851-
*/
852815
}
853816
}
854817

0 commit comments

Comments
 (0)