aboutsummaryrefslogtreecommitdiffstats
path: root/binding/media-manager.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-10-10 17:59:00 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2017-10-10 17:59:13 -0700
commit1cd5b6d068f70da8b28e6a9df4e4d4eac7fa2e25 (patch)
tree6e276512d61e23d5454fc46b92b045cc57b20269 /binding/media-manager.c
parent1650598e40ed96588039b73453d3a813bc7c1926 (diff)
binding: mediascanner: don't add directories from local scan
Bug-AGL: SPEC-934 Change-Id: Ia881763c7c062f4a6aff74d43173fd19afdf3f4e Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/media-manager.c')
-rw-r--r--binding/media-manager.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/binding/media-manager.c b/binding/media-manager.c
index 445c7f9..2907972 100644
--- a/binding/media-manager.c
+++ b/binding/media-manager.c
@@ -26,6 +26,7 @@
#include <pthread.h>
#include <glib.h>
+#include <glib/gstdio.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <sqlite3.h>
@@ -99,7 +100,17 @@ GList* media_local_scan(GList *list)
while ((tmp = (gchar *) g_dir_read_name(dir)) != NULL)
{
struct Media_Item *item = g_malloc0(sizeof(*item));
- item->path = g_strdup_printf("file://%s/%s", path, tmp);
+ gchar *p = g_strconcat(path, "/", tmp, NULL);
+ GStatBuf buf;
+
+ if (g_stat(p, &buf) != 0 || !S_ISREG(buf.st_mode)) {
+ g_free(p);
+ continue;
+ }
+
+ item->path = g_strconcat("file://", p, NULL);
+ g_free(p);
+
list = g_list_append(list, item);
}