Skip to content

Commit

Permalink
Add recording rule templates.
Browse files Browse the repository at this point in the history
Recording rule templates are used to initialize new recording rules.
Templates can also be used to modify existing rules.  The "Default"
template replaces several, individual settings previously available in
the Setup wizard.  Those settings are automatically propagated to the
Default template.

Templates can be added, edited and deleted from within the Recording
Rules screen.  To add a new template, choose MENU / "New Template" and
then enter the name of the new template.  To edit a template,
highlight it and then choose ENTER or EDIT to bring up the schedule
editor.  To delete a template, highlight it and then choose DELETE or
edit it and change the type to "Delete this recording rule template."

When a regular rule is created, MythTV first tries to use the template
whose name matches the category of the program.  Failing that, it
tries to use the template whose name matches the category type of the
program.  If no template is found which matches the category or
category type, the Default template is used.

For example, if a user frequently records baseball games, he can
create a "Baseball" template which automatically sets the end-late
option to allow for extra innings.  Likewise, a user can create a
"Series" template which automatically sets the duplicate checking
method and the episode limit.

When a search, manual or template rule is created, the Default
template is always used.

The names of template need not match program categories or category
types.  They can simply be available to apply to other rules.  To
apply a different template to an existing rule, including a template
rule, begin editing the rule and then press MENU / "Use Template."
For example, a user can create an "Archive" template which changes the
recording group to "Archive" and turns off auto-expiry.
  • Loading branch information
gigem committed May 4, 2012
1 parent 390569b commit 71c65ba
Show file tree
Hide file tree
Showing 19 changed files with 678 additions and 406 deletions.
2 changes: 1 addition & 1 deletion mythtv/bindings/perl/MythTV.pm
Expand Up @@ -114,7 +114,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 = "1301";
our $SCHEMA_VERSION = "1302";

# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
Expand Down
2 changes: 1 addition & 1 deletion mythtv/bindings/python/MythTV/static.py
Expand Up @@ -5,7 +5,7 @@
"""

OWN_VERSION = (0,26,-1,0)
SCHEMA_VERSION = 1301
SCHEMA_VERSION = 1302
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '73'
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmyth/programinfo.h
Expand Up @@ -479,6 +479,7 @@ class MPUBLIC ProgramInfo
void SetFilesize( uint64_t sz) { filesize = sz; }
void SetSeriesID( const QString &id) { seriesid = id; }
void SetProgramID( const QString &id) { programid = id; }
void SetCategory( const QString &cat) { category = cat; }
void SetCategoryType( const QString &type) { catType = type; }
void SetRecordingPriority(int priority) { recpriority = priority; }
void SetRecordingPriority2(int priority) { recpriority2 = priority; }
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmyth/recordingtypes.cpp
Expand Up @@ -19,6 +19,7 @@ int RecTypePriority(RecordingType rectype)
case kFindDailyRecord: return 8; break;
case kChannelRecord: return 9; break;
case kAllRecord: return 10; break;
case kTemplateRecord: return 0; break;
default: return 11;
}
}
Expand Down Expand Up @@ -47,6 +48,8 @@ QString toString(RecordingType rectype)
case kOverrideRecord:
case kDontRecord:
return QObject::tr("Override Recording");
case kTemplateRecord:
return QObject::tr("Template Recording");
default:
return QObject::tr("Not Recording");
}
Expand Down Expand Up @@ -101,6 +104,8 @@ RecordingType recTypeFromString(QString type)
return kFindDailyRecord;
else if (type.toLower() == "find weekly" || type.toLower() == "findweekly")
return kFindWeeklyRecord;
else if (type.toLower() == "template" || type.toLower() == "template")
return kTemplateRecord;
else if (type.toLower() == "override recording" || type.toLower() == "override")
return kOverrideRecord;
else
Expand Down Expand Up @@ -133,6 +138,8 @@ QChar toQChar(RecordingType rectype)
case kDontRecord:
ret = QObject::tr("O", "RecTypeChar kOverrideRecord/kDontRecord");
break;
case kTemplateRecord:
ret = QObject::tr("t", "RecTypeChar kTemplateRecord"); break;
case kNotRecording:
default:
ret = " ";
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmyth/recordingtypes.h
Expand Up @@ -17,7 +17,8 @@ typedef enum RecordingTypes
kOverrideRecord,
kDontRecord,
kFindDailyRecord,
kFindWeeklyRecord
kFindWeeklyRecord,
kTemplateRecord
} RecordingType; // note stored in uin8_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.26.20120502-1"
#define MYTH_BINARY_VERSION "0.26.20120503-1"

/** \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 "1301"
#define MYTH_DATABASE_VERSION "1302"


MBASE_PUBLIC const char *GetMythSourceVersion();
Expand Down
13 changes: 13 additions & 0 deletions mythtv/libs/libmythtv/dbcheck.cpp
Expand Up @@ -15,6 +15,7 @@ using namespace std;
#include "diseqcsettings.h" // for convert_diseqc_db()
#include "videodbcheck.h" // for 1267
#include "compat.h"
#include "recordingrule.h"

#define MINIMUM_DBMS_VERSION 5,0,15

Expand Down Expand Up @@ -1982,6 +1983,18 @@ NULL
return false;
}

if (dbver == "1301")
{
// Create the Default recording rule template
RecordingRule record;
record.MakeTemplate("Default");
record.m_type = kTemplateRecord;
record.Save(false);

if (!UpdateDBVersionNumber("1302", dbver))
return false;
}

return true;
}

Expand Down

0 comments on commit 71c65ba

Please sign in to comment.