[tracker/tracker-0.10] libtracker-extract: Improve extraction of title from filenames with multiple dots



commit 3dd646ddda88c9daa60ac952b67d59635e9e9060
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date:   Mon Mar 21 16:13:42 2011 +0000

    libtracker-extract: Improve extraction of title from filenames with multiple dots
    
    Fixes GB#645052
    
    Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>

 src/libtracker-extract/tracker-guarantee.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-guarantee.c b/src/libtracker-extract/tracker-guarantee.c
index 5c61520..fa34b04 100644
--- a/src/libtracker-extract/tracker-guarantee.c
+++ b/src/libtracker-extract/tracker-guarantee.c
@@ -41,9 +41,15 @@ get_title_from_file (const gchar *uri)
 	basename = g_filename_display_basename (filename);
 	g_free (filename);
 
-	p = strchr (basename, '.');
+	p = strrchr (basename, '.');
 	if (p) {
-		*p = '\0';
+                if (p == basename) {
+                        p = g_strdup (&basename[1]);
+                        g_free (basename);
+                        basename = p;
+                } else {
+                        *p = '\0';
+                }
 	}
 
 	return g_strdelimit (basename, "_", ' ');



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]