Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update database schema to 1303. videosourcemap added to database and …

…cardinput.sourceid removed.
  • Loading branch information...
commit 8c64088b27ee82e4f8b367e75b416441ca3c6530 1 parent 23b918a
Lincoln authored
2  mythtv/bindings/perl/MythTV.pm
View
@@ -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 = "1302";
+ our $SCHEMA_VERSION = "1303";
# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
2  mythtv/bindings/python/MythTV/static.py
View
@@ -5,7 +5,7 @@
"""
OWN_VERSION = (0,26,-1,1)
-SCHEMA_VERSION = 1302
+SCHEMA_VERSION = 1303
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '74'
2  mythtv/libs/libmythbase/mythversion.h
View
@@ -57,7 +57,7 @@
* mythtv/bindings/php/MythBackend.php
#endif
-#define MYTH_DATABASE_VERSION "1302"
+#define MYTH_DATABASE_VERSION "1303"
MBASE_PUBLIC const char *GetMythSourceVersion();
46 mythtv/libs/libmythtv/dbcheck.cpp
View
@@ -77,6 +77,7 @@ The schema contains the following tables:
<tr><td>recordoverride <td>
<tr><td>settings <td>k(value,hostname)
<tr><td>videosource <td>pk(sourceid) uk(name)
+<tr><td>videosourcemap <td>pk(mapid)
<tr><td>displayprofilegroups <td>pk(name, host), uk(profileid)
<tr><td>displayprofiles <td>pk(profileid),
</table>
@@ -203,6 +204,20 @@ analog channels, us, us-cable, pal, etc.
+\section videosourcemap_table Video Source Map Table (videosourcemap)
+This table tells maps a capture card input to a video source for a particular
+function.
+
+The primary key, 'mapid', is automatically generated by the database.
+The 'sourceid' field gives the sourceid of the mapped video source.
+The 'cardinputid' field gives the id of the cardinput to link to.
+The 'type' gives the function of the map link. It can be 'main', 'eit' or 'scan'.
+'main' is a normal video source link for tv capture.
+'eit' is for collecting EIT guide data and applying it to another source.
+'scan' specifies the card to use for channel scanning in mythtv-setup.
+
+
+
\section channel_table Channel Table (channel)
The primary key, 'chanid' is generated by combining the source id with
a unique number from 0 to 99.
@@ -2022,6 +2037,25 @@ NULL
return false;
}
+ if (dbver == "1302")
+ {
+ const char *updates[] = {
+"CREATE TABLE videosourcemap ("
+" mapid int(10) unsigned NOT NULL AUTO_INCREMENT,"
+" sourceid int(10) NOT NULL DEFAULT '0',"
+" cardinputid int(10) NOT NULL DEFAULT '0',"
+" type varchar(128) NOT NULL DEFAULT '',"
+" PRIMARY KEY (mapid)"
+") ENGINE=MyISAM DEFAULT CHARSET=utf8;",
+"INSERT INTO videosourcemap (sourceid, cardinputid, type) "
+" SELECT sourceid, cardinputid, \"main\" FROM cardinput;",
+"ALTER TABLE cardinput DROP COLUMN sourceid;",
+NULL
+};
+ if (!performActualUpdate(updates, "1303", dbver))
+ return false;
+ }
+
return true;
}
@@ -2102,7 +2136,6 @@ bool InitializeMythSchema(void)
"CREATE TABLE cardinput ("
" cardinputid int(10) unsigned NOT NULL AUTO_INCREMENT,"
" cardid int(10) unsigned NOT NULL DEFAULT '0',"
-" sourceid int(10) unsigned NOT NULL DEFAULT '0',"
" inputname varchar(32) NOT NULL DEFAULT '',"
" externalcommand varchar(128) DEFAULT NULL,"
" changer_device varchar(128) DEFAULT NULL,"
@@ -3127,6 +3160,13 @@ bool InitializeMythSchema(void)
" PRIMARY KEY (sourceid),"
" UNIQUE KEY `name` (`name`)"
") ENGINE=MyISAM DEFAULT CHARSET=utf8;",
+"CREATE TABLE videosourcemap ("
+" mapid int(10) unsigned NOT NULL AUTO_INCREMENT,"
+" sourceid int(10) NOT NULL DEFAULT '0',"
+" cardinputid int(10) NOT NULL DEFAULT '0',"
+" type varchar(128) NOT NULL DEFAULT '',"
+" PRIMARY KEY (mapid)"
+") ENGINE=MyISAM DEFAULT CHARSET=utf8;",
"CREATE TABLE videotypes ("
" intid int(10) unsigned NOT NULL AUTO_INCREMENT,"
" extension varchar(128) NOT NULL,"
@@ -3306,7 +3346,7 @@ bool InitializeMythSchema(void)
"INSERT INTO settings VALUES ('mythfilldatabaseLastRunStatus','',NULL);",
"INSERT INTO settings VALUES ('DataDirectMessage','',NULL);",
"INSERT INTO settings VALUES ('HaveRepeats','0',NULL);",
-"INSERT INTO settings VALUES ('DBSchemaVer','1299',NULL);",
+"INSERT INTO settings VALUES ('DBSchemaVer','1303',NULL);",
"INSERT INTO settings VALUES ('DefaultTranscoder','0',NULL);",
"INSERT INTO videotypes VALUES (1,'txt','',1,0);",
"INSERT INTO videotypes VALUES (2,'log','',1,0);",
@@ -3342,7 +3382,7 @@ NULL
};
QString dbver = "";
- if (!performActualUpdate(updates, "1299", dbver))
+ if (!performActualUpdate(updates, "1303", dbver))
return false;
return true;
}
16 mythtv/libs/libmythtv/videosource.cpp
View
@@ -561,7 +561,6 @@ void CrossSourceCardInputSel::fillSelections()
"WHERE hostname = :HOSTNAME "
"ORDER BY cardid");
query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
-
if (!query.exec())
{
MythDB::DBError("CardInputEditor::load", query);
@@ -584,7 +583,6 @@ void CrossSourceCardInputSel::fillSelections()
QStringList inputLabels;
vector<CardInput*> cardInputs;
-
CardUtil::GetCardInputs(cardid, videodevice, cardtype,
inputLabels, cardInputs, false);
@@ -3104,12 +3102,13 @@ CardInput::CardInput(bool isDTVcard, bool isDVBcard,
basic->addChild(inputname);
basic->addChild(new InputDisplayName(*this));
+ maptype = QString("main");
+ initialcid = 0;
+
basic->addChild(sourceid);
basic->addChild(sourcecid);
basic->addChild(sourcemaptype);
- maptype = QString("main");
-
if (!isDTVcard)
{
basic->addChild(new ExternalChannelCommand(*this));
@@ -3199,9 +3198,8 @@ void CardInput::SetSourceID(const QString &sourceid)
int CardInput::findSourceMapID(void) const
{
- MSqlQuery query(MSqlQuery::InitCon());
-
- if (sourceid->getValue() > 0)
+ MSqlQuery query(MSqlQuery::InitCon());
+ if (sourceid->getValue().toInt() > 0)
{
query.prepare(
"SELECT mapid "
@@ -3224,7 +3222,7 @@ int CardInput::findSourceMapID(void) const
" (type = :MAPTYPE OR "
" type = '') ");
- query.bindValue(":CARDINPUTID", initialcid);
+ query.bindValue(":CARDINPUTID", getInputID());
query.bindValue(":MAPTYPE", maptype);
}
@@ -3247,6 +3245,8 @@ bool CardInput::setSourceMap(const QString &_maptype, const int _sourceid, const
{
maptype = _maptype;
initialcid = _initialcid;
+
+ // load desired sourceid into variable as this will be used in findmapid query
sourceid->setValue(QString::number(_sourceid));
loadByID(getInputID());
Please sign in to comment.
Something went wrong with that request. Please try again.