[mythtv] [PATCH] MythVideo Automatic playing of multiple movie parts
DanM
dan at milkcarton.com
Sat Jul 26 12:49:54 EDT 2003
As per the discussion yesterday, this will allow mythvideo to play
multiple parts to the same movie. Currently, the configuration for this
must be done by hand, but its simple to do. A database update is
required. To set the relatioship between the parent and child item in
the db, set the childID column of the parent to be the intid of the child.
Ex:
intid Title childid
| 1 | Back to the Future 1 Part1 | 2 |
| 2 | Back to the Future 1 Part2 | 3 |
| 3 | Back to the Future 1 Part3 | 0 |
If anything needs to be done differently to get this commited, please
let me know
-dan
-------------- next part --------------
Index: mythvideo/metadata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/metadata.cpp,v
retrieving revision 1.3
diff -u -d -r1.3 metadata.cpp
--- mythvideo/metadata.cpp 12 Jul 2003 02:19:16 -0000 1.3
+++ mythvideo/metadata.cpp 26 Jul 2003 19:37:43 -0000
@@ -37,6 +37,8 @@
coverfile = data;
else if (field == "inetref")
inetref = data;
+ else if (field == "childid")
+ childID = data.toUInt();
}
void Metadata::fillData(QSqlDatabase *db)
@@ -45,7 +47,7 @@
return;
QString thequery = "SELECT title,director,plot,rating,year,userrating,length,"
- "filename,showlevel,intid,coverfile,inetref FROM videometadata WHERE title=\"" +
+ "filename,showlevel,intid,coverfile,inetref,childid FROM videometadata WHERE title=\"" +
title + "\"";
if (director != "")
@@ -73,6 +75,7 @@
id = query.value(9).toUInt();
coverfile = query.value(10).toString();
inetref = query.value(11).toString();
+ childID = query.value(12).toUInt();
}
}
@@ -83,7 +86,7 @@
QString thequery;
thequery = QString("SELECT title,director,plot,rating,year,userrating,length,"
- "filename,showlevel,coverfile,inetref FROM videometadata WHERE intid=%1;")
+ "filename,showlevel,coverfile,inetref,childid FROM videometadata WHERE intid=%1;")
.arg(id);
QSqlQuery query = db->exec(thequery);
@@ -103,6 +106,7 @@
showlevel = query.value(8).toInt();
coverfile = query.value(9).toString();
inetref = query.value(10).toString();
+ childID = query.value(11).toUInt();
}
}
@@ -195,4 +199,3 @@
db->exec(thequery);
}
-
Index: mythvideo/metadata.h
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/metadata.h,v
retrieving revision 1.3
diff -u -d -r1.3 metadata.h
--- mythvideo/metadata.h 12 Jul 2003 02:19:16 -0000 1.3
+++ mythvideo/metadata.h 26 Jul 2003 19:37:43 -0000
@@ -11,7 +11,7 @@
public:
Metadata(QString lfilename = "", QString lcoverfile = "", QString ltitle = "", int lyear = 0,
QString linetref = "", QString ldirector = "", QString lplot = "", float luserrating = 0.0,
- QString lrating = "", int llength = 0, int lid = 0, int lshowlevel = 1)
+ QString lrating = "", int llength = 0, int lid = 0, int lshowlevel = 1, unsigned int lchildID = 0)
{
filename = lfilename;
coverfile = lcoverfile;
@@ -25,6 +25,7 @@
length = llength;
showlevel = lshowlevel;
id = lid;
+ childID = lchildID;
}
Metadata(const Metadata &other)
@@ -41,6 +42,7 @@
length = other.length;
showlevel = other.showlevel;
id = other.id;
+ childID = other.childID;
}
~Metadata() {}
@@ -71,7 +73,10 @@
unsigned int ID() { return id; }
void setID(int lid) { id = lid; }
-
+
+ unsigned int ChildID() { return childID; }
+ void setChildID(int lchildID) { childID = lchildID; }
+
int ShowLevel() { return showlevel; }
void setShowLevel(int lshowlevel) { showlevel = lshowlevel; }
@@ -94,6 +99,7 @@
QString director;
QString plot;
QString rating;
+ unsigned int childID;
int year;
float userrating;
int length;
Index: mythvideo/videobrowser.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videobrowser.cpp,v
retrieving revision 1.6
diff -u -d -r1.6 videobrowser.cpp
--- mythvideo/videobrowser.cpp 12 Jul 2003 02:19:16 -0000 1.6
+++ mythvideo/videobrowser.cpp 26 Jul 2003 19:37:43 -0000
@@ -70,7 +70,7 @@
{
switch (e->key())
{
- case Key_Space: case Key_Enter: case Key_Return: selected(); return;
+ case Key_Space: case Key_Enter: case Key_Return: selected(curitem); return;
default: break;
}
}
@@ -218,8 +218,31 @@
}
else if (m_state == 4)
{
+ //Play the movie
system((QString("%1 ") .arg(m_cmd)).ascii());
+ Metadata *childItem = new Metadata;
+ Metadata *parentItem = new Metadata(*curitem);
+
+ while(parentItem->ChildID())
+ {
+ childItem->setID(parentItem->ChildID());
+ childItem->fillDataFromID(db);
+
+ if(parentItem->ChildID())
+ {
+ //Load up data about this child
+ selected(childItem);
+ system((QString("%1 ") .arg(m_cmd)).ascii());
+ }
+
+ delete parentItem;
+ Metadata *parentItem = new Metadata(*childItem);
+ }
+
+ delete childItem;
+ delete parentItem;
+
backup.begin(this);
backup.drawPixmap(0, 0, myBackground);
backup.end();
@@ -490,10 +513,10 @@
update(browsingRect);
}
-void VideoBrowser::selected()
+void VideoBrowser::selected(Metadata *someItem)
{
- QString filename = curitem->Filename();
- QString ext = curitem->Filename().section('.',-1);
+ QString filename = someItem->Filename();
+ QString ext = someItem->Filename().section('.',-1);
QString handler = gContext->GetSetting("VideoDefaultPlayer");
QString arg;
@@ -502,7 +525,8 @@
cout << "command:" << command << endl;
- m_title = curitem->Title();
+
+ m_title = someItem->Title();
LayerSet *container = NULL;
container = theme->GetSet("playwait");
if (container)
Index: mythvideo/videobrowser.h
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videobrowser.h,v
retrieving revision 1.2
diff -u -d -r1.2 videobrowser.h
--- mythvideo/videobrowser.h 14 Jun 2003 23:24:11 -0000 1.2
+++ mythvideo/videobrowser.h 26 Jul 2003 19:37:43 -0000
@@ -26,7 +26,7 @@
protected slots:
- void selected();
+ void selected(Metadata *someItem);
void cursorLeft();
void cursorRight();
void cursorDown();
Index: mythvideo/videomanager.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videomanager.cpp,v
retrieving revision 1.9
diff -u -d -r1.9 videomanager.cpp
--- mythvideo/videomanager.cpp 22 Jul 2003 22:41:35 -0000 1.9
+++ mythvideo/videomanager.cpp 26 Jul 2003 19:37:43 -0000
@@ -374,7 +374,7 @@
+ " HTTP/1.1\nHost: " + host + "\nUser-Agent: Mozilla/9.876 (X11; U; Linux 2.2.12-20 i686, en)"
+ " Gecko/25250101 Netscape/5.432b1\n");
- //cout << "Grabbing Data From: " << url.toString() << endl;
+ cout << "Grabbing Data From: " << url.toString() << endl;
if (InetGrabber)
{
@@ -407,7 +407,7 @@
+ " HTTP/1.1\nHost: us.imdb.com\nUser-Agent: Mozilla/9.876 (X11; U; Linux 2.2.12-20 i686, en)"
+ " Gecko/25250101 Netscape/5.432b1\n");
- //cout << "Grabbing Listing From: " << url.toString() << endl;
+ cout << "Grabbing Listing From: " << url.toString() << endl;
if (InetGrabber)
{
Index: videodb/cvs.sql
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/videodb/cvs.sql,v
retrieving revision 1.1
diff -u -d -r1.1 cvs.sql
--- videodb/cvs.sql 27 May 2003 21:09:33 -0000 1.1
+++ videodb/cvs.sql 26 Jul 2003 19:37:43 -0000
@@ -1,9 +1,8 @@
-quit
#
# Make sure you read the README in this directory and
# alter the value for MY_HOST_NAME. You can then
# remove the first line of this file (quit) and
-# run it through mysql.
+# run it through mysql.
#
USE mythconverg;
-
+alter table videometadata add childid int unsigned not null default 0;
More information about the mythtv-dev
mailing list