Permalink
Browse files

Added recordedid column to recorded table and ProgramInfo class.

This commit populates recordedid and makes it available everywhere it
can be used.  Future commits will convert internal interfaces using
chanid/recstartts to recordedid where appropriate.  External
interfaces using chanid/recstarts will be maintained throuhg version
0.28 and possibly 0.29.

In addition to passing back the new recordedid from the recorder to
the scheduler, this commit also passes back the recstartts used to
make chanid/recstarts unique.  That fixes some minor issues caused by
the scheduler not knowning the actual recstartts.
  • Loading branch information...
1 parent b79b7ae commit e8a99d45c3c008526c831c2b8687c88ac0db99af @gigem gigem committed Jun 2, 2014
@@ -107,20 +107,20 @@ package MythTV;
# Note: as of July 21, 2010, this is actually a string, to account for proto
# versions of the form "58a". This will get used if protocol versions are
# changed on a fixes branch ongoing.
- our $PROTO_VERSION = "81";
- our $PROTO_TOKEN = "MultiRecDos";
+ our $PROTO_VERSION = "82";
+ our $PROTO_TOKEN = "IdIdO";
# currentDatabaseVersion is defined in libmythtv in
# mythtv/libs/libmythtv/dbcheck.cpp and should be the current MythTV core
# 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 = "1324";
+ our $SCHEMA_VERSION = "1325";
# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
# ProgramInfo::ToSringList and ProgramInfo::FromStringList.
- our $NUMPROGRAMLINES = 49;
+ our $NUMPROGRAMLINES = 50;
# Reasons a recording wouldn't be happening (from libs/libmythtv/programinfo.h)
our %RecStatus_Types = (
@@ -94,6 +94,8 @@ package MythTV::Program;
$self->{'parttotal'} = $_[47]; # part total
$self->{'categorytype'} = $_[48]; # category type (enum)
+ $self->{'recordedid'} = $_[49]; # recordedid
+
# Load the channel data
if ($self->{'chanid'}) {
$self->{'channel'} = $self->{'_mythtv'}->channel($self->{'chanid'});
@@ -144,52 +146,55 @@ package MythTV::Program;
$self->{'description'} , # 02 description
$self->{'season'} , # 03 season
$self->{'episode'} , # 04 episode
- $self->{'syndicatedepisode'}, # 05 syndicated episode
- $self->{'category'} , # 06 category
- $self->{'chanid'} , # 07 chanid
- $self->{'channum'} , # 08 chanstr
- $self->{'callsign'} , # 09 chansign
- $self->{'channame'} , # 10 channame
- $self->{'filename'} , # 11 pathname
- $self->{'filesize'} , # 12 filesize
+ $self->{'totalepisodes'} , # 05 episode
+ $self->{'syndicatedepisode'}, # 06 syndicated episode
+ $self->{'category'} , # 07 category
+ $self->{'chanid'} , # 08 chanid
+ $self->{'channum'} , # 09 chanstr
+ $self->{'callsign'} , # 10 chansign
+ $self->{'channame'} , # 11 channame
+ $self->{'filename'} , # 12 pathname
+ $self->{'filesize'} , # 13 filesize
- $self->{'starttime'} , # 13 startts
- $self->{'endtime'} , # 14 endts
- $self->{'findid'} , # 15 findid
- $self->{'hostname'} , # 16 hostname
- $self->{'sourceid'} , # 17 sourceid
- $self->{'cardid'} , # 18 cardid
- $self->{'inputid'} , # 19 inputid
- $self->{'recpriority'} , # 20 recpriority
- $self->{'recstatus'} , # 21 recstatus
- $self->{'recordid'} , # 22 recordid
+ $self->{'starttime'} , # 14 startts
+ $self->{'endtime'} , # 15 endts
+ $self->{'findid'} , # 16 findid
+ $self->{'hostname'} , # 17 hostname
+ $self->{'sourceid'} , # 18 sourceid
+ $self->{'cardid'} , # 19 cardid
+ $self->{'inputid'} , # 20 inputid
+ $self->{'recpriority'} , # 21 recpriority
+ $self->{'recstatus'} , # 22 recstatus
+ $self->{'recordid'} , # 23 recordid
- $self->{'rectype'} , # 23 rectype
- $self->{'dupin'} , # 24 dupin
- $self->{'dupmethod'} , # 25 dupmethod
- $self->{'recstartts'} , # 26 recstartts
- $self->{'recendts'} , # 27 recendts
- $self->{'progflags'} , # 28 programflags
- $self->{'recgroup'} , # 29 recgroup
- $self->{'outputfilters'} , # 30 chanOutputFilters
- $self->{'seriesid'} , # 31 seriesid
- $self->{'programid'} , # 32 programid
- $self->{'inetref'} , # 33 inetref
+ $self->{'rectype'} , # 24 rectype
+ $self->{'dupin'} , # 25 dupin
+ $self->{'dupmethod'} , # 26 dupmethod
+ $self->{'recstartts'} , # 27 recstartts
+ $self->{'recendts'} , # 28 recendts
+ $self->{'progflags'} , # 29 programflags
+ $self->{'recgroup'} , # 30 recgroup
+ $self->{'outputfilters'} , # 31 chanOutputFilters
+ $self->{'seriesid'} , # 32 seriesid
+ $self->{'programid'} , # 33 programid
+ $self->{'inetref'} , # 34 inetref
- $self->{'lastmodified'} , # 34 lastmodified
- $self->{'stars'} , # 35 stars
- $self->{'airdate'} , # 36 originalAirDate
- $self->{'playgroup'} , # 37 playgroup
- $self->{'recpriority2'} , # 38 recpriority2
- $self->{'parentid'} , # 39 parentid
- $self->{'storagegroup'} , # 40 storagegroup
- $self->{'audio_props'} , # 41 audio properties
- $self->{'video_props'} , # 42 video properties
- $self->{'subtitle_type'} , # 43 subtitle type
+ $self->{'lastmodified'} , # 35 lastmodified
+ $self->{'stars'} , # 36 stars
+ $self->{'airdate'} , # 37 originalAirDate
+ $self->{'playgroup'} , # 38 playgroup
+ $self->{'recpriority2'} , # 39 recpriority2
+ $self->{'parentid'} , # 40 parentid
+ $self->{'storagegroup'} , # 41 storagegroup
+ $self->{'audio_props'} , # 42 audio properties
+ $self->{'video_props'} , # 43 video properties
+ $self->{'subtitle_type'} , # 44 subtitle type
- $self->{'year'} , # 44 production year
- $self->{'partnumber'} , # 45 part number
- $self->{'parttotal'} , # 46 part total
+ $self->{'year'} , # 45 production year
+ $self->{'partnumber'} , # 46 part number
+ $self->{'parttotal'} , # 47 part total
+ $self->{'categorytype'} , # 48 part total
+ $self->{'recordedid'} , # 49 part total
'' # trailing separator
);
}
@@ -11,16 +11,16 @@ class MythBackend {
// MYTH_PROTO_VERSION is defined in libmyth in mythtv/libs/libmyth/mythcontext.h
// and should be the current MythTV protocol version.
- static $protocol_version = '81';
- static $protocol_token = 'MultiRecDos';
+ static $protocol_version = '82';
+ static $protocol_token = 'IdIdO';
// The character string used by the backend to separate records
static $backend_separator = '[]:[]';
// NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
// the number of items in a ProgramInfo QStringList group used by
// ProgramInfo::ToSringList and ProgramInfo::FromStringList.
- static $program_line_number = 49;
+ static $program_line_number = 50;
private $fp = null;
private $connected = false;
@@ -44,6 +44,7 @@ class MythTVRecording {
public $watched;
public $storagegroup;
public $bookmarkupdate;
+ public $recordedid;
public function __construct(&$MythTV, $ChanID = NULL, $StartTime = NULL) {
$this->MythTV = $MythTV;
@@ -841,7 +841,8 @@ class Program( CMPRecord, DictData, RECSTATUS, AUDIO_PROPS, \
'airdate', 'playgroup', 'recpriority2',
'parentid', 'storagegroup', 'audio_props',
'video_props', 'subtitle_type','year',
- 'part_number', 'part_total', 'categorytype']
+ 'part_number', 'part_total', 'categorytype',
+ 'recordedid']
_field_type = [ 3, 3, 3,
0, 0, 0,
3,
@@ -858,7 +859,8 @@ class Program( CMPRecord, DictData, RECSTATUS, AUDIO_PROPS, \
5, 3, 0,
3, 3, 0,
0, 0, 0,
- 0, 0, 0]
+ 0, 0, 0,
+ 0 ]
def __str__(self):
return u"<Program '%s','%s' at %s>" % (self.title,
self.starttime.isoformat(' '), hex(id(self)))
@@ -5,11 +5,11 @@
"""
OWN_VERSION = (0,28,-1,0)
-SCHEMA_VERSION = 1324
+SCHEMA_VERSION = 1325
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
-PROTO_VERSION = '81'
-PROTO_TOKEN = 'MultiRecDos'
+PROTO_VERSION = '82'
+PROTO_TOKEN = 'IdIdO'
BACKEND_SEP = '[]:[]'
INSTALL_PREFIX = '/usr/local'
@@ -66,7 +66,7 @@ const QString ProgramInfo::kFromRecordedQuery =
" r.findid, rec.dupin, rec.dupmethod, "//45-47
" p.syndicatedepisodenumber, p.partnumber, p.parttotal, "//48-50
" p.season, p.episode, p.totalepisodes, "//51-53
- " p.category_type "//54
+ " p.category_type, r.recordedid "//54-55
"FROM recorded AS r "
"LEFT JOIN channel AS c "
"ON (r.chanid = c.chanid) "
@@ -180,6 +180,8 @@ ProgramInfo::ProgramInfo(void) :
dupin(kDupsInAll),
dupmethod(kDupCheckSubThenDesc),
+ recordedid(0),
+
// everything below this line is not serialized
availableStatus(asAvailable),
spread(-1),
@@ -262,6 +264,8 @@ ProgramInfo::ProgramInfo(const ProgramInfo &other) :
dupin(other.dupin),
dupmethod(other.dupmethod),
+ recordedid(other.recordedid),
+
// everything below this line is not serialized
availableStatus(other.availableStatus),
spread(other.spread),
@@ -288,6 +292,7 @@ ProgramInfo::ProgramInfo(uint _chanid, const QDateTime &_recstartts) :
* \brief Constructs a ProgramInfo from data in 'recorded' table
*/
ProgramInfo::ProgramInfo(
+ uint _recordedid,
const QString &_title,
const QString &_subtitle,
const QString &_description,
@@ -415,6 +420,8 @@ ProgramInfo::ProgramInfo(
dupin(_dupin),
dupmethod(_dupmethod),
+ recordedid(_recordedid),
+
// everything below this line is not serialized
availableStatus(asAvailable),
spread(-1),
@@ -531,6 +538,8 @@ ProgramInfo::ProgramInfo(
dupin(0),
dupmethod(0),
+ recordedid(0),
+
// everything below this line is not serialized
availableStatus(asAvailable),
spread(-1),
@@ -660,6 +669,8 @@ ProgramInfo::ProgramInfo(
dupin(kDupsInAll),
dupmethod(kDupCheckSubThenDesc),
+ recordedid(0),
+
// everything below this line is not serialized
availableStatus(asAvailable),
spread(-1),
@@ -699,6 +710,7 @@ ProgramInfo::ProgramInfo(
dupin = s.dupin;
dupmethod = s.dupmethod;
findid = s.findid;
+ recordedid = s.recordedid;
// This is the exact showing (same chanid or callsign)
// which will be recorded
@@ -817,6 +829,8 @@ ProgramInfo::ProgramInfo(
dupin(kDupsInAll),
dupmethod(kDupCheckSubThenDesc),
+ recordedid(0),
+
// everything below this line is not serialized
availableStatus(asAvailable),
spread(-1),
@@ -1056,6 +1070,8 @@ void ProgramInfo::clone(const ProgramInfo &other,
dupin = other.dupin;
dupmethod = other.dupmethod;
+ recordedid = other.recordedid;
+
sourceid = other.sourceid;
inputid = other.inputid;
cardid = other.cardid;
@@ -1164,6 +1180,8 @@ void ProgramInfo::clear(void)
dupin = kDupsInAll;
dupmethod = kDupCheckSubThenDesc;
+ recordedid = 0;
+
sourceid = 0;
inputid = 0;
cardid = 0;
@@ -1328,6 +1346,8 @@ void ProgramInfo::ToStringList(QStringList &list) const
INT_TO_LIST(partnumber); // 46
INT_TO_LIST(parttotal); // 47
INT_TO_LIST(catType); // 48
+
+ INT_TO_LIST(recordedid); //49
/* do not forget to update the NUMPROGRAMLINES defines! */
}
@@ -1433,6 +1453,8 @@ bool ProgramInfo::FromStringList(QStringList::const_iterator &it,
INT_FROM_LIST(parttotal); // 47
ENUM_FROM_LIST(catType, CategoryType); // 48
+ INT_FROM_LIST(recordedid); // 49
+
if (!origChanid || !origRecstartts.isValid() ||
(origChanid != chanid) || (origRecstartts != recstartts))
{
@@ -1573,6 +1595,9 @@ void ProgramInfo::ToMap(InfoMap &progMap,
progMap["lastmodified"] =
MythDate::toString(lastmodified, kDateTimeFull | kSimplify);
+ if (recordedid)
+ progMap["recordedid"] = recordedid;
+
progMap["channum"] = chanstr;
progMap["chanid"] = chanid;
progMap["channame"] = channame;
@@ -1996,6 +2021,8 @@ bool ProgramInfo::LoadProgramFromRecorded(
dupin = RecordingDupInType(query.value(46).toInt());
dupmethod = RecordingDupMethodType(query.value(47).toInt());
+ recordedid = query.value(55).toUInt();
+
// ancillary data -- begin
programflags = FL_NONE;
set_flag(programflags, FL_CHANCOMMFREE,
@@ -5450,6 +5477,7 @@ bool LoadFromRecorded(
destination.push_back(
new ProgramInfo(
+ query.value(55).toUInt(),
query.value(0).toString(),
query.value(1).toString(),
query.value(2).toString(),
@@ -30,7 +30,7 @@
mythtv/bindings/python/MythTV/static.py (version number)
mythtv/bindings/python/MythTV/mythproto.py (layout)
*/
-#define NUMPROGRAMLINES 49
+#define NUMPROGRAMLINES 50
class ProgramInfo;
typedef AutoDeleteDeque<ProgramInfo*> ProgramList;
@@ -83,7 +83,8 @@ class MPUBLIC ProgramInfo
/// Constructs a ProgramInfo from data in 'recorded' table
ProgramInfo(uint chanid, const QDateTime &recstartts);
/// Constructs a ProgramInfo from data in 'recorded' table
- ProgramInfo(const QString &title,
+ ProgramInfo(uint recordedid,
+ const QString &title,
const QString &subtitle,
const QString &description,
uint season,
@@ -425,6 +426,7 @@ class MPUBLIC ProgramInfo
uint GetStars(uint range_max) const
{ return (int)(stars * range_max + 0.5f); }
+ uint GetRecordingID(void) const { return recordedid; }
RecStatusType GetRecordingStatus(void) const
{ return (RecStatusType)recstatus; }
RecStatusType GetOldRecordingStatus(void) const
@@ -532,6 +534,7 @@ class MPUBLIC ProgramInfo
programflags &= ~FL_IGNOREBOOKMARK;
programflags |= (ignore) ? FL_IGNOREBOOKMARK : 0;
}
+ void SetRecordingID(uint _recordedid) { recordedid = _recordedid; }
void SetRecordingStatus(RecStatusType status) { recstatus = status; }
void SetRecordingRuleType(RecordingType type) { rectype = type; }
void SetPositionMapDBReplacement(PMapDBReplacement *pmap)
@@ -747,6 +750,8 @@ class MPUBLIC ProgramInfo
uint8_t dupin;
uint8_t dupmethod;
+ uint recordedid;
+
// everything below this line is not serialized
uint8_t availableStatus; // only used for playbackbox.cpp
public:
Oops, something went wrong.

0 comments on commit e8a99d4

Please sign in to comment.