Permalink
Browse files

Add some more scheduler related simplifications.

Remove the channel record recording rule type.  Add a "This channel"
filter to maintain the that functionality.  Automatically convert
existing channel record rules to all record rules with the channel
filter enabled.

Add a dialog to offer common actions instead of immediately entering
the schedule editor when SELECT is pressed on a non-scheduled program.
Pressing the EDIT action still goes straight to the schedule editor.
Change the text in the recording, not recording and not scheduled
dialogs to be a little clearer.

Change the behavior when RECORD is pressed in the EPG and elsewhere.
Previously, this action cycled through the recrding rule types.  if
the program is not scheduled, this action now adds a single record
rule.  If the program is scheduled, it now brings up the appropriate
recording or not recording dialog.
  • Loading branch information...
gigem committed Dec 30, 2012
1 parent 7c0f6b2 commit 9497ba1b63a5a6a91b06dbb85beea37444ef3ccc
@@ -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 = "1309";
+ our $SCHEMA_VERSION = "1310";
# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
@@ -5,7 +5,7 @@
"""
OWN_VERSION = (0,27,-1,0)
-SCHEMA_VERSION = 1309
+SCHEMA_VERSION = 1310
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '76'
@@ -39,7 +39,7 @@ class RECTYPE( object ):
kNotRecording = 0
kSingleRecord = 1
kDailyRecord = 2
- kChannelRecord = 3
+ #kChannelRecord = 3 (Obsolete)
kAllRecord = 4
kWeeklyRecord = 5
kOneRecord = 6
@@ -1731,6 +1731,15 @@ uint64_t ProgramInfo::QueryLastFrameInPosMap(void) const
return last_frame;
}
+bool ProgramInfo::IsGeneric(void) const
+{
+ return
+ (programid.isEmpty() && subtitle.isEmpty() &&
+ description.isEmpty()) ||
+ (!programid.isEmpty() && programid.endsWith("0000")
+ && catType == "series");
+}
+
QString ProgramInfo::toString(const Verbosity v, QString sep, QString grp)
const
{
@@ -435,6 +435,7 @@ class MPUBLIC ProgramInfo
uint32_t GetProgramFlags(void) const { return programflags; }
ProgramInfoType GetProgramInfoType(void) const
{ return (ProgramInfoType)((programflags & FL_TYPEMASK) >> 16); }
+ bool IsGeneric(void) const;
bool IsInUsePlaying(void) const { return programflags & FL_INUSEPLAYING;}
bool IsCommercialFree(void) const { return programflags & FL_CHANCOMMFREE;}
bool HasCutlist(void) const { return programflags & FL_CUTLIST; }
@@ -15,8 +15,7 @@ int RecTypePrecedence(RecordingType rectype)
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 kAllRecord: return 9; break;
case kTemplateRecord: return 0; break;
default: return 11;
}
@@ -29,8 +28,6 @@ QString toString(RecordingType rectype)
{
case kSingleRecord:
return QObject::tr("Single Record");
- case kChannelRecord:
- return QObject::tr("Channel Record");
case kAllRecord:
return QObject::tr("Record All");
case kOneRecord:
@@ -56,8 +53,6 @@ QString toRawString(RecordingType rectype)
{
case kSingleRecord:
return QString("Single Record");
- case kChannelRecord:
- return QString("Channel Record");
case kAllRecord:
return QString("Record All");
case kOneRecord:
@@ -80,8 +75,6 @@ RecordingType recTypeFromString(QString type)
return kNotRecording;
if (type.toLower() == "single record" || type.toLower() == "single")
return kSingleRecord;
- 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() == "record one" || type.toLower() == "one" ||
@@ -109,8 +102,6 @@ QChar toQChar(RecordingType rectype)
{
case kSingleRecord:
ret = QObject::tr("S", "RecTypeChar kSingleRecord"); break;
- case kChannelRecord:
- ret = QObject::tr("C", "RecTypeChar kChannelRecord"); break;
case kAllRecord:
ret = QObject::tr("A", "RecTypeChar kAllRecord"); break;
case kOneRecord:
@@ -21,7 +21,7 @@ typedef enum RecordingTypes
kNotRecording = 0,
kSingleRecord = 1,
kDailyRecord = 2,
- kChannelRecord = 3,
+ //kChannelRecord = 3, (Obsolete)
kAllRecord = 4,
kWeeklyRecord = 5,
kOneRecord = 6,
@@ -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.20121227-1"
+#define MYTH_BINARY_VERSION "0.27.20121227-2"
/** \brief Increment this whenever the MythTV network protocol changes.
*
@@ -57,7 +57,7 @@
* mythtv/bindings/php/MythBackend.php
#endif
-#define MYTH_DATABASE_VERSION "1309"
+#define MYTH_DATABASE_VERSION "1310"
MBASE_PUBLIC const char *GetMythSourceVersion();
@@ -2325,6 +2325,20 @@ NULL
return false;
}
+ if (dbver == "1309")
+ {
+ const char *updates[] = {
+// Add this channel filter
+"REPLACE INTO recordfilter (filterid, description, clause, newruledefault) "
+" VALUES (10, 'This channel', 'channel.callsign = RECTABLE.station', 0)",
+// Convert old, Channel rules to All with channel filter
+"UPDATE record SET type = 4, filter = filter|1024 WHERE type = 3",
+NULL
+};
+ if (!performActualUpdate(&updates[0], "1310", dbver))
+ return false;
+ }
+
return true;
}
@@ -766,53 +766,14 @@ void RecordingInfo::ApplyTranscoderProfileChange(const QString &profile) const
}
}
-/** \fn RecordingInfo::ToggleRecord(void)
- * \brief Cycles through recording types.
- *
- * If the program recording status is kNotRecording,
- * ApplyRecordStateChange(kSingleRecord) is called.
- * If the program recording status is kSingleRecording,
- * ApplyRecordStateChange(kOneRecord) is called.
- * <br>etc...
- *
- * 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,
- * we cycle through those, if not we toggle between kOverrideRecord and
- * kDontRecord.
+/** \fn RecordingInfo::QuickRecord(void)
+ * \brief Create a kSingleRecord if not already scheduled.
*/
-void RecordingInfo::ToggleRecord(void)
+void RecordingInfo::QuickRecord(void)
{
RecordingType curType = GetProgramRecordingStatus();
-
- switch (curType)
- {
- case kNotRecording:
- ApplyRecordStateChange(kSingleRecord);
- break;
- case kSingleRecord:
- ApplyRecordStateChange(kOneRecord);
- break;
- case kOneRecord:
- ApplyRecordStateChange(kAllRecord);
- break;
- case kAllRecord:
- ApplyRecordStateChange(kSingleRecord);
- break;
-
- case kOverrideRecord:
- ApplyRecordStateChange(kDontRecord);
- break;
- case kDontRecord:
- ApplyRecordStateChange(kOverrideRecord);
- break;
-
- default:
- ApplyRecordStateChange(kAllRecord);
- break;
- }
+ if (curType == kNotRecording)
+ ApplyRecordStateChange(kSingleRecord);
}
/**
@@ -220,7 +220,7 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
QString GetProgramRecordingProfile(void) const;
void ApplyRecordStateChange(RecordingType newstate, bool save = true);
void ApplyRecordRecPriorityChange(int);
- void ToggleRecord(void);
+ void QuickRecord(void);
// Used in determining start and end for RecordingQuality determination
void SetDesiredStartTime(const QDateTime &dt) { desiredrecstartts = dt; }
@@ -3901,7 +3901,7 @@ bool TV::BrowseHandleAction(PlayerContext *ctx, const QStringList &actions)
browsehelper->BrowseEnd(ctx, false);
}
else if (has_action(ACTION_TOGGLERECORD, actions))
- ToggleRecord(ctx);
+ QuickRecord(ctx);
else
{
handled = false;
@@ -4481,7 +4481,7 @@ bool TV::ToggleHandleAction(PlayerContext *ctx,
else if (has_action(ACTION_TOGGLESLEEP, actions))
ToggleSleepTimer(ctx);
else if (has_action(ACTION_TOGGLERECORD, actions) && islivetv)
- ToggleRecord(ctx);
+ QuickRecord(ctx);
else if (has_action(ACTION_TOGGLEFAV, actions) && islivetv)
ToggleChannelFavorite(ctx);
else if (has_action(ACTION_TOGGLECHANCONTROLS, actions) && islivetv)
@@ -9487,7 +9487,7 @@ void TV::customEvent(QEvent *e)
}
}
-void TV::ToggleRecord(PlayerContext *ctx)
+void TV::QuickRecord(PlayerContext *ctx)
{
BrowseInfo bi = browsehelper->GetBrowsedInfo();
if (bi.m_chanid)
@@ -9498,7 +9498,7 @@ void TV::ToggleRecord(PlayerContext *ctx)
RecordingInfo::LoadStatus status;
RecordingInfo recinfo(bi.m_chanid, startts, false, 0, &status);
if (RecordingInfo::kFoundProgram == status)
- recinfo.ToggleRecord();
+ recinfo.QuickRecord();
recinfo.ToMap(infoMap);
infoMap["iconpath"] = ChannelUtil::GetIcon(recinfo.GetChanID());
if ((recinfo.IsVideoFile() || recinfo.IsVideoDVD() ||
@@ -317,7 +317,7 @@ class MTV_PUBLIC TV : public QObject
// Other toggles
void ToggleAutoExpire(PlayerContext*);
- void ToggleRecord(PlayerContext*);
+ void QuickRecord(PlayerContext*);
// General TV state
static bool StateIsRecording(TVState state);
@@ -3559,29 +3559,24 @@ void Scheduler::UpdateMatches(uint recordid, uint sourceid, uint mplexid,
QString(" AND channel.visible = 1 ") +
filterClause + QString(" AND "
-"((RECTABLE.type = %1 " // all record
+"("
+" (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) " // channel record
-" OR"
-" ((ADDTIME(RECTABLE.startdate, RECTABLE.starttime) = program.starttime) " // date/time matches
-" AND "
-" (RECTABLE.type = %6 "
-" OR RECTABLE.type = %7 "
-" OR RECTABLE.type = %8)" // single/override/don't record
-" )"
-" )"
-" )"
+" ((RECTABLE.type = %6 " // single record
+" OR RECTABLE.type = %7 " // override record
+" OR RECTABLE.type = %8)" // don't record
+" AND "
+" ADDTIME(RECTABLE.startdate, RECTABLE.starttime) = program.starttime " // date/time matches
+" AND "
+" RECTABLE.station = channel.callsign) " // channel matches
") ")
.arg(kAllRecord)
.arg(kOneRecord)
.arg(kDailyRecord)
.arg(kWeeklyRecord)
- .arg(kChannelRecord)
.arg(kSingleRecord)
.arg(kOverrideRecord)
.arg(kDontRecord);
@@ -1303,9 +1303,6 @@ void GuideGrid::fillProgramRowInfos(unsigned int row, bool useExistingData)
case kDailyRecord:
recFlag = 2;
break;
- case kChannelRecord:
- recFlag = 3;
- break;
case kAllRecord:
recFlag = 4;
break;
@@ -1983,10 +1980,7 @@ void GuideGrid::quickRecord()
if (pginfo->GetTitle() == kUnknownTitle)
return;
- RecordingInfo ri(*pginfo);
- ri.ToggleRecord();
- *pginfo = ri;
-
+ QuickRecord(pginfo);
LoadFromScheduler(m_recList);
fillProgramInfos();
updateInfo();
@@ -415,11 +415,7 @@ void ProgFinder::getInfo(bool toggle)
if (curPick)
{
if (toggle)
- {
- RecordingInfo ri(*curPick);
- ri.ToggleRecord();
- *curPick = ri;
- }
+ QuickRecord(curPick);
else
EditRecording(curPick);
}
@@ -608,11 +608,7 @@ void ProgLister::RecordSelected(void)
{
ProgramInfo *pi = GetCurrent();
if (pi)
- {
- RecordingInfo ri(*pi);
- ri.ToggleRecord();
- *pi = ri;
- }
+ QuickRecord(pi);
}
void ProgLister::HandleClicked(void)
Oops, something went wrong.

0 comments on commit 9497ba1

Please sign in to comment.