[mythtv] hack for using removable with mythvideo
Leo Weppelman
leo at wau.mis.ah.nl
Fri Aug 20 10:30:26 EDT 2004
Attached is a quick hack to use the stuff on an inserted cdrom
in the video browser. The hack assumes a '/cdrom' mountpoint.
This is a quick hack, since I am unsure what the 'desired' direction is
for removable media in mythtv. For things like a video-dvd, audio-cd and
[s]vcd, things are reasonably simple, just fire-up the required player
menu (like this currently happens for dvd and [s]vcd). With non standaard
cd's and dvd's, it looks more complicated.
When playing with the dvd-player at my parents house, I found out that
when the player was confronted with a dvd that contained an iso9660
filesystem, you ended up in a filesystem viewer. When selecting a node
in the filesystem with a known extension (mp3, mpeg, avi etc...), it
started the required player. This worked reasonably well in practice.
It would have been even nicer if it was displayed on the lcd-display,
so I wouldn;t have to turn on the tv, when I just wanted to play some
music.
One could make this approach more intelligent by scanning the filesystem
for file-types first. And when it turns out that the dvd contains only
video data (.avi, .mpeg, .nuv...), you could be dropped into the video
browser.
I am throwing this into this group since I have a bunch of cd's and
dvd's that I'd like to use with mythtv. I don't mind to put some work
into it, but I hate to do work for naught since it will never get
accepted into cvs (I hate maintaining large personal patch trees ;-).
Just seeking opinions,
Leo.
-------------- next part --------------
Index: mythvideo/mythvideo/videotree.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videotree.cpp,v
retrieving revision 1.30
diff -u -r1.30 videotree.cpp
--- mythvideo/mythvideo/videotree.cpp 17 Aug 2004 21:45:30 -0000 1.30
+++ mythvideo/mythvideo/videotree.cpp 20 Aug 2004 13:50:33 -0000
@@ -30,9 +30,13 @@
wireUpTheme();
video_tree_root = new GenericTree("video root", -2, false);
+
video_tree_data = video_tree_root->addNode("videos", -2, false);
+ buildVideoList(gContext->GetSetting("VideoStartupDir"));
+
+ video_tree_data = video_tree_root->addNode("cdrom", -2, false);
+ buildVideoList("/cdrom");
- buildVideoList();
//
// Tell the tree list to highlight the
@@ -176,7 +180,7 @@
current_parental_level = which_level;
pl_value->SetText(QString("%1").arg(current_parental_level));
video_tree_data->deleteAllChildren();
- buildVideoList();
+ buildVideoList(gContext->GetSetting("VideoStartupDir"));
//
// Tell the tree list to highlight the
@@ -254,7 +258,7 @@
}
}
-void VideoTree::buildVideoList()
+void VideoTree::buildVideoList(QString directory)
{
if(file_browser)
{
@@ -262,15 +266,19 @@
// Fill metadata from directory structure
//
- buildFileList(gContext->GetSetting("VideoStartupDir"));
+ QString prefix = directory;
+ buildFileList(directory);
+ if(prefix.length() < 1)
+ {
+ cerr << "videotree.o: Seems unlikely that this is going to work" << endl;
+ }
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)
- {
- cerr << "videotree.o: Seems unlikely that this is going to work" << endl;
+
+ if (prefix.compare(file_string.left(prefix.length())) != 0) {
+ continue;
}
file_string.remove(0, prefix.length());
QStringList list(QStringList::split("/", file_string));
Index: mythvideo/mythvideo/videotree.h
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videotree.h,v
retrieving revision 1.9
diff -u -r1.9 videotree.h
--- mythvideo/mythvideo/videotree.h 17 Aug 2004 21:45:30 -0000 1.9
+++ mythvideo/mythvideo/videotree.h 20 Aug 2004 13:50:34 -0000
@@ -25,7 +25,7 @@
const char *name = 0);
~VideoTree();
- void buildVideoList();
+ void buildVideoList(QString directory);
void buildFileList(QString directory);
bool ignoreExtension(QString extension);
More information about the mythtv-dev
mailing list