From a1f979393d4897d91b338581a14a2e245d76fa16 Mon Sep 17 00:00:00 2001 From: David Engel Date: Wed, 5 Dec 2012 15:53:48 -0600 Subject: [PATCH] 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. --- mythtv/bindings/perl/MythTV.pm | 2 +- mythtv/bindings/python/MythTV/dataheap.py | 4 +- mythtv/bindings/python/MythTV/static.py | 13 +- mythtv/libs/libmyth/programinfo.cpp | 2 +- mythtv/libs/libmyth/recordingtypes.cpp | 77 +++++------ mythtv/libs/libmyth/recordingtypes.h | 20 +-- mythtv/libs/libmythbase/mythversion.h | 4 +- mythtv/libs/libmythtv/dbcheck.cpp | 40 +++++- mythtv/libs/libmythtv/recordinginfo.cpp | 47 +------ mythtv/libs/libmythtv/recordingrule.cpp | 29 +++-- mythtv/libs/libmythtv/recordingrule.h | 2 +- mythtv/libs/libmythtv/tv_rec.cpp | 2 +- mythtv/programs/mythbackend/housekeeper.cpp | 2 +- mythtv/programs/mythbackend/scheduler.cpp | 122 ++++++------------ mythtv/programs/mythfrontend/customedit.cpp | 3 +- mythtv/programs/mythfrontend/guidegrid.cpp | 8 +- mythtv/programs/mythfrontend/playbackbox.cpp | 6 +- .../mythfrontend/programrecpriority.cpp | 36 +++--- .../programs/mythfrontend/schedulecommon.cpp | 14 +- .../programs/mythfrontend/scheduleeditor.cpp | 33 ++--- 20 files changed, 199 insertions(+), 267 deletions(-) diff --git a/mythtv/bindings/perl/MythTV.pm b/mythtv/bindings/perl/MythTV.pm index c02a01634ca..1a86c8bf932 100644 --- a/mythtv/bindings/perl/MythTV.pm +++ b/mythtv/bindings/perl/MythTV.pm @@ -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 diff --git a/mythtv/bindings/python/MythTV/dataheap.py b/mythtv/bindings/python/MythTV/dataheap.py index 6c66c441c06..712542157db 100644 --- a/mythtv/bindings/python/MythTV/dataheap.py +++ b/mythtv/bindings/python/MythTV/dataheap.py @@ -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) diff --git a/mythtv/bindings/python/MythTV/static.py b/mythtv/bindings/python/MythTV/static.py index a24940b7d45..48224531792 100644 --- a/mythtv/bindings/python/MythTV/static.py +++ b/mythtv/bindings/python/MythTV/static.py @@ -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' @@ -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 diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index 0126be385a0..bb8bfd17565 100644 --- a/mythtv/libs/libmyth/programinfo.cpp +++ b/mythtv/libs/libmyth/programinfo.cpp @@ -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 && diff --git a/mythtv/libs/libmyth/recordingtypes.cpp b/mythtv/libs/libmyth/recordingtypes.cpp index d149ed88524..31310519f18 100644 --- a/mythtv/libs/libmyth/recordingtypes.cpp +++ b/mythtv/libs/libmyth/recordingtypes.cpp @@ -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; @@ -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"); @@ -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"); @@ -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") @@ -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 = " "; diff --git a/mythtv/libs/libmyth/recordingtypes.h b/mythtv/libs/libmyth/recordingtypes.h index 8ac8918527b..37c1400ac2f 100644 --- a/mythtv/libs/libmyth/recordingtypes.h +++ b/mythtv/libs/libmyth/recordingtypes.h @@ -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); diff --git a/mythtv/libs/libmythbase/mythversion.h b/mythtv/libs/libmythbase/mythversion.h index c77ee655439..507b857f1a6 100644 --- a/mythtv/libs/libmythbase/mythversion.h +++ b/mythtv/libs/libmythbase/mythversion.h @@ -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. * @@ -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(); diff --git a/mythtv/libs/libmythtv/dbcheck.cpp b/mythtv/libs/libmythtv/dbcheck.cpp index 2ec9a2d120f..777ed8f5804 100644 --- a/mythtv/libs/libmythtv/dbcheck.cpp +++ b/mythtv/libs/libmythtv/dbcheck.cpp @@ -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';", @@ -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; } diff --git a/mythtv/libs/libmythtv/recordinginfo.cpp b/mythtv/libs/libmythtv/recordinginfo.cpp index 7b8c93e600d..1aa7cd62705 100644 --- a/mythtv/libs/libmythtv/recordinginfo.cpp +++ b/mythtv/libs/libmythtv/recordinginfo.cpp @@ -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. *
etc... * - * The states in order are: kNotRecording, kSingleRecord, kFindOneRecord, - * kWeekslotRecord, kFindWeeklyRecord, kTimeslotRecord, kFindDailyRecord, - * kChannelRecord, kAllRecord.
+ * The states in order are: kNotRecording, kSingleRecord, kOneRecord, + * kWeeklyRecord, kDailyRecord, kChannelRecord, kAllRecord.
* And: kOverrideRecord, kDontRecord. * * That is if you the recording is in any of the first set of states, @@ -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: @@ -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; -*/ } } diff --git a/mythtv/libs/libmythtv/recordingrule.cpp b/mythtv/libs/libmythtv/recordingrule.cpp index 434ebba90b5..39183c81932 100644 --- a/mythtv/libs/libmythtv/recordingrule.cpp +++ b/mythtv/libs/libmythtv/recordingrule.cpp @@ -34,7 +34,7 @@ RecordingRule::RecordingRule() m_enddate(), m_inetref(), // String could be null when we trying to insert into DB m_channelid(0), - m_findday(-1), + m_findday(0), m_findtime(QTime::fromString("00:00:00", Qt::ISODate)), m_findid(QDate(1970, 1, 1).daysTo(MythDate::current().toLocalTime().date()) + 719528), @@ -223,7 +223,8 @@ bool RecordingRule::LoadByProgram(const ProgramInfo* proginfo) } bool RecordingRule::LoadBySearch(RecSearchType lsearch, QString textname, - QString forwhat, QString from) + QString forwhat, QString from, + ProgramInfo *pginfo) { MSqlQuery query(MSqlQuery::InitCon()); @@ -263,10 +264,16 @@ bool RecordingRule::LoadBySearch(RecSearchType lsearch, QString textname, m_title = ltitle; m_subtitle = from; m_description = forwhat; - QDate ldate = MythDate::current().toLocalTime().date(); - m_findday = (ldate.dayOfWeek() + 1) % 7; - QDate epoch(1970, 1, 1); - m_findid = epoch.daysTo(ldate) + 719528; + + if (pginfo) + { + m_findday = + (pginfo->GetScheduledStartTime().toLocalTime().date() + .dayOfWeek() + 1) % 7; + m_findtime = pginfo->GetScheduledStartTime().toLocalTime().time(); + m_findid = QDate(1970, 1, 1).daysTo( + pginfo->GetScheduledStartTime().toLocalTime().date()) + 719528; + } } m_loaded = true; @@ -579,13 +586,13 @@ void RecordingRule::ToMap(InfoMap &infoMap) const startts, MythDate::kDateTimeShort | MythDate::kSimplify) + " - " + MythDate::toString(endts, MythDate::kTime); - if (m_type == kFindDailyRecord || m_type == kFindWeeklyRecord) + if (m_type == kDailyRecord || m_type == kWeeklyRecord) { QDateTime ldt = QDateTime(MythDate::current().toLocalTime().date(), m_findtime, Qt::LocalTime); QString findfrom = MythDate::toString(ldt, MythDate::kTime); - if (m_type == kFindWeeklyRecord) + if (m_type == kWeeklyRecord) { int daynum = (m_findday + 5) % 7 + 1; findfrom = QString("%1, %2").arg(QDate::shortDayName(daynum)) @@ -703,15 +710,13 @@ void RecordingRule::AssignProgramInfo() m_endtime = m_progInfo->GetScheduledEndTime().time(); m_seriesid = m_progInfo->GetSeriesID(); m_programid = m_progInfo->GetProgramID(); - if (m_findday < 0) + if (m_recordID <= 0) { m_findday = (m_progInfo->GetScheduledStartTime().toLocalTime().date() .dayOfWeek() + 1) % 7; m_findtime = m_progInfo->GetScheduledStartTime().toLocalTime().time(); - - QDate epoch(1970, 1, 1); - m_findid = epoch.daysTo( + m_findid = QDate(1970, 1, 1).daysTo( m_progInfo->GetScheduledStartTime().toLocalTime().date()) + 719528; } else diff --git a/mythtv/libs/libmythtv/recordingrule.h b/mythtv/libs/libmythtv/recordingrule.h index 4184e10be8b..176b17262c1 100644 --- a/mythtv/libs/libmythtv/recordingrule.h +++ b/mythtv/libs/libmythtv/recordingrule.h @@ -39,7 +39,7 @@ class MTV_PUBLIC RecordingRule bool Load(bool asTemplate = false); bool LoadByProgram(const ProgramInfo* proginfo); bool LoadBySearch(RecSearchType lsearch, QString textname, QString forwhat, - QString from = ""); + QString from = "", ProgramInfo *pginfo = NULL); bool LoadTemplate(QString category, QString categoryType = "Default"); bool ModifyPowerSearchByID(int rid, QString textname, QString forwhat, diff --git a/mythtv/libs/libmythtv/tv_rec.cpp b/mythtv/libs/libmythtv/tv_rec.cpp index 721c5131ff1..b8c695928db 100644 --- a/mythtv/libs/libmythtv/tv_rec.cpp +++ b/mythtv/libs/libmythtv/tv_rec.cpp @@ -806,7 +806,7 @@ void TVRec::StartedRecording(RecordingInfo *curRec) } /** \brief If not a premature stop, adds program to history of recorded - * programs. If the recording type is kFindOneRecord this find + * programs. If the recording type is kOneRecord this find * is removed. * \sa ProgramInfo::FinishedRecording(bool prematurestop) * \param curRec RecordingInfo or recording to mark as done diff --git a/mythtv/programs/mythbackend/housekeeper.cpp b/mythtv/programs/mythbackend/housekeeper.cpp index 4842fb9cbde..b828fede810 100644 --- a/mythtv/programs/mythbackend/housekeeper.cpp +++ b/mythtv/programs/mythbackend/housekeeper.cpp @@ -728,7 +728,7 @@ void HouseKeeper::CleanupProgramListings(void) findq.prepare("SELECT record.recordid FROM record " "LEFT JOIN oldfind ON oldfind.recordid = record.recordid " "WHERE type = :FINDONE AND oldfind.findid IS NOT NULL;"); - findq.bindValue(":FINDONE", kFindOneRecord); + findq.bindValue(":FINDONE", kOneRecord); if (findq.exec()) { diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp index f3b375a62db..3a184818666 100644 --- a/mythtv/programs/mythbackend/scheduler.cpp +++ b/mythtv/programs/mythbackend/scheduler.cpp @@ -1058,9 +1058,9 @@ void Scheduler::MarkOtherShowings(RecordingInfo *p) showinglist = &titlelistmap[p->GetTitle().toLower()]; MarkShowingsList(*showinglist, p); - if (p->GetRecordingRuleType() == kFindOneRecord || - p->GetRecordingRuleType() == kFindDailyRecord || - p->GetRecordingRuleType() == kFindWeeklyRecord) + if (p->GetRecordingRuleType() == kOneRecord || + p->GetRecordingRuleType() == kDailyRecord || + p->GetRecordingRuleType() == kWeeklyRecord) { showinglist = &recordidlistmap[p->GetRecordingRuleID()]; MarkShowingsList(*showinglist, p); @@ -3272,14 +3272,14 @@ void Scheduler::UpdateManuals(uint recordid) skipdays = 1; weekday = false; break; - case kTimeslotRecord: + case kDailyRecord: progcount = 13; skipdays = 1; weekday = (lstartdt.date().dayOfWeek() < 6); lstartdt = QDateTime(MythDate::current().toLocalTime().date(), lstartdt.time(), Qt::LocalTime); break; - case kWeekslotRecord: + case kWeeklyRecord: progcount = 2; skipdays = 7; weekday = false; @@ -3460,7 +3460,7 @@ static QString progdupinit = QString( " ELSE (program.generic - 1) " " END) ") .arg(kSingleRecord).arg(kOverrideRecord).arg(kDontRecord) - .arg(kFindOneRecord).arg(kFindDailyRecord).arg(kFindWeeklyRecord); + .arg(kOneRecord).arg(kDailyRecord).arg(kWeeklyRecord); static QString progfindid = QString( "(CASE RECTABLE.type " @@ -3477,9 +3477,9 @@ static QString progfindid = QString( " THEN RECTABLE.findid " " ELSE 0 " " END) ") - .arg(kFindOneRecord) - .arg(kFindDailyRecord) - .arg(kFindWeeklyRecord) + .arg(kOneRecord) + .arg(kDailyRecord) + .arg(kWeeklyRecord) .arg(kOverrideRecord); void Scheduler::UpdateMatches(uint recordid, uint sourceid, uint mplexid, @@ -3549,7 +3549,7 @@ void Scheduler::UpdateMatches(uint recordid, uint sourceid, uint mplexid, // Make sure all FindOne rules have a valid findid before scheduling. query.prepare("SELECT NULL from record " "WHERE type = :FINDONE AND findid <= 0;"); - query.bindValue(":FINDONE", kFindOneRecord); + query.bindValue(":FINDONE", kOneRecord); if (!query.exec()) { MythDB::DBError("UpdateMatches3", query); @@ -3563,7 +3563,7 @@ void Scheduler::UpdateMatches(uint recordid, uint sourceid, uint mplexid, query.prepare("UPDATE record set findid = :FINDID " "WHERE type = :FINDONE AND findid <= 0;"); query.bindValue(":FINDID", findtoday); - query.bindValue(":FINDONE", kFindOneRecord); + query.bindValue(":FINDONE", kOneRecord); if (!query.exec()) MythDB::DBError("UpdateMatches4", query); } @@ -3597,42 +3597,32 @@ void Scheduler::UpdateMatches(uint recordid, uint sourceid, uint mplexid, QString(" AND channel.visible = 1 ") + filterClause + QString(" AND " -"((RECTABLE.type = %1 " // allrecord -"OR RECTABLE.type = %2 " // findonerecord -"OR RECTABLE.type = %3 " // finddailyrecord -"OR RECTABLE.type = %4) " // findweeklyrecord +"((RECTABLE.type = %1 " // all record +" OR RECTABLE.type = %2 " // one record +" OR RECTABLE.type = %3 " // daily record +" OR RECTABLE.type = %4) " // weekly record " OR " " ((RECTABLE.station = channel.callsign) " // channel matches " AND " -" ((RECTABLE.type = %5) " // channelrecord +" ((RECTABLE.type = %5) " // channel record " OR" -" (( TIME(CONVERT_TZ(ADDTIME(RECTABLE.startdate, RECTABLE.starttime), 'UTC', 'SYSTEM')) = TIME(CONVERT_TZ(program.starttime, 'UTC', 'SYSTEM'))) " // timeslot matches +" ((ADDTIME(RECTABLE.startdate, RECTABLE.starttime) = program.starttime) " // date/time matches " AND " -" ((RECTABLE.type = %6) " // timeslotrecord -" OR" -" ((DAYOFWEEK(CONVERT_TZ(ADDTIME(RECTABLE.startdate, RECTABLE.starttime), 'UTC', 'SYSTEM')) = DAYOFWEEK(CONVERT_TZ(program.starttime, 'UTC', 'SYSTEM')) " -" AND " -" ((RECTABLE.type = %7) " // weekslotrecord -" OR" -" ((ADDTIME(RECTABLE.startdate, RECTABLE.starttime) = program.starttime) " // date/time matches -" AND (RECTABLE.type <> %8)" // single,override,don't,etc. -" )" -" )" -" )" -" )" -" )" +" (RECTABLE.type = %6 " +" OR RECTABLE.type = %7 " +" OR RECTABLE.type = %8)" // single/override/don't record " )" " )" " )" ") ") .arg(kAllRecord) - .arg(kFindOneRecord) - .arg(kFindDailyRecord) - .arg(kFindWeeklyRecord) + .arg(kOneRecord) + .arg(kDailyRecord) + .arg(kWeeklyRecord) .arg(kChannelRecord) - .arg(kTimeslotRecord) - .arg(kWeekslotRecord) - .arg(kNotRecording); + .arg(kSingleRecord) + .arg(kOverrideRecord) + .arg(kDontRecord); query.replace("RECTABLE", recordTable); @@ -4265,11 +4255,9 @@ void Scheduler::AddNotListed(void) { "FROM RECTABLE " "INNER JOIN channel ON (channel.chanid = RECTABLE.chanid) " "LEFT JOIN recordmatch on RECTABLE.recordid = recordmatch.recordid " - "WHERE (type = %1 OR type = %2 OR type = %3 OR type = %4) AND " + "WHERE (type = %1 OR type = %2) AND " " recordmatch.chanid IS NULL") .arg(kSingleRecord) - .arg(kTimeslotRecord) - .arg(kWeekslotRecord) .arg(kOverrideRecord); query.replace("RECTABLE", recordTable); @@ -4304,33 +4292,6 @@ void Scheduler::AddNotListed(void) { QDateTime endts( result.value(18).toDate(), result.value(19).toTime(), Qt::UTC); - if (rectype == kTimeslotRecord) - { - int days = startts.daysTo(now); - - startts = startts.addDays(days); - endts = endts.addDays(days); - - if (endts < now) - { - startts = startts.addDays(1); - endts = endts.addDays(1); - } - } - else if (rectype == kWeekslotRecord) - { - int weeks = (startts.daysTo(now) + 6) / 7; - - startts = startts.addDays(weeks * 7); - endts = endts.addDays(weeks * 7); - - if (endts < now) - { - startts = startts.addDays(7); - endts = endts.addDays(7); - } - } - QDateTime recstartts = startts.addSecs(result.value(25).toInt() * -60); QDateTime recendts = endts.addSecs( result.value(26).toInt() * +60); @@ -4430,27 +4391,16 @@ void Scheduler::GetAllScheduled(RecList &proglist) while (result.next()) { RecordingType rectype = RecordingType(result.value(21).toInt()); - QDateTime startts; - QDateTime endts; - if (rectype == kSingleRecord || - rectype == kDontRecord || - rectype == kOverrideRecord || - rectype == kTimeslotRecord || - rectype == kWeekslotRecord) - { - startts = QDateTime(result.value(16).toDate(), - result.value(17).toTime(), Qt::UTC); - endts = QDateTime(result.value(18).toDate(), - result.value(19).toTime(), Qt::UTC); - } - else - { - // put currentDateTime() in time fields to prevent - // Invalid date/time warnings later - startts = QDateTime( - MythDate::current().date(), QTime(0,0), Qt::UTC); + QDateTime startts = QDateTime(result.value(16).toDate(), + result.value(17).toTime(), Qt::UTC); + QDateTime endts = QDateTime(result.value(18).toDate(), + result.value(19).toTime(), Qt::UTC); + // Prevent invalid date/time warnings later + if (!startts.isValid()) + startts = QDateTime(MythDate::current().date(), QTime(0,0), + Qt::UTC); + if (!endts.isValid()) endts = startts; - } proglist.push_back(new RecordingInfo( result.value(0).toString(), result.value(1).toString(), diff --git a/mythtv/programs/mythfrontend/customedit.cpp b/mythtv/programs/mythfrontend/customedit.cpp index 691c62c9653..48e1443e833 100644 --- a/mythtv/programs/mythfrontend/customedit.cpp +++ b/mythtv/programs/mythfrontend/customedit.cpp @@ -678,7 +678,8 @@ void CustomEdit::recordClicked(void) { record->LoadBySearch(kPowerSearch, m_titleEdit->GetText(), evaluate(m_descriptionEdit->GetText()), - m_subtitleEdit->GetText()); + m_subtitleEdit->GetText(), + m_pginfo->GetTitle().isEmpty() ? NULL : m_pginfo); } MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp index fc572de6643..3ee060ba956 100644 --- a/mythtv/programs/mythfrontend/guidegrid.cpp +++ b/mythtv/programs/mythfrontend/guidegrid.cpp @@ -1300,7 +1300,7 @@ void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) case kSingleRecord: recFlag = 1; break; - case kTimeslotRecord: + case kDailyRecord: recFlag = 2; break; case kChannelRecord: @@ -1309,12 +1309,10 @@ void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData) case kAllRecord: recFlag = 4; break; - case kWeekslotRecord: + case kWeeklyRecord: recFlag = 5; break; - case kFindOneRecord: - case kFindDailyRecord: - case kFindWeeklyRecord: + case kOneRecord: recFlag = 6; break; case kOverrideRecord: diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp index d6f428f6fa6..aa7dc7e5a6a 100644 --- a/mythtv/programs/mythfrontend/playbackbox.cpp +++ b/mythtv/programs/mythfrontend/playbackbox.cpp @@ -1940,8 +1940,7 @@ bool PlaybackBox::UpdateUILists(void) // Daily if (spanHours[recid] < 50 || - recType[recid] == kTimeslotRecord || - recType[recid] == kFindDailyRecord) + recType[recid] == kDailyRecord) { if (delHours[recid] < m_watchListBlackOut * 4) { @@ -1973,8 +1972,7 @@ bool PlaybackBox::UpdateUILists(void) } // Weekly else if (nextHours[recid] || - recType[recid] == kWeekslotRecord || - recType[recid] == kFindWeeklyRecord) + recType[recid] == kWeeklyRecord) { if (delHours[recid] < (m_watchListBlackOut * 24) - 4) diff --git a/mythtv/programs/mythfrontend/programrecpriority.cpp b/mythtv/programs/mythfrontend/programrecpriority.cpp index 6ee78852df9..f497b1ca530 100644 --- a/mythtv/programs/mythfrontend/programrecpriority.cpp +++ b/mythtv/programs/mythfrontend/programrecpriority.cpp @@ -1519,23 +1519,23 @@ void ProgramRecPriority::UpdateList() QString channame = progInfo->channame; if ((progInfo->recType == kAllRecord) || - (progInfo->recType == kFindOneRecord) || - (progInfo->recType == kFindDailyRecord) || - (progInfo->recType == kFindWeeklyRecord)) + (progInfo->recType == kOneRecord) || + (progInfo->recType == kDailyRecord) || + (progInfo->recType == kWeeklyRecord)) channame = tr("Any"); item->SetText(channame, "channel", state); QString channum = progInfo->chanstr; if ((progInfo->recType == kAllRecord) || - (progInfo->recType == kFindOneRecord) || - (progInfo->recType == kFindDailyRecord) || - (progInfo->recType == kFindWeeklyRecord)) + (progInfo->recType == kOneRecord) || + (progInfo->recType == kDailyRecord) || + (progInfo->recType == kWeeklyRecord)) channum = tr("Any"); item->SetText(channum, "channum", state); QString callsign = progInfo->chansign; if ((progInfo->recType == kAllRecord) || - (progInfo->recType == kFindOneRecord) || - (progInfo->recType == kFindDailyRecord) || - (progInfo->recType == kFindWeeklyRecord)) + (progInfo->recType == kOneRecord) || + (progInfo->recType == kDailyRecord) || + (progInfo->recType == kWeeklyRecord)) callsign = tr("Any"); item->SetText(callsign, "callsign", state); @@ -1651,9 +1651,9 @@ void ProgramRecPriority::updateInfo(MythUIButtonListItem *item) { QString channame = pgRecInfo->channame; if ((pgRecInfo->rectype == kAllRecord) || - (pgRecInfo->rectype == kFindOneRecord) || - (pgRecInfo->rectype == kFindDailyRecord) || - (pgRecInfo->rectype == kFindWeeklyRecord)) + (pgRecInfo->rectype == kOneRecord) || + (pgRecInfo->rectype == kDailyRecord) || + (pgRecInfo->rectype == kWeeklyRecord)) channame = tr("Any"); m_channameText->SetText(channame); } @@ -1662,9 +1662,9 @@ void ProgramRecPriority::updateInfo(MythUIButtonListItem *item) { QString channum = pgRecInfo->chanstr; if ((pgRecInfo->rectype == kAllRecord) || - (pgRecInfo->rectype == kFindOneRecord) || - (pgRecInfo->rectype == kFindDailyRecord) || - (pgRecInfo->rectype == kFindWeeklyRecord)) + (pgRecInfo->rectype == kOneRecord) || + (pgRecInfo->rectype == kDailyRecord) || + (pgRecInfo->rectype == kWeeklyRecord)) channum = tr("Any"); m_channumText->SetText(channum); } @@ -1673,9 +1673,9 @@ void ProgramRecPriority::updateInfo(MythUIButtonListItem *item) { QString callsign = pgRecInfo->chansign; if ((pgRecInfo->rectype == kAllRecord) || - (pgRecInfo->rectype == kFindOneRecord) || - (pgRecInfo->rectype == kFindDailyRecord) || - (pgRecInfo->rectype == kFindWeeklyRecord)) + (pgRecInfo->rectype == kOneRecord) || + (pgRecInfo->rectype == kDailyRecord) || + (pgRecInfo->rectype == kWeeklyRecord)) callsign = tr("Any"); m_callsignText->SetText(callsign); } diff --git a/mythtv/programs/mythfrontend/schedulecommon.cpp b/mythtv/programs/mythfrontend/schedulecommon.cpp index 06ac79c2be9..b03e9200aa1 100644 --- a/mythtv/programs/mythfrontend/schedulecommon.cpp +++ b/mythtv/programs/mythfrontend/schedulecommon.cpp @@ -244,7 +244,7 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo) recinfo.GetRecordingStatus() != rsTuning && recinfo.GetRecordingStatus() != rsOtherRecording && recinfo.GetRecordingStatus() != rsOtherTuning && - recinfo.GetRecordingRuleType() != kFindOneRecord && + recinfo.GetRecordingRuleType() != kOneRecord && !((recinfo.GetFindID() == 0 || !IsFindApplicable(recinfo)) && recinfo.GetCategoryType() == "series" && @@ -283,7 +283,7 @@ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo) qVariantFromValue(recinfo)); if (recinfo.GetRecordingRuleType() != kSingleRecord && - recinfo.GetRecordingRuleType() != kFindOneRecord) + recinfo.GetRecordingRuleType() != kOneRecord) { menuPopup->AddButton(tr("Add Override"), qVariantFromValue(recinfo)); @@ -427,7 +427,7 @@ void ScheduleCommon::ShowNotRecordingDialog(const RecordingInfo& recinfo) const RecordingDupMethodType dupmethod = recinfo.GetDuplicateCheckMethod(); - if (recinfo.GetRecordingRuleType() != kFindOneRecord && + if (recinfo.GetRecordingRuleType() != kOneRecord && !((recinfo.GetFindID() == 0 || !IsFindApplicable(recinfo)) && recinfo.GetCategoryType() == "series" && @@ -453,7 +453,7 @@ void ScheduleCommon::ShowNotRecordingDialog(const RecordingInfo& recinfo) qVariantFromValue(recinfo)); if (recinfo.GetRecordingRuleType() != kSingleRecord && - recinfo.GetRecordingRuleType() != kFindOneRecord && + recinfo.GetRecordingRuleType() != kOneRecord && recinfo.GetRecordingStatus() != rsNotListed) { menuPopup->AddButton(tr("Add Override"), @@ -557,7 +557,7 @@ void ScheduleCommon::customEvent(QEvent *event) { if (recInfo.GetRecordingRuleType() == kSingleRecord || recInfo.GetRecordingRuleType() == kOverrideRecord || - recInfo.GetRecordingRuleType() == kFindOneRecord) + recInfo.GetRecordingRuleType() == kOneRecord) EditScheduled(&recInfo); else MakeOverride(&recInfo, true); @@ -581,6 +581,6 @@ void ScheduleCommon::customEvent(QEvent *event) */ bool ScheduleCommon::IsFindApplicable(const RecordingInfo& recInfo) const { - return recInfo.GetRecordingRuleType() == kFindDailyRecord || - recInfo.GetRecordingRuleType() == kFindWeeklyRecord; + return recInfo.GetRecordingRuleType() == kDailyRecord || + recInfo.GetRecordingRuleType() == kWeeklyRecord; } diff --git a/mythtv/programs/mythfrontend/scheduleeditor.cpp b/mythtv/programs/mythfrontend/scheduleeditor.cpp index 461a38bc3a8..cdd33724f30 100644 --- a/mythtv/programs/mythfrontend/scheduleeditor.cpp +++ b/mythtv/programs/mythfrontend/scheduleeditor.cpp @@ -52,6 +52,8 @@ static QString fs4(QT_TRANSLATE_NOOP("SchedFilterEditor", "Commercial free")); static QString fs5(QT_TRANSLATE_NOOP("SchedFilterEditor", "High definition")); static QString fs6(QT_TRANSLATE_NOOP("SchedFilterEditor", "This episode")); static QString fs7(QT_TRANSLATE_NOOP("SchedFilterEditor", "This series")); +static QString fs8(QT_TRANSLATE_NOOP("SchedFilterEditor", "This time")); +static QString fs9(QT_TRANSLATE_NOOP("SchedFilterEditor", "This day and time")); void *ScheduleEditor::RunScheduleEditor(ProgramInfo *proginfo, void *player) { @@ -267,7 +269,7 @@ void ScheduleEditor::Load() tr("Record this showing with override options"), ENUM_TO_QVARIANT(kOverrideRecord)); new MythUIButtonListItem(m_rulesList, - tr("Do not allow this showing to be recorded"), + tr("Do not record this showing"), ENUM_TO_QVARIANT(kDontRecord)); } else @@ -278,38 +280,29 @@ void ScheduleEditor::Load() new MythUIButtonListItem(m_rulesList, tr("Do not record this program"), ENUM_TO_QVARIANT(kNotRecording)); - if (hasChannel) new MythUIButtonListItem(m_rulesList, tr("Record only this showing"), ENUM_TO_QVARIANT(kSingleRecord)); if (!isManual) new MythUIButtonListItem(m_rulesList, - tr("Record one showing of this title"), - ENUM_TO_QVARIANT(kFindOneRecord)); - if (hasChannel) - new MythUIButtonListItem(m_rulesList, - tr("Record in this timeslot every week"), - ENUM_TO_QVARIANT(kWeekslotRecord)); - if (!isManual) + tr("Record only one showing"), + ENUM_TO_QVARIANT(kOneRecord)); + if (!hasChannel || isManual) new MythUIButtonListItem(m_rulesList, - tr("Record one showing of this title every week"), - ENUM_TO_QVARIANT(kFindWeeklyRecord)); - if (hasChannel) - new MythUIButtonListItem(m_rulesList, - tr("Record in this timeslot every day"), - ENUM_TO_QVARIANT(kTimeslotRecord)); - if (!isManual) + tr("Record one showing every week"), + ENUM_TO_QVARIANT(kWeeklyRecord)); + if (!hasChannel || isManual) new MythUIButtonListItem(m_rulesList, - tr("Record one showing of this title every day"), - ENUM_TO_QVARIANT(kFindDailyRecord)); + tr("Record one showing every day"), + ENUM_TO_QVARIANT(kDailyRecord)); if (hasChannel && !isManual) new MythUIButtonListItem(m_rulesList, - tr("Record at any time on this channel"), + tr("Record all showings on this channel"), ENUM_TO_QVARIANT(kChannelRecord)); if (!isManual) new MythUIButtonListItem(m_rulesList, - ("Record at any time on any channel"), + ("Record all showings"), ENUM_TO_QVARIANT(kAllRecord)); }