[mythtv] [PATCH] Mythvideo, better guessing of filenames, avoid erasing filename

Leandro Dardini ldardini at tiscali.it
Sat Feb 7 12:12:56 EST 2004


In the current Metadata::guessTitle, if the title of the video start with [,
as for example in
[XVID - ENG] Something and Something.avi
then the title is completely erased and the full path of the file appears in
videomanager.
The following patch, do a safer guessing.

Thank you

Leandro

Index: metadata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/metadata.cpp,v
retrieving revision 1.9
diff -b -u -2 -r1.9 metadata.cpp
--- metadata.cpp        27 Oct 2003 17:12:04 -0000      1.9
+++ metadata.cpp        7 Feb 2004 17:09:06 -0000
@@ -202,6 +202,11 @@
     title = title.left(title.findRev("."));
     title.replace(QRegExp("\\."), " ");
-    title = title.left(title.find("["));
-    title = title.left(title.find("("));
+    while ((title.find("[")!=-1) && (title.find("]")!=-1))
+      title =
title.left(title.find("["))+title.right(title.length()-title.find("]")-1);
+    while ((title.find("(")!=-1) && (title.find(")")!=-1))
+      title =
title.left(title.find("("))+title.right(title.length()-title.find(")")-1);
+    while ((title.find("{")!=-1) && (title.find("}")!=-1))
+      title =
title.left(title.find("{"))+title.right(title.length()-title.find("}")-1);
+    title=title.stripWhiteSpace();
 }



More information about the mythtv-dev mailing list