[mythtv] [PATCH] MythVideo: Configuration of browsable flag on
newly-scanned files
David Zanetti
dave2 at wetstring.net
Mon Oct 27 03:04:39 EST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
First patch I've attempted, it's probably not stylistically correct (or
very good C++, it's just not the same as C is it? :) ), or even the
correct place to do it, but it Works For Me(tm) so I thought I'd share it.
I set up a MythTV box a few days ago, and have been really impressed with
the results. There was only one thing bugging me, 99.9% of the time newly
scanned files in MythVideo I don't want browsable, just to appear in the
video list.
So this little patch adds a new configuration option which sets whether
newly scanned files are set browsable or not. It _should_ remain the same
default behaviour (always set browsable) if the switch isn't touched with
the patch applied.
Enjoy.
- --
David Zanetti | (__)
#include <geek/unix.h> | ( oo Mooooooo
http://hairy.geek.nz/ | /(_O ./
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6
iD8DBQE/nNGZT21+qRy4P+QRApC6AKCFn47iGlkwLDExf0tZ86kQyws/9ACgkdSU
u6O9e+mGhX0MhsX1G7uL4Hc=
=lsnH
-----END PGP SIGNATURE-----
-------------- next part --------------
diff -ur mythvideo-0.12-orig/mythvideo/globalsettings.cpp mythvideo-0.12/mythvideo/globalsettings.cpp
--- mythvideo-0.12-orig/mythvideo/globalsettings.cpp 2003-09-10 11:59:11.000000000 +1200
+++ mythvideo-0.12/mythvideo/globalsettings.cpp 2003-10-27 19:57:50.000000000 +1300
@@ -88,6 +88,19 @@
};
};
+class VideoNewBrowsable: public CheckBoxSetting, public GlobalSetting {
+public:
+ VideoNewBrowsable():
+ GlobalSetting("VideoNewBrowsable") {
+ setLabel(QObject::tr("Newly scanned files are marked browsable"));
+ setValue(true);
+ setHelpText(QObject::tr("If set, newly scanned files in the "
+ "Video Manager will be set browsable, "
+ "and will appear in the 'Browse' menu "
+ "as well as the video list."));
+ };
+};
+
//Player Settings
class VideoDefaultPlayer: public LineEditSetting, public GlobalSetting {
@@ -111,6 +124,7 @@
general->addChild(new VideoAggressivePC());
general->addChild(new VideoListUnknownFiletypes());
general->addChild(new VideoTreeNoDB());
+ general->addChild(new VideoNewBrowsable());
addChild(general);
}
Binary files mythvideo-0.12-orig/mythvideo/libmythvideo.so and mythvideo-0.12/mythvideo/libmythvideo.so differ
diff -ur mythvideo-0.12-orig/mythvideo/metadata.cpp mythvideo-0.12/mythvideo/metadata.cpp
--- mythvideo-0.12-orig/mythvideo/metadata.cpp 2003-09-08 09:16:14.000000000 +1200
+++ mythvideo-0.12/mythvideo/metadata.cpp 2003-10-27 20:48:03.000000000 +1300
@@ -1,5 +1,6 @@
#include <qsqldatabase.h>
#include <iostream>
+#include <mythtv/mythcontext.h>
using namespace std;
@@ -156,7 +157,11 @@
coverfile = QObject::tr("None");
if (inetref == "")
inetref = "00000000";
-
+ if (gContext->GetNumSetting("VideoNewBrowsable", 0))
+ browse = 1;
+ else
+ browse = 0;
+
title.replace(QRegExp("\""), QString("\\\""));
director.replace(QRegExp("\""), QString("\\\""));
plot.replace(QRegExp("\""), QString("\\\""));
@@ -171,13 +176,14 @@
QString thequery;
thequery.sprintf("INSERT INTO videometadata (title,director,plot,"
"rating,year,userrating,length,filename,showlevel,"
- "coverfile,inetref) VALUES "
+ "coverfile,inetref,browse) VALUES "
"(\"%s\",\"%s\",\"%s\",\"%s\",%d,%f,%d,\"%s\",%d,\"%s\","
- "\"%s\");",
+ "\"%s\",%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());
+ sqlcoverfile.utf8().data(), inetref.utf8().data(),
+ browse);
db->exec(thequery);
More information about the mythtv-dev
mailing list