Skip to content

Commit

Permalink
Remove and restrict the use of some recording rule types.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gigem committed Dec 5, 2012
1 parent 3872d27 commit a1f9793
Show file tree
Hide file tree
Showing 20 changed files with 199 additions and 267 deletions.
2 changes: 1 addition & 1 deletion mythtv/bindings/perl/MythTV.pm
Expand Up @@ -115,7 +115,7 @@ package MythTV;
# schema version supported in the main code. We need to check that the schema
# version in the database is as expected by the bindings, which are expected
# to be kept in sync with the main code.
our $SCHEMA_VERSION = "1308";
our $SCHEMA_VERSION = "1309";

# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
Expand Down
4 changes: 2 additions & 2 deletions mythtv/bindings/python/MythTV/dataheap.py
Expand Up @@ -214,8 +214,8 @@ def fromPowerRule(cls, title='unnamed (Power Search)', where='', args=None,
join='', db=None, type=RECTYPE.kAllRecord,
searchtype=RECSEARCHTYPE.kPowerSearch, wait=False):

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

rec = cls(None, db=db)
Expand Down
13 changes: 7 additions & 6 deletions mythtv/bindings/python/MythTV/static.py
Expand Up @@ -5,7 +5,7 @@
"""

OWN_VERSION = (0,27,-1,0)
SCHEMA_VERSION = 1308
SCHEMA_VERSION = 1309
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '76'
Expand Down Expand Up @@ -38,15 +38,16 @@ class MARKUP( object ):
class RECTYPE( object ):
kNotRecording = 0
kSingleRecord = 1
kTimeslotRecord = 2
kDailyRecord = 2
kChannelRecord = 3
kAllRecord = 4
kWeekslotRecord = 5
kFindOneRecord = 6
kWeeklyRecord = 5
kOneRecord = 6
kOverrideRecord = 7
kDontRecord = 8
kFindDailyRecord = 9
kFindWeeklyRecord = 10
#kFindDailyRecord = 9 (Obsolete)
#kFindWeeklyRecord = 10 (Obsolete)
kTemplateRecord = 11

class RECSEARCHTYPE( object ):
kNoSearch = 0
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/programinfo.cpp
Expand Up @@ -1977,7 +1977,7 @@ bool ProgramInfo::IsSameProgramWeakCheck(const ProgramInfo &other) const
*/
bool ProgramInfo::IsSameProgram(const ProgramInfo& other) const
{
if (GetRecordingRuleType() == kFindOneRecord)
if (GetRecordingRuleType() == kOneRecord)
return recordid == other.recordid;

if (findid && findid == other.findid &&
Expand Down
77 changes: 31 additions & 46 deletions mythtv/libs/libmyth/recordingtypes.cpp
Expand Up @@ -12,11 +12,9 @@ int RecTypePrecedence(RecordingType rectype)
case kDontRecord: return 1; break;
case kOverrideRecord: return 2; break;
case kSingleRecord: return 3; break;
case kFindOneRecord: return 4; break;
case kWeekslotRecord: return 5; break;
case kFindWeeklyRecord: return 6; break;
case kTimeslotRecord: return 7; break;
case kFindDailyRecord: return 8; break;
case kOneRecord: return 4; break;
case kWeeklyRecord: return 6; break;
case kDailyRecord: return 8; break;
case kChannelRecord: return 9; break;
case kAllRecord: return 10; break;
case kTemplateRecord: return 0; break;
Expand All @@ -31,20 +29,16 @@ QString toString(RecordingType rectype)
{
case kSingleRecord:
return QObject::tr("Single Record");
case kTimeslotRecord:
return QObject::tr("Record Daily");
case kWeekslotRecord:
return QObject::tr("Record Weekly");
case kChannelRecord:
return QObject::tr("Channel Record");
case kAllRecord:
return QObject::tr("Record All");
case kFindOneRecord:
return QObject::tr("Find One");
case kFindDailyRecord:
return QObject::tr("Find Daily");
case kFindWeeklyRecord:
return QObject::tr("Find Weekly");
case kOneRecord:
return QObject::tr("Record One");
case kDailyRecord:
return QObject::tr("Record Daily");
case kWeeklyRecord:
return QObject::tr("Record Weekly");
case kOverrideRecord:
case kDontRecord:
return QObject::tr("Override Recording");
Expand All @@ -62,20 +56,16 @@ QString toRawString(RecordingType rectype)
{
case kSingleRecord:
return QString("Single Record");
case kTimeslotRecord:
return QString("Record Daily");
case kWeekslotRecord:
return QString("Record Weekly");
case kChannelRecord:
return QString("Channel Record");
case kAllRecord:
return QString("Record All");
case kFindOneRecord:
return QString("Find One");
case kFindDailyRecord:
return QString("Find Daily");
case kFindWeeklyRecord:
return QString("Find Weekly");
case kOneRecord:
return QString("Record One");
case kDailyRecord:
return QString("Record Daily");
case kWeeklyRecord:
return QString("Record Weekly");
case kOverrideRecord:
case kDontRecord:
return QString("Override Recording");
Expand All @@ -90,20 +80,19 @@ RecordingType recTypeFromString(QString type)
return kNotRecording;
if (type.toLower() == "single record" || type.toLower() == "single")
return kSingleRecord;
else if (type.toLower() == "record daily" || type.toLower() == "daily")
return kTimeslotRecord;
else if (type.toLower() == "record weekly" || type.toLower() == "weekly")
return kWeekslotRecord;
else if (type.toLower() == "channel record" || type.toLower() == "channel")
return kChannelRecord;
else if (type.toLower() == "record all" || type.toLower() == "all")
return kAllRecord;
else if (type.toLower() == "find one" || type.toLower() == "findone")
return kFindOneRecord;
else if (type.toLower() == "find daily" || type.toLower() == "finddaily")
return kFindDailyRecord;
else if (type.toLower() == "find weekly" || type.toLower() == "findweekly")
return kFindWeeklyRecord;
else if (type.toLower() == "record one" || type.toLower() == "one" ||
type.toLower() == "find one" || type.toLower() == "findone")
return kOneRecord;
else if (type.toLower() == "record daily" || type.toLower() == "daily" ||
type.toLower() == "find daily" || type.toLower() == "finddaily")
return kDailyRecord;
else if (type.toLower() == "record weekly" || type.toLower() == "weekly" ||
type.toLower() == "find weekly" || type.toLower() == "findweekly")
return kWeeklyRecord;
else if (type.toLower() == "template" || type.toLower() == "template")
return kTemplateRecord;
else if (type.toLower() == "override recording" || type.toLower() == "override")
Expand All @@ -120,26 +109,22 @@ QChar toQChar(RecordingType rectype)
{
case kSingleRecord:
ret = QObject::tr("S", "RecTypeChar kSingleRecord"); break;
case kTimeslotRecord:
ret = QObject::tr("T", "RecTypeChar kTimeslotRecord"); break;
case kWeekslotRecord:
ret = QObject::tr("W", "RecTypeChar kWeekslotRecord"); break;
case kChannelRecord:
ret = QObject::tr("C", "RecTypeChar kChannelRecord"); break;
case kAllRecord:
ret = QObject::tr("A", "RecTypeChar kAllRecord"); break;
case kFindOneRecord:
ret = QObject::tr("F", "RecTypeChar kFindOneRecord"); break;
case kFindDailyRecord:
ret = QObject::tr("d", "RecTypeChar kFindDailyRecord"); break;
case kFindWeeklyRecord:
ret = QObject::tr("w", "RecTypeChar kFindWeeklyRecord"); break;
case kOneRecord:
ret = QObject::tr("1", "RecTypeChar kOneRecord"); break;
case kDailyRecord:
ret = QObject::tr("D", "RecTypeChar kDailyRecord"); break;
case kWeeklyRecord:
ret = QObject::tr("W", "RecTypeChar kWeeklyRecord"); break;
case kOverrideRecord:
case kDontRecord:
ret = QObject::tr("O", "RecTypeChar kOverrideRecord/kDontRecord");
break;
case kTemplateRecord:
ret = QObject::tr("t", "RecTypeChar kTemplateRecord"); break;
ret = QObject::tr("T", "RecTypeChar kTemplateRecord"); break;
case kNotRecording:
default:
ret = " ";
Expand Down
20 changes: 10 additions & 10 deletions mythtv/libs/libmyth/recordingtypes.h
Expand Up @@ -20,16 +20,16 @@ typedef enum RecordingTypes
{
kNotRecording = 0,
kSingleRecord = 1,
kTimeslotRecord,
kChannelRecord,
kAllRecord,
kWeekslotRecord,
kFindOneRecord,
kOverrideRecord,
kDontRecord,
kFindDailyRecord,
kFindWeeklyRecord,
kTemplateRecord
kDailyRecord = 2,
kChannelRecord = 3,
kAllRecord = 4,
kWeeklyRecord = 5,
kOneRecord = 6,
kOverrideRecord = 7,
kDontRecord = 8,
//kFindDailyRecord = 9, (Obsolete)
//kFindWeeklyRecord = 10, (Obsolete)
kTemplateRecord = 11
} RecordingType; // note stored in uint8_t in ProgramInfo
MPUBLIC QString toString(RecordingType);
MPUBLIC QString toRawString(RecordingType);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
#define MYTH_BINARY_VERSION "0.27.20121204-1"
#define MYTH_BINARY_VERSION "0.27.20121204-2"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down Expand Up @@ -57,7 +57,7 @@
* mythtv/bindings/php/MythBackend.php
#endif

#define MYTH_DATABASE_VERSION "1308"
#define MYTH_DATABASE_VERSION "1309"


MBASE_PUBLIC const char *GetMythSourceVersion();
Expand Down
40 changes: 39 additions & 1 deletion mythtv/libs/libmythtv/dbcheck.cpp
Expand Up @@ -2279,7 +2279,6 @@ NULL

if (dbver == "1307")
{

const char *updates[] = {
"ALTER TABLE channel MODIFY COLUMN icon varchar(255) NOT NULL DEFAULT '';",
"UPDATE channel SET icon='' WHERE icon='none';",
Expand All @@ -2289,6 +2288,45 @@ NULL
return false;
}

if (dbver == "1308")
{
const char *updates[] = {
// Add this time filter
"REPLACE INTO recordfilter (filterid, description, clause, newruledefault) "
" VALUES (8, 'This time', 'ABS(TIMESTAMPDIFF(MINUTE, CONVERT_TZ("
" ADDTIME(RECTABLE.startdate, RECTABLE.starttime), ''UTC'', ''SYSTEM''), "
" CONVERT_TZ(program.starttime, ''UTC'', ''SYSTEM''))) MOD 1440 <= 10', 0)",
// Add this day and time filter
"REPLACE INTO recordfilter (filterid, description, clause, newruledefault) "
" VALUES (9, 'This day and time', 'ABS(TIMESTAMPDIFF(MINUTE, CONVERT_TZ("
" ADDTIME(RECTABLE.startdate, RECTABLE.starttime), ''UTC'', ''SYSTEM''), "
" CONVERT_TZ(program.starttime, ''UTC'', ''SYSTEM''))) MOD 10080 <= 10', 0)",
// Convert old, normal Timeslot rules to Channel with time filter
"UPDATE record SET type = 3, filter = filter|256 "
" WHERE type = 2 AND search = 0",
// Convert old, normal Weekslot rules to Channel with day and time filter
"UPDATE record SET type = 3, filter = filter|512 "
" WHERE type = 5 AND search = 0",
// Convert old, normal find daily to new, power search, find daily
"UPDATE record SET type = 2, search = 1, chanid = 0, station = '', "
" subtitle = '', description = CONCAT('program.title = ''', "
" REPLACE(title, '''', ''''''), ''''), "
" title = CONCAT(title, ' (Power Search)') WHERE type = 9 AND search = 0",
// Convert old, normal find weekly to new, power search, find weekly
"UPDATE record SET type = 5, search = 1, chanid = 0, station = '', "
" subtitle = '', description = CONCAT('program.title = ''', "
" REPLACE(title, '''', ''''''), ''''), "
" title = CONCAT(title, ' (Power Search)') WHERE type = 10 AND search = 0",
// Convert old, find daily to new, find daily
"UPDATE record SET type = 2 WHERE type = 9",
// Convert old, find weekly to new, find weekly
"UPDATE record SET type = 5 WHERE type = 10",
NULL
};
if (!performActualUpdate(&updates[0], "1309", dbver))
return false;
}

return true;
}

Expand Down
47 changes: 5 additions & 42 deletions mythtv/libs/libmythtv/recordinginfo.cpp
Expand Up @@ -772,12 +772,11 @@ void RecordingInfo::ApplyTranscoderProfileChange(const QString &profile) const
* If the program recording status is kNotRecording,
* ApplyRecordStateChange(kSingleRecord) is called.
* If the program recording status is kSingleRecording,
* ApplyRecordStateChange(kFindOneRecord) is called.
* ApplyRecordStateChange(kOneRecord) is called.
* <br>etc...
*
* The states in order are: kNotRecording, kSingleRecord, kFindOneRecord,
* kWeekslotRecord, kFindWeeklyRecord, kTimeslotRecord, kFindDailyRecord,
* kChannelRecord, kAllRecord.<br>
* The states in order are: kNotRecording, kSingleRecord, kOneRecord,
* kWeeklyRecord, kDailyRecord, kChannelRecord, kAllRecord.<br>
* And: kOverrideRecord, kDontRecord.
*
* That is if you the recording is in any of the first set of states,
Expand All @@ -794,9 +793,9 @@ void RecordingInfo::ToggleRecord(void)
ApplyRecordStateChange(kSingleRecord);
break;
case kSingleRecord:
ApplyRecordStateChange(kFindOneRecord);
ApplyRecordStateChange(kOneRecord);
break;
case kFindOneRecord:
case kOneRecord:
ApplyRecordStateChange(kAllRecord);
break;
case kAllRecord:
Expand All @@ -813,42 +812,6 @@ void RecordingInfo::ToggleRecord(void)
default:
ApplyRecordStateChange(kAllRecord);
break;
/*
case kNotRecording:
ApplyRecordStateChange(kSingleRecord);
break;
case kSingleRecord:
ApplyRecordStateChange(kFindOneRecord);
break;
case kFindOneRecord:
ApplyRecordStateChange(kWeekslotRecord);
break;
case kWeekslotRecord:
ApplyRecordStateChange(kFindWeeklyRecord);
break;
case kFindWeeklyRecord:
ApplyRecordStateChange(kTimeslotRecord);
break;
case kTimeslotRecord:
ApplyRecordStateChange(kFindDailyRecord);
break;
case kFindDailyRecord:
ApplyRecordStateChange(kChannelRecord);
break;
case kChannelRecord:
ApplyRecordStateChange(kAllRecord);
break;
case kAllRecord:
default:
ApplyRecordStateChange(kNotRecording);
break;
case kOverrideRecord:
ApplyRecordStateChange(kDontRecord);
break;
case kDontRecord:
ApplyRecordStateChange(kOverrideRecord);
break;
*/
}
}

Expand Down

0 comments on commit a1f9793

Please sign in to comment.