[mythtv] [PATCH] MythVideo & Mediamonitoring (suite)
Xavier Hervy
maxpower44 at tiscali.fr
Sun Jun 13 12:57:50 EDT 2004
Ok i send to patch the first is for mythtv :
- fix bug about lock drive
- get volumeid from iso9660
- allow plugin and more to getmedia by type
(QValueList<MythMediaDevice*>=gContext->GetMedias(MediaType)
the second one is a patch for mythvideo that illustrate how plugin can
acced to mediadevice.
If the first patch is ok for apply i will send patch for all other
plugin because :
1- MEDIAHANDLER prototype have change
2- mythcontext.h include mytnmedia.h and mythmediamonitor.h then plugin
should have INCLUDEPATH += $${PREFIX}/include/mythtv
Donovan, can you take a look and tell me what do you think about that ?
xavier
-------------- next part --------------
? mythtv/log
Index: mythtv/libs/libmyth/mythcdrom-linux.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythcdrom-linux.cpp,v
retrieving revision 1.2
diff -u -r1.2 mythcdrom-linux.cpp
--- mythtv/libs/libmyth/mythcdrom-linux.cpp 12 Jun 2004 21:02:17 -0000 1.2
+++ mythtv/libs/libmyth/mythcdrom-linux.cpp 13 Jun 2004 16:46:32 -0000
@@ -3,7 +3,8 @@
#include <linux/cdrom.h> // old ioctls for cdrom
#include <errno.h>
#include "mythcontext.h"
-
+#include <linux/iso_fs.h>
+#include <unistd.h>
#define ASSUME_WANT_AUDIO 1
MediaError MythCDROMLinux::eject()
@@ -67,7 +68,7 @@
//cout << "MythCDROMLinux::checkMedia - ";
//cout << "Test Media result != MEDIAERR_OK" << endl;
m_MediaType = MEDIATYPE_UNKNOWN;
- return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
+ return setStatus(MEDIASTAT_UNKNOWN);
}
//cout << "MythCDROMLinux::checkMedia - ";
@@ -85,31 +86,31 @@
//cout << "disk ok - ";
if (isMounted(true))
//cout << "it's mounted" << endl;
- return setStatus(MEDIASTAT_MOUNTED, OpenedHere);
+ return setStatus(MEDIASTAT_MOUNTED);
// If the disk is ok but not yet mounted we'll test it further down after this switch exits.
break;
case CDS_TRAY_OPEN:
case CDS_NO_DISC:
//cout << "Tray open or no disc" << endl;
m_MediaType = MEDIATYPE_UNKNOWN;
- return setStatus(MEDIASTAT_OPEN, OpenedHere);
+ return setStatus(MEDIASTAT_OPEN);
break;
case CDS_NO_INFO:
case CDS_DRIVE_NOT_READY:
//cout << "No info or drive not ready" << endl;
m_MediaType = MEDIATYPE_UNKNOWN;
- return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
+ return setStatus(MEDIASTAT_UNKNOWN);
default:
//cout << "unknown result from ioctl (" << ret << ")" << endl;
m_MediaType = MEDIATYPE_UNKNOWN;
- return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
+ return setStatus(MEDIASTAT_UNKNOWN);
}
if (mediaChanged())
{
//cout << "media changed - ";
// Regardless of the actual status lie here and say it's open for now, so we can over the case of a missed open.
- return setStatus(MEDIASTAT_OPEN, OpenedHere);
+ return setStatus(MEDIASTAT_OPEN);
}
else
{
@@ -127,12 +128,20 @@
//cout << "found a data disk" << endl;
// We'll return NOTMOUNTED here because we're switching media.
// The base class will try to mount the deivce causing the next pass to pick up the MOUNTED status.
- return setStatus(MEDIASTAT_NOTMOUNTED, OpenedHere);
+ //grab volumeinfo from iso9660
+ struct iso_primary_descriptor buf;
+ lseek(this->m_DeviceHandle,(off_t) 2048*16,SEEK_SET);
+ read(this->m_DeviceHandle,&buf,2048);
+ this->m_VolumeID = buf.volume_id;
+ // QString date_creation = QString(buf.creation_date).left(16);
+ cout << "VolumeID " << this->m_VolumeID << endl;
+
+ return setStatus(MEDIASTAT_NOTMOUNTED);
break;
case CDS_AUDIO:
//cout << "found an audio disk" << endl;
m_MediaType = MEDIATYPE_AUDIO;
- return setStatus(MEDIASTAT_USEABLE, OpenedHere);
+ return setStatus(MEDIASTAT_USEABLE);
break;
case CDS_MIXED:
m_MediaType = MEDIATYPE_MIXED;
@@ -140,30 +149,30 @@
// Note: Mixed mode CDs require an explixit mount call since we'll usually want the audio portion.
// undefine ASSUME_WANT_AUDIO to change this behavior.
#ifdef ASSUME_WANT_AUDIO
- return setStatus(MEDIASTAT_USEABLE, OpenedHere);
+ return setStatus(MEDIASTAT_USEABLE);
#else
mount();
- return setStatus(MEDIASTAT_NOTMOUNTED, OpenedHere);
+ return setStatus(MEDIASTAT_NOTMOUNTED);
#endif
break;
case CDS_NO_INFO:
case CDS_NO_DISC:
//cout << "found no disk" << endl;
m_MediaType = MEDIATYPE_UNKNOWN;
- return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
+ return setStatus(MEDIASTAT_UNKNOWN);
break;
default:
//cout << "found unknown disk type" << endl;
fprintf(stderr, "Unknown data type: %d\n", type);
m_MediaType = MEDIATYPE_UNKNOWN;
- return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
+ return setStatus(MEDIASTAT_UNKNOWN);
}
}
else if (m_Status == MEDIASTAT_MOUNTED ||
m_Status == MEDIASTAT_NOTMOUNTED)
{
//cout << "current status == " << MythMediaDevice::MediaStatusStrings[m_Status] << " setting status to not mounted - ";
- setStatus(MEDIASTAT_NOTMOUNTED, OpenedHere);
+ setStatus(MEDIASTAT_NOTMOUNTED);
}
if (m_AllowEject)
@@ -174,12 +183,9 @@
{
//cout << "device not open returning unknown" << endl;
m_MediaType = MEDIATYPE_UNKNOWN;
- return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
+ return setStatus(MEDIASTAT_UNKNOWN);
}
- if (OpenedHere)
- closeDevice();
-
//cout << "returning " << MythMediaDevice::MediaStatusStrings[m_Status] << endl;
return m_Status;
}
Index: mythtv/libs/libmyth/mythcontext.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythcontext.cpp,v
retrieving revision 1.121
diff -u -r1.121 mythcontext.cpp
--- mythtv/libs/libmyth/mythcontext.cpp 25 Apr 2004 14:59:40 -0000 1.121
+++ mythtv/libs/libmyth/mythcontext.cpp 13 Jun 2004 16:46:32 -0000
@@ -91,6 +91,8 @@
int m_logenable, m_logmaxcount, m_logprintlevel;
QMap<QString,int> lastLogCounts;
QMap<QString,QString> lastLogStrings;
+
+ MediaMonitor * media_monitor;
};
MythContextPrivate::MythContextPrivate(MythContext *lparent)
@@ -114,6 +116,8 @@
m_db = QSqlDatabase::addDatabase("QMYSQL3", "MythContext");
screensaver = new ScreenSaverControl();
+
+ media_monitor = NULL;
}
void MythContextPrivate::Init(bool gui, bool lcd)
@@ -1226,6 +1230,19 @@
d->m_settings->SetSetting(key, newValue);
}
+void MythContext::SetMediaMonitor(MediaMonitor * lmediamonitor)
+{
+ d->media_monitor = lmediamonitor;
+}
+
+QValueList <MythMediaDevice*> MythContext::GetMedias(MediaType mediatype)
+{
+ QValueList <MythMediaDevice*> medias;
+ if (d->media_monitor != NULL)
+ medias = d->media_monitor->getMedias(mediatype);
+ return medias;
+}
+
bool MythContext::SendReceiveStringList(QStringList &strlist, bool quickTimeout)
{
d->serverSockLock.lock();
Index: mythtv/libs/libmyth/mythcontext.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythcontext.h,v
retrieving revision 1.149
diff -u -r1.149 mythcontext.h
--- mythtv/libs/libmyth/mythcontext.h 4 Jun 2004 05:37:55 -0000 1.149
+++ mythtv/libs/libmyth/mythcontext.h 13 Jun 2004 16:46:32 -0000
@@ -15,6 +15,10 @@
#include <iostream>
#include <vector>
+
+#include <mythmediamonitor.h>
+#include <mythmedia.h>
+
using namespace std;
#if (QT_VERSION < 0x030100)
@@ -160,6 +164,9 @@
void SetSetting(const QString &key, const QString &newValue);
+ void SetMediaMonitor(MediaMonitor * lmediamonitor);
+ QValueList <MythMediaDevice*> GetMedias(MediaType mediatype);
+
QFont GetBigFont();
QFont GetMediumFont();
QFont GetSmallFont();
Index: mythtv/libs/libmyth/mythdialogs.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythdialogs.cpp,v
retrieving revision 1.74
diff -u -r1.74 mythdialogs.cpp
--- mythtv/libs/libmyth/mythdialogs.cpp 5 Jun 2004 04:01:42 -0000 1.74
+++ mythtv/libs/libmyth/mythdialogs.cpp 13 Jun 2004 16:46:40 -0000
@@ -76,7 +76,7 @@
struct MHData
{
- void (*callback)(void);
+ void (*callback)(MythMediaDevice * mediadevice);
int MediaType;
QString destination;
QString description;
@@ -110,6 +110,10 @@
void (*exitmenucallback)(void);
+ void (*exitmenumediadevicecallback)(MythMediaDevice *);
+ MythMediaDevice * mediadeviceforcallback;
+
+
int escapekey;
};
@@ -147,6 +151,8 @@
d->ignore_lirc_keys = false;
d->exitingtomain = false;
d->exitmenucallback = false;
+ d->exitmenumediadevicecallback = false;
+ d->mediadeviceforcallback = NULL;
d->escapekey = Key_Escape;
#ifdef USE_LIRC
@@ -305,6 +311,14 @@
d->exitmenucallback = NULL;
callback();
+ }else if(d->exitmenumediadevicecallback && d->mediadeviceforcallback)
+ {
+ void (*callback)(MythMediaDevice *)= d->exitmenumediadevicecallback;
+ d->exitmenumediadevicecallback = NULL;
+ MythMediaDevice * mediadevice = d->mediadeviceforcallback;
+ d->mediadeviceforcallback = NULL;
+
+ callback(mediadevice);
}
}
}
@@ -499,7 +513,7 @@
void MythMainWindow::RegisterMediaHandler(const QString &destination,
const QString &description,
const QString &key,
- void (*callback)(void),
+ void (*callback)(MythMediaDevice * mediadevice),
int mediaType)
{
(void)key;
@@ -597,7 +611,8 @@
{
cout << "Found a handler" << endl;
d->exitingtomain = true;
- d->exitmenucallback = itr.data().callback;
+ d->exitmenumediadevicecallback = itr.data().callback;
+ d->mediadeviceforcallback= pDev;
QApplication::postEvent(this, new ExitToMainMenuEvent());
break;
}
Index: mythtv/libs/libmyth/mythdialogs.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythdialogs.h,v
retrieving revision 1.37
diff -u -r1.37 mythdialogs.h
--- mythtv/libs/libmyth/mythdialogs.h 25 May 2004 05:08:53 -0000 1.37
+++ mythtv/libs/libmyth/mythdialogs.h 13 Jun 2004 16:46:40 -0000
@@ -91,7 +91,7 @@
const QString &key, void (*callback)(void));
void RegisterMediaHandler(const QString &destination,
const QString &description, const QString &key,
- void (*callback)(void), int mediaType);
+ void (*callback)(MythMediaDevice * mediadevice), int mediaType);
void RegisterMediaPlugin(const QString &name, const QString &desc,
MediaPlayCallback fn);
Index: mythtv/libs/libmyth/mythmedia.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythmedia.cpp,v
retrieving revision 1.6
diff -u -r1.6 mythmedia.cpp
--- mythtv/libs/libmyth/mythmedia.cpp 12 Jun 2004 21:02:17 -0000 1.6
+++ mythtv/libs/libmyth/mythmedia.cpp 13 Jun 2004 16:46:40 -0000
@@ -69,9 +69,6 @@
{
QString MountCommand;
- if (isDeviceOpen())
- closeDevice();
-
if (!m_SuperMount)
{
// Build a command line for mount/unmount and execute it... Is there a better way to do this?
@@ -79,8 +76,11 @@
MountCommand.sprintf("%s %s", PATHTO_MOUNT,
(const char*)m_DevicePath);
else
+ {
MountCommand.sprintf("%s %s", PATHTO_UNMOUNT,
(const char*)m_DevicePath);
+ closeDevice();
+ }
VERBOSE(VB_ALL, QString("Executing '%1'").arg(MountCommand));
if (0 == system(MountCommand))
@@ -91,13 +91,16 @@
onDeviceMounted();
}
else
- onDeviceUnmounted();
+ {
+ m_Status = MEDIASTAT_NOTMOUNTED;
+ onDeviceUnmounted();
+ }
return true;
}
else
{
- VERBOSE(VB_GENERAL, QString("Failed to mount %1.")
- .arg(m_DevicePath));
+ VERBOSE(VB_GENERAL, QString("Failed to %1.")
+ .arg(MountCommand));
}
}
else
@@ -179,7 +182,7 @@
return false;
}
-MediaStatus MythMediaDevice::setStatus( MediaStatus NewStatus, bool CloseIt )
+MediaStatus MythMediaDevice::setStatus( MediaStatus NewStatus)
{
MediaStatus OldStatus = m_Status;
@@ -203,8 +206,11 @@
// as MEDIASTAT_OPEN, MEDISTAT_ERROR or MEDIASTAT_UNKNOWN.
mount();
break;
- case MEDIASTAT_UNKNOWN:
+ case MEDIASTAT_UNKNOWN:break;
case MEDIASTAT_OPEN:
+ if (MEDIASTAT_MOUNTED == OldStatus)
+ unmount();
+ break;
case MEDIASTAT_USEABLE:
case MEDIASTAT_MOUNTED:
// get rid of the compiler warning...
@@ -217,9 +223,6 @@
}
- if (CloseIt)
- closeDevice();
-
return m_Status;
}
Index: mythtv/libs/libmyth/mythmedia.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythmedia.h,v
retrieving revision 1.3
diff -u -r1.3 mythmedia.h
--- mythtv/libs/libmyth/mythmedia.h 24 Feb 2004 07:31:08 -0000 1.3
+++ mythtv/libs/libmyth/mythmedia.h 13 Jun 2004 16:46:41 -0000
@@ -85,7 +85,7 @@
virtual void onDeviceMounted() {};
virtual void onDeviceUnmounted() {};
- MediaStatus setStatus(MediaStatus newStat, bool CloseIt=false);
+ MediaStatus setStatus(MediaStatus newStat);
QString m_MountPath; ///< The path to this media's mount point (i.e. /mnt/cdrom). Read only.
QString m_DevicePath; ///< The path to this media's device (i.e. /dev/cdrom). Read/write.
Index: mythtv/libs/libmyth/mythmediamonitor.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythmediamonitor.cpp,v
retrieving revision 1.7
diff -u -r1.7 mythmediamonitor.cpp
--- mythtv/libs/libmyth/mythmediamonitor.cpp 12 Jun 2004 21:02:17 -0000 1.7
+++ mythtv/libs/libmyth/mythmediamonitor.cpp 13 Jun 2004 16:46:41 -0000
@@ -286,6 +286,23 @@
m_Thread.wait();
}
+//Ask for available media
+QValueList <MythMediaDevice*> MediaMonitor::getMedias(MediaType mediatype)
+{
+ QValueList <MythMediaDevice*> medias;
+ QValueList <MythMediaDevice*>::Iterator itr = m_Devices.begin();
+ MythMediaDevice* pDev;
+ while (itr!=m_Devices.end())
+ {
+ pDev = *itr;
+ if ((pDev->getMediaType()==mediatype) &&
+ ((pDev->getStatus()==MEDIASTAT_USEABLE) ||
+ (pDev->getStatus()==MEDIASTAT_MOUNTED)))
+ medias.push_back(pDev);
+ itr++;
+ }
+ return medias;
+}
// Signal handler.
void MediaMonitor::mediaStatusChanged(MediaStatus oldStatus,
MythMediaDevice* pMedia)
Index: mythtv/libs/libmyth/mythmediamonitor.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythmediamonitor.h,v
retrieving revision 1.3
diff -u -r1.3 mythmediamonitor.h
--- mythtv/libs/libmyth/mythmediamonitor.h 12 Jun 2004 21:02:17 -0000 1.3
+++ mythtv/libs/libmyth/mythmediamonitor.h 13 Jun 2004 16:46:41 -0000
@@ -55,6 +55,7 @@
void checkDevices(void);
void startMonitoring(void);
void stopMonitoring(void);
+ QValueList <MythMediaDevice*> getMedias(MediaType mediatype);
public slots:
void mediaStatusChanged( MediaStatus oldStatus, MythMediaDevice* pMedia);
Index: mythtv/programs/mythfrontend/main.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/main.cpp,v
retrieving revision 1.145
diff -u -r1.145 main.cpp
--- mythtv/programs/mythfrontend/main.cpp 29 May 2004 18:30:46 -0000 1.145
+++ mythtv/programs/mythfrontend/main.cpp 13 Jun 2004 16:46:42 -0000
@@ -995,6 +995,7 @@
mon->addFSTab();
VERBOSE(VB_ALL, QString("Starting media monitor."));
mon->startMonitoring();
+ gContext->SetMediaMonitor(mon);
}
#endif
-------------- next part --------------
Index: mythvideo/settings.pro
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/settings.pro,v
retrieving revision 1.6
diff -u -r1.6 settings.pro
--- mythvideo/settings.pro 4 Aug 2003 01:05:51 -0000 1.6
+++ mythvideo/settings.pro 13 Jun 2004 16:46:45 -0000
@@ -4,6 +4,7 @@
PREFIX = /usr/local
INCLUDEPATH += $${PREFIX}/include
+INCLUDEPATH += $${PREFIX}/include/mythtv
INCLUDEPATH *= /usr/local/include
DEFINES += _GNU_SOURCE
Index: mythvideo/mythvideo/main.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/main.cpp,v
retrieving revision 1.31
diff -u -r1.31 main.cpp
--- mythvideo/mythvideo/main.cpp 12 Jun 2004 17:35:12 -0000 1.31
+++ mythvideo/mythvideo/main.cpp 13 Jun 2004 16:46:47 -0000
@@ -29,6 +29,7 @@
#include <mythtv/themedmenu.h>
#include <mythtv/mythcontext.h>
#include <mythtv/mythplugin.h>
+#include <mythmedia.h>
enum VideoFileLocation
{
@@ -54,6 +55,10 @@
void runVideoBrowser(void);
void runVideoTree(void);
void runVideoGallery(void);
+void runMediaHandle(MythMediaDevice * mediadevice)
+{
+ runVideoTree();
+}
void setupKeys(void)
{
@@ -74,7 +79,7 @@
REG_KEY("Video","INCPARENT","Increase Parental Level","Right");
REG_KEY("Video","DECPARENT","Decrease Parental Level","Left");
-
+ REG_MEDIA_HANDLER("Myth Video CD/DVD DATA Media handler","","",runMediaHandle,MEDIATYPE_DATA);
}
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 13 Jun 2004 16:46:48 -0000
@@ -8,10 +8,11 @@
#include "videotree.h"
-#include <mythtv/mythcontext.h>
-#include <mythtv/mythwidgets.h>
-#include <mythtv/uitypes.h>
-#include <mythtv/util.h>
+#include <mythcontext.h>
+#include <mythwidgets.h>
+#include <uitypes.h>
+#include <util.h>
+#include<mythmedia.h>
VideoTree::VideoTree(MythMainWindow *parent, QSqlDatabase *ldb,
QString window_name, QString theme_filename,
@@ -30,16 +31,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));
@@ -254,6 +262,9 @@
}
}
+void VideoTree::GetMountPoints(){
+
+}
void VideoTree::buildVideoList()
{
if(file_browser)
@@ -262,21 +273,70 @@
// Fill metadata from directory structure
//
- buildFileList(gContext->GetSetting("VideoStartupDir"));
-
+ QStringList nodesname;
+ QStringList nodespath;
+/*
+ QFile fstab("/etc/fstab");
+ fstab.open(IO_ReadOnly);
+ QString line;*/
+ nodespath.append(gContext->GetSetting("VideoStartupDir"));
+ nodesname.append("videos");
+ QValueList<MythMediaDevice*> medias = gContext->GetMedias(MEDIATYPE_DATA);
+ QValueList<MythMediaDevice*>::Iterator itr = medias.begin();
+ MythMediaDevice * pDev;
+ while (itr != medias.end())
+ {
+ pDev = *itr;
+ if (pDev){
+ QString path = pDev->getMountPath();
+ QString name = path.right(path.length()-path.findRev("/")-1);
+ cout << "adding " << path << " as " << name << endl;
+ nodespath.append(path);
+ nodesname.append(name);
+ }
+ itr++;
+ }
+/* while (fstab.readLine(line,1024)>0){
+ QStringList mountparams = QStringList::split(QRegExp("\t| "),line);
+ QStringList::Iterator vfstype = mountparams.at(2);
+ if ((*vfstype).contains("iso9660",false)>0){
+ QString path = *mountparams.at(1);
+ QString name = path.right(path.length()-path.findRev("/")-1);
+ cout << "adding " << path << " as " << name << endl;
+ nodespath.append(path);
+ nodesname.append(name);
+ }
+ }
+ fstab.close();
+ */
+ 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]);
+ }
+ int mainnodeindex=0;
+ QString prefix = nodespath[mainnodeindex];
+ GenericTree *where_to_add = video_tree_root->getChildAt(mainnodeindex);
for(uint i=0; i < browser_mode_files.count(); i++)
{
QString file_string = *(browser_mode_files.at(i));
- QString prefix = gContext->GetSetting("VideoStartupDir");
- if(prefix.length() < 1)
+
+ if (prefix.compare(file_string.left(prefix.length()))!=0){
+ mainnodeindex++;
+ }
+ if (mainnodeindex < nodespath.count()){
+ prefix = nodespath[mainnodeindex];
+ where_to_add = video_tree_root->getChildAt(mainnodeindex );
+ }
+ if(prefix.length() < 1)
{
cerr << "videotree.o: Seems unlikely that this is going to work" << endl;
}
file_string.remove(0, prefix.length());
QStringList list(QStringList::split("/", file_string));
- GenericTree *where_to_add;
- where_to_add = video_tree_data;
int a_counter = 0;
QStringList::Iterator an_it = list.begin();
for( ; an_it != list.end(); ++an_it)
@@ -319,6 +379,8 @@
// widget that handles navigation
//
+ video_tree_data = video_tree_root->addNode("videos", -2, false);
+
QSqlQuery query("SELECT intid FROM videometadata ;", db);
Metadata *myData;
Index: mythvideo/mythvideo/videotree.h
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videotree.h,v
retrieving revision 1.7
diff -u -r1.7 videotree.h
--- mythvideo/mythvideo/videotree.h 2 Sep 2003 20:09:53 -0000 1.7
+++ mythvideo/mythvideo/videotree.h 13 Jun 2004 16:46:49 -0000
@@ -5,8 +5,8 @@
#include <qmutex.h>
#include <qvaluevector.h>
-#include <mythtv/mythdialogs.h>
-#include <mythtv/uitypes.h>
+#include <mythdialogs.h>
+#include <uitypes.h>
#include "metadata.h"
@@ -25,6 +25,7 @@
const char *name = 0);
~VideoTree();
+ void GetMountPoints();
void buildVideoList();
void buildFileList(QString directory);
bool ignoreExtension(QString extension);
More information about the mythtv-dev
mailing list