[mythtv] [PATCH] mythvideo
Xavier Hervy
maxpower44 at tiscali.fr
Tue Jun 1 12:30:47 EDT 2004
This patch is not already apply then i send a patch that merge the
previous patch with a newer.
+ Now we can browse cd/DVD rom in video tree by adding a new node in tree.
+ On inserting a CD/DVD which is a "MEDIATYPE_DATA" cd, the videotree
is open to display the content (media handler).
display content of a cd/dvd only works if the checkbox "video list
browse file" is checked.
+ we can choice the mountpoint in video settings -> general settings.
Xavier
-------------- next part --------------
? mythvideo/log
Index: mythvideo/mythvideo/dbcheck.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/dbcheck.cpp,v
retrieving revision 1.4
diff -u -r1.4 dbcheck.cpp
--- mythvideo/mythvideo/dbcheck.cpp 2 Mar 2004 17:57:53 -0000 1.4
+++ mythvideo/mythvideo/dbcheck.cpp 1 Jun 2004 16:16:44 -0000
@@ -8,7 +8,7 @@
#include "mythtv/mythcontext.h"
-const QString currentDatabaseVersion = "1003";
+const QString currentDatabaseVersion = "1004";
static void UpdateDBVersionNumber(const QString &newnumber)
{
@@ -152,5 +152,13 @@
performActualUpdate(updates, "1003", dbver);
}
-}
+ if (dbver == "1003")
+ {
+ const QString updates[] = {
+"ALTER TABLE videometadata ADD COLUMN lastshown DATE DEFAULT NULL;",
+""
+};
+ performActualUpdate(updates, "1004", dbver);
+ }
+}
Index: mythvideo/mythvideo/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/globalsettings.cpp,v
retrieving revision 1.14
diff -u -r1.14 globalsettings.cpp
--- mythvideo/mythvideo/globalsettings.cpp 23 May 2004 20:07:39 -0000 1.14
+++ mythvideo/mythvideo/globalsettings.cpp 1 Jun 2004 16:16:45 -0000
@@ -150,6 +150,30 @@
};
};
+class VideoCDMountPoint: public LineEditSetting, public GlobalSetting {
+public:
+ VideoCDMountPoint():
+ GlobalSetting("VideoCDMountPoint") {
+ setLabel(QObject::tr("Mount point for CD/DVD Data"));
+ setValue("/mnt/cdrom");
+ setHelpText(QObject::tr("This directory must exist, and the user "
+ "running MythVideo needs to have read permission "
+ "to the directory."));
+ };
+};
+class VideoCDActionAfterUse : public ComboBoxSetting, public GlobalSetting {
+public:
+ VideoCDActionAfterUse() :
+ GlobalSetting("VideoCDActionAfterUse") {
+ setLabel(QObject::tr("Action after CD use"));
+ addSelection(QObject::tr("Nothing"), "0");
+ addSelection(QObject::tr("Umount"), "1");
+ addSelection(QObject::tr("Eject"), "2");
+ setHelpText(QObject::tr("This is the action made by MythVideo after using a CD/DVD Data in video tree with media handler."));
+ }
+};
+
+
//Player Settings
class VideoDefaultPlayer: public LineEditSetting, public GlobalSetting {
@@ -185,6 +209,12 @@
vman->addChild(new GetPostersCommand());
vman->addChild(new GetDataCommand());
addChild(vman);
+
+ VerticalConfigurationGroup* rds= new VerticalConfigurationGroup(false);
+ rds->setLabel(QObject::tr("Removal Drive Settings"));
+ rds->addChild(new VideoCDMountPoint());
+ rds->addChild(new VideoCDActionAfterUse());
+ addChild(rds);
}
VideoPlayerSettings::VideoPlayerSettings()
Index: mythvideo/mythvideo/main.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/main.cpp,v
retrieving revision 1.29
diff -u -r1.29 main.cpp
--- mythvideo/mythvideo/main.cpp 9 May 2004 22:53:26 -0000 1.29
+++ mythvideo/mythvideo/main.cpp 1 Jun 2004 16:16:45 -0000
@@ -28,6 +28,7 @@
#include <mythtv/themedmenu.h>
#include <mythtv/mythcontext.h>
#include <mythtv/mythplugin.h>
+#include <mythtv/mythmedia.h>
enum VideoFileLocation
{
@@ -52,6 +53,7 @@
void runVideoManager(void);
void runVideoBrowser(void);
void runVideoTree(void);
+void handleCDDataMedia(void);
void setupKeys(void)
{
@@ -70,7 +72,7 @@
REG_KEY("Video","INCPARENT","Increase Parental Level","Right");
REG_KEY("Video","DECPARENT","Decrease Parental Level","Left");
-
+ REG_MEDIA_HANDLER("MythVideo CD/DVD DATA Media Handler","","",handleCDDataMedia,MEDIATYPE_DATA);
}
@@ -239,6 +241,20 @@
delete tree;
}
+void handleCDDataMedia(void)
+{
+ runVideoTree();
+ int action = gContext->GetNumSetting("VideoCDActionAfterUse",1);
+ QString mountpoint =
+ gContext->GetSetting("VideoCDMountPoint");
+ switch (action){
+ case 0 : break;
+ case 1: myth_system(QString("umount %1").arg(mountpoint));break;
+ case 2: myth_system(QString("eject %1").arg(mountpoint));break;
+ }
+}
+
+
void VideoCallback(void *data, QString &selection)
{
(void)data;
Index: mythvideo/mythvideo/metadata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/metadata.cpp,v
retrieving revision 1.11
diff -u -r1.11 metadata.cpp
--- mythvideo/mythvideo/metadata.cpp 2 Mar 2004 17:57:53 -0000 1.11
+++ mythvideo/mythvideo/metadata.cpp 1 Jun 2004 16:16:46 -0000
@@ -94,7 +94,7 @@
cerr << "metadata.o: The following metadata update failed :" << thequery << endl;
}
}else{
- cout << "impossible de supprimmer le fichier" << endl;
+ cerr << "Enable to delete this file" << endl;
}
return isremoved;
}
@@ -157,7 +157,7 @@
QString thequery = "SELECT title,director,plot,rating,year,userrating,"
"length,filename,showlevel,intid,coverfile,inetref,"
- "childid, browse, playcommand FROM videometadata WHERE title=\"" +
+ "childid, browse, playcommand, lastshown FROM videometadata WHERE title=\"" +
title + "\"";
if (director != "")
@@ -188,6 +188,7 @@
childID = query.value(12).toUInt();
browse = query.value(13).toBool();
playcommand = query.value(14).toString();
+ lastshown = query.value(15).toDate();
}
}
@@ -199,7 +200,7 @@
QString thequery;
thequery = QString("SELECT title,director,plot,rating,year,userrating,"
"length,filename,showlevel,coverfile,inetref,childid,"
- "browse,playcommand, videocategory.category "
+ "browse,playcommand, videocategory.category, lastshown "
" FROM videometadata LEFT JOIN videocategory"
" ON videometadata.category = videocategory.intid"
" WHERE videometadata.intid=%1;")
@@ -226,7 +227,8 @@
browse = query.value(12).toBool();
playcommand = query.value(13).toString();
category = query.value(14).toString();
-
+ lastshown = query.value(15).toDate();
+
// Genres
fillGenres(db);
@@ -272,16 +274,24 @@
QString sqlcoverfile = coverfile;
sqlcoverfile.replace(QRegExp("\""), QString("\\\""));
+ QString sqllastshown;
+ if (lastshown.isNull())
+ sqllastshown = "NULL";
+ else
+ sqllastshown = QString("\"%1\"")
+ .arg(lastshown.toString(Qt::ISODate).replace(QRegExp("-"),""));
+
QString thequery;
thequery.sprintf("INSERT INTO videometadata (title,director,plot,"
"rating,year,userrating,length,filename,showlevel,"
- "coverfile,inetref,browse) VALUES "
+ "coverfile,inetref,browse, lastshown) VALUES "
"(\"%s\",\"%s\",\"%s\",\"%s\",%d,%f,%d,\"%s\",%d,\"%s\","
- "\"%s\", %d);",
+ "\"%s\", %d, %s);",
title.utf8().data(), director.utf8().data(),
plot.utf8().data(), rating.utf8().data(), year,
userrating, length, sqlfilename.utf8().data(), showlevel,
- sqlcoverfile.utf8().data(), inetref.utf8().data(),browse);
+ sqlcoverfile.utf8().data(), inetref.utf8().data(),browse,
+ sqllastshown.utf8().data());
db->exec(thequery);
@@ -346,18 +356,26 @@
int idCategory = getIdCategory(db);
+ QString sqllastshown;
+ if (lastshown.isNull())
+ sqllastshown = "NULL";
+ else
+ sqllastshown = QString("\"%1\"")
+ .arg(lastshown.toString(Qt::ISODate).replace(QRegExp("-"),""));
+
QString thequery;
thequery.sprintf("UPDATE videometadata SET title=\"%s\",director=\"%s\","
"plot=\"%s\",rating=\"%s\",year=%d,userrating=%f,"
"length=%d,filename=\"%s\",showlevel=%d,coverfile=\"%s\","
"inetref=\"%s\",browse=%d,playcommand=\"%s\",childid=%d,"
- "category=%d"
+ "category=%d, lastshown=%s"
" WHERE intid=%d",
title.utf8().data(), director.utf8().data(),
plot.utf8().data(), rating.utf8().data(), year,
userrating, length, sqlfilename.utf8().data(), showlevel,
sqlcoverfile.utf8().data(), inetref.utf8().data(), browse,
- playcommand.utf8().data(), childID, idCategory, id);
+ playcommand.utf8().data(), childID, idCategory,
+ sqllastshown.utf8().data(), id);
QSqlQuery a_query(thequery, db);
if(!a_query.isActive())
Index: mythvideo/mythvideo/metadata.h
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/metadata.h,v
retrieving revision 1.9
diff -u -r1.9 metadata.h
--- mythvideo/mythvideo/metadata.h 2 Mar 2004 17:57:53 -0000 1.9
+++ mythvideo/mythvideo/metadata.h 1 Jun 2004 16:16:47 -0000
@@ -61,6 +61,7 @@
category = other.category;
genres = other.genres;
countries = other.countries;
+ lastshown = other.lastshown;
}
~Metadata() {}
@@ -117,6 +118,9 @@
QStringList Countries() const { return countries;}
void setCountries(QStringList lcountries){countries = lcountries;}
+
+ QDate LastShown() const {return lastshown;}
+ void setLastShown (QDate llastshown) {lastshown = llastshown;}
void guessTitle();
void setField(QString field, QString data);
@@ -146,6 +150,7 @@
int length;
int showlevel;
bool browse;
+ QDate lastshown;
QString playcommand;
QString category;
QStringList genres;
Index: mythvideo/mythvideo/video-ui.xml
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/video-ui.xml,v
retrieving revision 1.26
diff -u -r1.26 video-ui.xml
--- mythvideo/mythvideo/video-ui.xml 22 May 2004 19:31:41 -0000 1.26
+++ mythvideo/mythvideo/video-ui.xml 1 Jun 2004 16:16:54 -0000
@@ -1013,10 +1013,10 @@
<font>display</font>
<value>User Rating :</value>
</textarea>
- <textarea name="browse_text" draworder="0" align="right">
+ <textarea name="lastshown_text" draworder="0" align="right">
<area>50,340,320,40</area>
<font>display</font>
- <value>Browse :</value>
+ <value>Last shown :</value>
</textarea>
<textarea name="orderby_text" draworder="0" align="right">
<area>50,380,320,40</area>
@@ -1072,7 +1072,7 @@
<image function="off" filename="mv_leftright_off.png"></image>
<image function="pushed" filename="mv_leftright_pushed.png"></image>
</selector>
- <selector name="browse_select" draworder="0">
+ <selector name="lastshown_select" draworder="0">
<area>380,335,300,40</area>
<font>display</font>
<image function="on" filename="mv_leftright_on.png"></image>
Index: mythvideo/mythvideo/videobrowser.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videobrowser.cpp,v
retrieving revision 1.31
diff -u -r1.31 videobrowser.cpp
--- mythvideo/mythvideo/videobrowser.cpp 22 May 2004 19:31:42 -0000 1.31
+++ mythvideo/mythvideo/videobrowser.cpp 1 Jun 2004 16:16:56 -0000
@@ -347,9 +347,9 @@
while (query.next())
{
unsigned int idnum = query.value(0).toUInt();
- bool is_browsable = query.value(1).toBool();
- if(is_browsable)
- {
+ // bool is_browsable = query.value(1).toBool();
+ // if(is_browsable)
+ // {
myData = new Metadata();
myData->setID(idnum);
myData->fillDataFromID(db);
@@ -358,7 +358,7 @@
m_list.append(*myData);
}
delete myData;
- }
+ // }
}
}
updateML = false;
@@ -428,6 +428,11 @@
Metadata *childItem = new Metadata;
Metadata *parentItem = new Metadata(*curitem);
+ //set lastshown property to current date
+ QDate ldate;
+ parentItem->setLastShown(ldate.currentDate());
+ parentItem->updateDatabase(db);
+
while (parentItem->ChildID() > 0 && playing_time.elapsed() > 10000)
{
@@ -440,12 +445,19 @@
selected(childItem);
playing_time.start();
myth_system((QString("%1 ") .arg(m_cmd)).local8Bit());
- }
+ //Set lastshown property to currentdate
+ childItem->setLastShown(ldate.currentDate());
+ childItem->updateDatabase(db);
+
+ }
delete parentItem;
parentItem = new Metadata(*childItem);
}
+ parentItem->setLastShown(QDate::currentDate());
+ parentItem->updateDatabase(db);
+
delete childItem;
delete parentItem;
Index: mythvideo/mythvideo/videofilter.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videofilter.cpp,v
retrieving revision 1.2
diff -u -r1.2 videofilter.cpp
--- mythvideo/mythvideo/videofilter.cpp 24 May 2004 01:19:11 -0000 1.2
+++ mythvideo/mythvideo/videofilter.cpp 1 Jun 2004 16:16:57 -0000
@@ -1,7 +1,7 @@
/*
- editmetadata.cpp
+ videofilter.cpp
- (c) 2003 Thor Sigvaldason, Isaac Richards, and ?? ??
+ (c) 2003 Xavier Hervy
Part of the mythTV project
@@ -22,7 +22,7 @@
year = gContext->GetNumSetting("VideoDefaultYear",-1);
runtime = gContext->GetNumSetting("VideoDefaultRuntime",-2);
userrating = gContext->GetNumSetting("VideoDefaultUserrating",-1);
- browse = gContext->GetNumSetting("VideoDefaultBrowse",-1);
+ lastshown = gContext->GetNumSetting("VideoDefaultLastShown",-2);
orderby = gContext->GetNumSetting("VideoDefaultOrderby",0);
}else{
category = -1;
@@ -31,10 +31,12 @@
year = -1;
runtime = -2;
userrating = -1;
- browse = -1;
+ lastshown = -2;
orderby = 0;
}
+ //if loaddefaultsettings == true then we are in browse mode
+ browse = loaddefaultsettings;
}
VideoFilterSettings::VideoFilterSettings(VideoFilterSettings *other)
@@ -46,7 +48,7 @@
year = other->year;
runtime = other->runtime;
userrating = other->userrating;
- browse = other->browse;
+ lastshown = other->lastshown;
orderby = other->orderby;
db = other->db;
}
@@ -63,7 +65,7 @@
gContext->SaveSetting("VideoDefaultYear", year);
gContext->SaveSetting("VideoDefaultRuntime", runtime);
gContext->SaveSetting("VideoDefaultUserrating", userrating);
- gContext->SaveSetting("VideoDefaultBrowse", browse);
+ gContext->SaveSetting("VideoDefaultLastShown", lastshown);
gContext->SaveSetting("VideoDefaultOrderby", orderby);
}
@@ -167,12 +169,25 @@
where += QString(" AND userrating >= %1").arg(userrating);
else
where = QString(" WHERE userrating >= %1").arg(userrating);
- if (browse !=-1)
+ if (lastshown !=-2)
+ if (lastshown==-1)
+ if (where)
+ where += QString(" AND lastshown is NULL ");
+ else
+ where = QString(" WHERE lastshown is NULL ");
+
+ else
+ if (where)
+
+ where += QString(" AND (lastshown IS NULL OR TO_DAYS(curdate())-TO_DAYS(lastshown) >= %1)").arg(lastshown);
+ else
+ where = QString(" WHERE (lastshown IS NULL OR TO_DAYS(curdate()-TO_DAYS(lastshown) >== %1)").arg(lastshown);
+ if (browse)
if (where)
- where += QString(" AND browse >= %1").arg(browse);
- else
- where = QString(" WHERE browse >= %1").arg(browse);
-return where;
+ where += QString(" AND browse = 1");
+ else
+ where = QString(" WHERE browse = 1");
+ return where;
}
QString VideoFilterSettings::BuildClauseOrderBy(){
@@ -203,27 +218,6 @@
tr("Result of this filter : No Videos")));
}
}
-/* QString q_string = QString("SELECT * FROM videometadata");
- QSqlQuery a_query(q_string,db);
- if(a_query.isActive() && numvideos_text)
- if (a_query.numRowsAffected()>0){
- int numvideo = a_query.numRowsAffected();
- QString select = QString("SELECT * FROM ");
- QString from = currentSettings->BuildClauseFrom();
- QString where = currentSettings->BuildClauseWhere();
- q_string = QString("%1 %2 %3")
- .arg(select).arg(from).arg(where);
- a_query.exec(q_string);
- if(a_query.isActive())
- numvideos_text->SetText(
- QString(tr("%1 of %2"))
- .arg(a_query.numRowsAffected())
- .arg(numvideo));
- }
- else{
- numvideos_text->SetText(QString(tr("No Videos")));
-
- }*/
}
void VideoFilterDialog::fillWidgets()
{
@@ -325,8 +319,6 @@
}
else
{
- /*QString s = QString("%1 " + tr("minutes") + " ~ " + "%2 " + tr("minutes"));
- s.arg(a_query.value(0).toInt()*30).arg((a_query.value(0).toInt()+1)*30); */
QString s = QString("%1 ").arg(a_query.value(0).toInt()*30);
s += tr("minutes");
s += " ~ " + QString("%1 ").arg((a_query.value(0).toInt()+1)*30);
@@ -355,12 +347,81 @@
}
userrating_select->setToItem(currentSettings->getUserrating());
}
- if (browse_select)
+ if (lastshown_select)
{
- browse_select->addItem(-1,"All");
- browse_select->addItem(1,"Yes");
- browse_select->addItem(0,"No");
- browse_select->setToItem(currentSettings->getBrowse());
+
+ lastshown_select->addItem(-2,"All");
+ lastshown_select->addItem(-1,"Never");
+ //by last years
+ QString q_string = QString("SELECT FLOOR((TO_DAYS(curdate())"
+ "-TO_DAYS(lastshown))/365) "
+ "FROM videometadata "
+ "WHERE lastshown IS NOT NULL "
+ "AND TO_DAYS(curdate())-TO_DAYS(lastshown) > 364 "
+ "GROUP BY FLOOR((TO_DAYS(curdate())"
+ "-TO_DAYS(lastshown))/365) DESC;");
+ QSqlQuery a_query(q_string, db);
+ if(a_query.isActive()&&a_query.numRowsAffected()>0)
+ {
+ while(a_query.next())
+ {
+ QString s = QString(tr("More than %1 year(s)")).arg(a_query.value(0).toInt());
+ lastshown_select->addItem(a_query.value(0).toInt()*365,s);
+ }
+ }
+ //by last months
+ q_string = QString("SELECT FLOOR((TO_DAYS(curdate())"
+ "-TO_DAYS(lastshown))/30) "
+ "FROM videometadata "
+ "WHERE lastshown IS NOT NULL "
+ "AND TO_DAYS(curdate())-TO_DAYS(lastshown) > 29 "
+ " AND TO_DAYS(curdate())-TO_DAYS(lastshown) < 365 "
+ "GROUP BY FLOOR((TO_DAYS(curdate())"
+ "-TO_DAYS(lastshown))/30) DESC;");
+ a_query.exec(q_string);
+ if(a_query.isActive()&&a_query.numRowsAffected()>0)
+ {
+ while(a_query.next())
+ {
+ QString s = QString(tr("More than %1 month(s)"))
+ .arg(a_query.value(0).toInt());
+ lastshown_select->addItem(a_query.value(0).toInt()*30,s);
+ }
+ }
+ //by last weeks
+ q_string = QString("SELECT FLOOR((TO_DAYS(curdate())-TO_DAYS(lastshown))/7) "
+ "FROM videometadata "
+ "WHERE lastshown IS NOT NULL "
+ "AND TO_DAYS(curdate())-TO_DAYS(lastshown) > 6 "
+ " AND TO_DAYS(curdate())-TO_DAYS(lastshown) < 30 "
+ "GROUP BY FLOOR((TO_DAYS(curdate())-TO_DAYS(lastshown))/7) DESC;");
+ a_query.exec(q_string);
+ if(a_query.isActive()&&a_query.numRowsAffected()>0)
+ {
+ while(a_query.next())
+ {
+ QString s = QString(tr("More than %1 week(s)")).arg(a_query.value(0).toInt());
+ lastshown_select->addItem(a_query.value(0).toInt()*7,s);
+ }
+
+
+
+ //by last 6 days
+ q_string = QString("SELECT TO_DAYS(curdate())-TO_DAYS(lastshown) "
+ "FROM videometadata "
+ "WHERE TO_DAYS(curdate()) - TO_DAYS(lastshown)<7 "
+ " AND lastshown IS NOT NULL "
+ "GROUP BY TO_DAYS(curdate())-TO_DAYS(lastshown) DESC;");
+ a_query.exec(q_string);
+ if(a_query.isActive()&&a_query.numRowsAffected()>0)
+ {
+ while(a_query.next())
+ {
+ QString s = QString("More than %1 day(s)").arg(a_query.value(0).toInt());
+ lastshown_select->addItem(a_query.value(0).toInt(),s);
+ }
+ }
+ lastshown_select->setToItem(currentSettings->getLastShown());
}
if (orderby_select)
{
@@ -371,7 +432,7 @@
orderby_select->setToItem(currentSettings->getOrderby());
}
}
-
+}
void VideoFilterDialog::keyPressEvent(QKeyEvent *e)
{
bool handled = false;
@@ -405,8 +466,8 @@
currentSelector = runtime_select;
if ((userrating_select)&&(getCurrentFocusWidget() == userrating_select))
currentSelector = userrating_select;
- if ((browse_select)&&(getCurrentFocusWidget() == browse_select))
- currentSelector = browse_select;
+ if ((lastshown_select)&&(getCurrentFocusWidget() == lastshown_select))
+ currentSelector = lastshown_select;
if ((orderby_select)&&(getCurrentFocusWidget() == orderby_select))
currentSelector = orderby_select;
if(currentSelector)
@@ -463,7 +524,7 @@
originalSettings->setYear(currentSettings->getYear());
originalSettings->setRuntime(currentSettings->getRuntime());
originalSettings->setUserrating(currentSettings->getUserrating());
- originalSettings->setBrowse(currentSettings->getBrowse());
+ originalSettings->setLastShown(currentSettings->getLastShown());
originalSettings->setOrderby(currentSettings->getOrderby());
}
done(0);
@@ -493,8 +554,8 @@
currentSettings->setRuntime(new_runtime);
update_numvideo();
}
-void VideoFilterDialog::setBrowse(int new_browse){
- currentSettings->setBrowse(new_browse);
+void VideoFilterDialog::setLastShown(int new_lastshown){
+ currentSettings->setLastShown(new_lastshown);
update_numvideo();
}
void VideoFilterDialog::setOrderby(int new_orderby){
@@ -533,10 +594,10 @@
connect(runtime_select, SIGNAL(pushed(int)),
this, SLOT(setRunTime(int)));
- browse_select = getUISelectorType("browse_select");
- if (browse_select)
- connect(browse_select, SIGNAL(pushed(int)),
- this, SLOT(setBrowse(int)));
+ lastshown_select = getUISelectorType("lastshown_select");
+ if (lastshown_select)
+ connect(lastshown_select, SIGNAL(pushed(int)),
+ this, SLOT(setLastShown(int)));
orderby_select = getUISelectorType("orderby_select");
if (orderby_select)
Index: mythvideo/mythvideo/videofilter.h
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videofilter.h,v
retrieving revision 1.1
diff -u -r1.1 videofilter.h
--- mythvideo/mythvideo/videofilter.h 2 Mar 2004 17:57:54 -0000 1.1
+++ mythvideo/mythvideo/videofilter.h 1 Jun 2004 16:16:57 -0000
@@ -43,8 +43,8 @@
/* int getShowlevel(void){return showlevel;};
void setShowlevel (int lshowlevel)
{showlevel = lshowlevel;};*/
- int getBrowse(void){return browse;};
- void setBrowse(int lbrowse){browse = lbrowse;};
+ int getLastShown(void){return lastshown;};
+ void setLastShown(int llastshown){lastshown = llastshown;};
int getOrderby (void) {return orderby;};
void setOrderby (int lorderby) {orderby = lorderby;};
private :
@@ -54,8 +54,8 @@
int year;
int runtime;
int userrating;
-// int showlevel;
- int browse;
+ bool browse;
+ int lastshown;
int orderby;
QSqlDatabase *db;
};
@@ -96,7 +96,7 @@
void setGenre(int new_genre);
void setRunTime(int new_runtime);
// void setShowlevel(int new_showlevel);
- void setBrowse(int new_browse);
+ void setLastShown(int new_lastshown);
void setOrderby(int new_orderby);
private:
void update_numvideo();
@@ -107,7 +107,7 @@
// GUI Stuff
//
// UISelectorType *showlevel_select;
- UISelectorType *browse_select;
+ UISelectorType *lastshown_select;
UISelectorType *orderby_select;
UISelectorType *year_select;
UISelectorType *userrating_select;
Index: mythvideo/mythvideo/videotree.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videotree.cpp,v
retrieving revision 1.28
diff -u -r1.28 videotree.cpp
--- mythvideo/mythvideo/videotree.cpp 10 Apr 2004 18:52:28 -0000 1.28
+++ mythvideo/mythvideo/videotree.cpp 1 Jun 2004 16:17:03 -0000
@@ -30,16 +30,23 @@
wireUpTheme();
video_tree_root = new GenericTree("video root", -2, false);
- video_tree_data = video_tree_root->addNode("videos", -2, false);
+ // video_tree_data = video_tree_root->addNode("videos", -2, false);
buildVideoList();
+
+
//
// Tell the tree list to highlight the
// first entry and then display it
//
-
- video_tree_list->setCurrentNode(video_tree_data);
+ for (int i=0; i < video_tree_root->childCount();i++){
+ video_tree_data = video_tree_root->getChildAt(i,0);
+ if ((video_tree_data->childCount()>0)
+ && (video_tree_data->getChildAt(0,0)->getString() !=
+ tr("No files found"))) break;
+ }
+ video_tree_list->setCurrentNode(video_tree_data);
if(video_tree_data->childCount() > 0)
{
video_tree_list->setCurrentNode(video_tree_data->getChildAt(0, 0));
@@ -262,12 +269,25 @@
// Fill metadata from directory structure
//
- buildFileList(gContext->GetSetting("VideoStartupDir"));
+ QStringList nodesname;
+ QStringList nodespath;
+ nodespath.append(gContext->GetSetting("VideoStartupDir"));
+ nodesname.append("videos");
+ nodespath.append(gContext->GetSetting("VideoCDMountPoint"));
+ nodesname.append("CD/DVD Rom");
+
+ for (uint j=0;j<nodesname.count();j++){
+ video_tree_data = video_tree_root->addNode(nodesname[j], -2, false);
+
+ browser_mode_files.clear();
+
+ buildFileList(nodespath[j]);
for(uint i=0; i < browser_mode_files.count(); i++)
{
QString file_string = *(browser_mode_files.at(i));
- QString prefix = gContext->GetSetting("VideoStartupDir");
+ // QString prefix = gContext->GetSetting("VideoStartupDir");
+ QString prefix = nodespath[j];
if(prefix.length() < 1)
{
cerr << "videotree.o: Seems unlikely that this is going to work" << endl;
@@ -310,6 +330,7 @@
video_tree_data->addNode(tr("No files found"), -1, false);
}
}
+ }
else
{
//
@@ -319,6 +340,8 @@
// widget that handles navigation
//
+ video_tree_data = video_tree_root->addNode("videos", -2, false);
+
QSqlQuery query("SELECT intid FROM videometadata ;", db);
Metadata *myData;
More information about the mythtv-dev
mailing list