[mythtv] Patch to fix mythvideo + clean up interface
Joseph A. Caputo
jcaputo1 at comcast.net
Sun Feb 23 23:21:23 EST 2003
I don't know about anyone else, but the mythvideo interface has never
worked for me, so I wrote this patch to fix it. It includes:
- Fixed "profile" code so that the file list actually gets built!
- Changed the name of "mythexplorer-settings.txt" to
"mythvideo-settings.txt"
- Put in code to strip the file extension for display in the file list
(so file "The Matrix.avi" shows up as "The Matrix")
- Put in code so that parent directory always shows up as "(Up one
level)" in the list, instead of the actual name of the parent directory
- Put in code to prevent traversing above the directory specified as
"StartDir" (wouldn't want the wife & kids browsing through /var, /etc
!!)
- Updated the default "videomenu.xml" file to invoke mythvideo vs.
mythexplorer (*is* there a mythexplorer??)
That's all. Please post comments, complaints, suggestions or kudos.
-Joe C.
-------------- next part --------------
? mythvideo.diff
? mythvideo/.qmake.internal.cache
? mythvideo/mythvideo-settings.txt
Index: mythvideo/databasebox.cpp
===================================================================
RCS file: /var/lib/cvs/mythvideo/mythvideo/databasebox.cpp,v
retrieving revision 1.6
diff -u -d -r1.6 databasebox.cpp
--- mythvideo/databasebox.cpp 23 Feb 2003 15:10:21 -0000 1.6
+++ mythvideo/databasebox.cpp 24 Feb 2003 04:11:03 -0000
@@ -105,8 +105,15 @@
QString filename =(*it).Filename();
mdata->setFilename(filename);
mdata->setGenre((*it).Genre());
- mdata->setField("title",(*it).Filename());
- title=(*it).Filename().section('/',-1);
+ if (0 == (*it).Title().compare("title"))
+ {
+ title = filename.section('/',-1).section('.',0,0);
+ }
+ else
+ {
+ title = (*it).Title();
+ }
+ mdata->setTitle(title);
new TreeCheckItem(listview, title, NULL, mdata);
}
}
Index: mythvideo/dirlist.cpp
===================================================================
RCS file: /var/lib/cvs/mythvideo/mythvideo/dirlist.cpp,v
retrieving revision 1.4
diff -u -d -r1.4 dirlist.cpp
--- mythvideo/dirlist.cpp 23 Feb 2003 15:10:21 -0000 1.4
+++ mythvideo/dirlist.cpp 24 Feb 2003 04:11:03 -0000
@@ -46,11 +46,22 @@
if (fi->fileName() == "..")
{
- Metadata retdata(fi->absFilePath(), fi->absFilePath(), "album",
- "title", "dir",1900, 3, 40);
- playlist.append(retdata);
- ++it;
- continue;
+ // Don't add parent directory if we're already at the top of
+ // the current tree -- don't want MythVideo users randomly
+ // browsing the host file system!
+ if (0 == directory.compare(gContext->GetSetting("StartDir")))
+ {
+ ++it;
+ continue;
+ }
+ else
+ {
+ Metadata retdata(fi->absFilePath(), fi->absFilePath(), "album",
+ "(Up one level)", "dir",1900, 3, 40);
+ playlist.append(retdata);
+ ++it;
+ continue;
+ }
}
QString filename = fi->absFilePath();
@@ -65,8 +76,7 @@
QString ext = filename.section('.',-1);
//printf("profile:%s\n",gContext->GetSetting("Profile").ascii());
QString prof = gContext->GetSetting("Profile");
- QString prof_name = "profile_" + prof;
- if (gContext->GetSetting(prof_name).contains(ext, FALSE))
+ if (prof.contains(ext, FALSE))
{
data = CheckFile(filename);
playlist.append(*data);
Index: mythvideo/main.cpp
===================================================================
RCS file: /var/lib/cvs/mythvideo/mythvideo/main.cpp,v
retrieving revision 1.5
diff -u -d -r1.5 main.cpp
--- mythvideo/main.cpp 5 Feb 2003 19:48:13 -0000 1.5
+++ mythvideo/main.cpp 24 Feb 2003 04:11:03 -0000
@@ -81,7 +81,7 @@
gContext->LoadQtConfig();
- gContext->LoadSettingsFiles("mythexplorer-settings.txt");
+ gContext->LoadSettingsFiles("mythvideo-settings.txt");
if (a.argc() > 1)
gContext->SetSetting("StartDir",a.argv()[1]);
Index: mythvideo/mythvideo.pro
===================================================================
RCS file: /var/lib/cvs/mythvideo/mythvideo/mythvideo.pro,v
retrieving revision 1.5
diff -u -d -r1.5 mythvideo.pro
--- mythvideo/mythvideo.pro 18 Feb 2003 01:25:04 -0000 1.5
+++ mythvideo/mythvideo.pro 24 Feb 2003 04:11:03 -0000
@@ -11,7 +11,7 @@
INSTALLS += target
installfiles.path = $${PREFIX}/share/mythtv
-installfiles.files = mythexplorer-settings.txt videomenu.xml
+installfiles.files = mythvideo-settings.txt videomenu.xml
INSTALLS += installfiles
Index: mythvideo/videomenu.xml
===================================================================
RCS file: /var/lib/cvs/mythvideo/mythvideo/videomenu.xml,v
retrieving revision 1.2
diff -u -d -r1.2 videomenu.xml
--- mythvideo/videomenu.xml 29 Jan 2003 02:07:42 -0000 1.2
+++ mythvideo/videomenu.xml 24 Feb 2003 04:11:03 -0000
@@ -3,13 +3,13 @@
<button>
<type>TV</type>
<text>TV Shows</text>
- <action>EXEC mythexplorer /mnt/movies movies</action>
+ <action>EXEC mythvideo /mnt/tvshows</action>
</button>
<button>
<type>Videos</type>
<text>Movies</text>
- <action>EXEC mythexplorer /mnt/tvshows movies</action>
+ <action>EXEC mythvideo /mnt/movies</action>
</button>
More information about the mythtv-dev
mailing list