[gnome-online-miners] media-server: Store photo names without extensions
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-miners] media-server: Store photo names without extensions
- Date: Tue, 16 Dec 2014 14:18:06 +0000 (UTC)
commit 12853d2b65af12ff4afc6392866097189323ade7
Author: Pranav Kant <pranav913 gmail com>
Date: Fri Dec 5 18:55:05 2014 +0530
media-server: Store photo names without extensions
https://bugzilla.gnome.org/show_bug.cgi?id=741162
src/gom-media-server-miner.c | 3 ++-
src/gom-utils.c | 18 ++++++++++++++++++
src/gom-utils.h | 2 ++
3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/gom-media-server-miner.c b/src/gom-media-server-miner.c
index bd45617..6dda624 100644
--- a/src/gom-media-server-miner.c
+++ b/src/gom-media-server-miner.c
@@ -28,6 +28,7 @@
#include "gom-dlna-server.h"
#include "gom-dlna-servers-manager.h"
#include "gom-media-server-miner.h"
+#include "gom-utils.h"
#define MINER_IDENTIFIER "gd:media-server:miner:a4a47a3e-eb55-11e3-b983-14feb59cfa0e"
@@ -54,7 +55,7 @@ photo_item_new (GVariant *var)
photo = g_slice_new0 (PhotoItem);
g_variant_lookup (var, "DisplayName", "&s", &str);
- photo->name = g_strdup (str);
+ photo->name = gom_filename_strip_extension (str);
g_variant_lookup (var, "MIMEType", "&s", &str);
photo->mimetype = g_strdup (str);
diff --git a/src/gom-utils.c b/src/gom-utils.c
index a2218af..572ff5e 100644
--- a/src/gom-utils.c
+++ b/src/gom-utils.c
@@ -51,6 +51,24 @@ gom_filename_get_extension_offset (const char *filename)
return end;
}
+gchar *
+gom_filename_strip_extension (const gchar *filename_with_extension)
+{
+ gchar *end;
+ gchar *filename;
+
+ if (filename_with_extension == NULL)
+ return NULL;
+
+ filename = g_strdup (filename_with_extension);
+ end = (gchar *) gom_filename_get_extension_offset (filename);
+
+ if (end != NULL && end != filename)
+ *end = '\0';
+
+ return filename;
+}
+
const gchar *
gom_filename_to_rdf_type (const gchar *filename_with_extension)
{
diff --git a/src/gom-utils.h b/src/gom-utils.h
index 7f77339..1a1271e 100644
--- a/src/gom-utils.h
+++ b/src/gom-utils.h
@@ -30,6 +30,8 @@ G_BEGIN_DECLS
const gchar *gom_filename_to_rdf_type (const gchar *filename_with_extension);
+gchar *gom_filename_strip_extension (const gchar *filename_with_extension);
+
gchar *gom_iso8601_from_timestamp (gint64 timestamp);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]