[mythtv] patch for mythVideo to use already scanned coverfile
Dave Alden
alden at math.ohio-state.edu
Mon Jul 14 19:59:54 EDT 2003
Hi,
I decided to scan all of my DVD covers (I wasn't happy with using the
posters from imdb -- many of my movies didn't have any posters). Rather
than having to modify the sql database each time I enter a new movie, I
decided to modify mythVideo so it checks a directory to see if there
already exists a "<movie name>.jpg" for the specified "<movie name>.avi".
I'm not a c++ programmer (I an old C programmer :-), nor do I know QT,
so this patch may not be the cleanest. This is also my first time creating
a diff using cvs -- let me know if I did it wrong. :-)
...dave
-------------- next part --------------
Index: videomanager.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videomanager.cpp,v
retrieving revision 1.7
diff -u -r1.7 videomanager.cpp
--- videomanager.cpp 16 Jun 2003 16:16:19 -0000 1.7
+++ videomanager.cpp 14 Jul 2003 22:46:44 -0000
@@ -282,6 +282,36 @@
QString VideoManager::GetMoviePoster(QString movieNum)
{
+ char *home = getenv("HOME");
+ QString fileprefix = QString(home) + "/.mythtv";
+
+ QDir dir(fileprefix);
+ if (!dir.exists())
+ dir.mkdir(fileprefix);
+
+ fileprefix += "/MythVideo";
+
+ dir = QDir(fileprefix);
+ if (!dir.exists())
+ dir.mkdir(fileprefix);
+
+ dir = QDir(fileprefix + "/.covers");
+ if (dir.exists())
+ {
+ QString movieFile = curitem->Filename();
+
+ movieFile = movieFile.right(movieFile.length() - movieFile.findRev("/"));
+ movieFile = movieFile.left(movieFile.length() - 4) + ".jpg";
+
+ QFile checkFile(fileprefix + "/.covers" + movieFile);
+
+ if (checkFile.exists())
+ {
+ fileprefix = fileprefix + "/.covers" + movieFile;
+ return fileprefix;
+ }
+ }
+
QString host = "www.imdb.com";
QUrl url("http://" + host + "/Posters?" + movieNum
@@ -317,19 +347,6 @@
cout << "MyhVideo: Error parsing poster filename.\n";
return filename;
}
-
- char *home = getenv("HOME");
- QString fileprefix = QString(home) + "/.mythtv";
-
- QDir dir(fileprefix);
- if (!dir.exists())
- dir.mkdir(fileprefix);
-
- fileprefix += "/MythVideo";
-
- dir = QDir(fileprefix);
- if (!dir.exists())
- dir.mkdir(fileprefix);
host = "posters.imdb.com";
More information about the mythtv-dev
mailing list