[totem-pl-parser] Don't add directories as playlist items
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem-pl-parser] Don't add directories as playlist items
- Date: Sun, 17 Oct 2010 05:30:17 +0000 (UTC)
commit 5b090be68f48416b8034750366eae08ff541d0e7
Author: Bastien Nocera <hadess hadess net>
Date: Sun Oct 17 06:29:25 2010 +0100
Don't add directories as playlist items
This will avoid unreadable playlist items showing up in
Totem when drag'n'dropping really deep directory hierarchies.
.../tests/foo/bar/baz/boz/biz/buz/really-flv.mp4 | 1 +
plparse/tests/parser.c | 18 ++++++++++++++++++
plparse/totem-pl-parser-media.c | 4 +++-
3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/plparse/tests/foo/bar/baz/boz/biz/buz/really-flv.mp4 b/plparse/tests/foo/bar/baz/boz/biz/buz/really-flv.mp4
new file mode 120000
index 0000000..8ee74e8
--- /dev/null
+++ b/plparse/tests/foo/bar/baz/boz/biz/buz/really-flv.mp4
@@ -0,0 +1 @@
+../../../../../../really-flv.mp4
\ No newline at end of file
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c
index 27d41e7..690ed6e 100644
--- a/plparse/tests/parser.c
+++ b/plparse/tests/parser.c
@@ -472,6 +472,23 @@ test_m3u_leading_tabs (void)
}
static void
+test_directory_recurse (void)
+{
+ char *uri, *path;
+
+ uri = get_relative_uri (TEST_SRCDIR "foo");
+ path = g_filename_from_uri (uri, NULL, NULL);
+ if (g_file_test (path, G_FILE_TEST_IS_DIR)) {
+ /* The file inside the directory will be ignored */
+ g_assert_cmpstr (parser_test_get_entry_field (uri, TOTEM_PL_PARSER_FIELD_TITLE), ==, NULL);
+ /* But the parsing will succeed */
+ g_assert (simple_parser_test (uri) == TOTEM_PL_PARSER_RESULT_SUCCESS);
+ }
+ g_free (path);
+ g_free (uri);
+}
+
+static void
test_empty_asx (void)
{
char *uri;
@@ -834,6 +851,7 @@ main (int argc, char *argv[])
g_test_add_func ("/parser/parsing/smi_starttime", test_smi_starttime);
g_test_add_func ("/parser/parsing/m3u_leading_tabs", test_m3u_leading_tabs);
g_test_add_func ("/parser/parsing/empty-asx.asx", test_empty_asx);
+ g_test_add_func ("/parser/parsing/dir_recurse", test_directory_recurse);
return g_test_run ();
}
diff --git a/plparse/totem-pl-parser-media.c b/plparse/totem-pl-parser-media.c
index 768f34c..803ee78 100644
--- a/plparse/totem-pl-parser-media.c
+++ b/plparse/totem-pl-parser-media.c
@@ -275,7 +275,9 @@ totem_pl_parser_add_directory (TotemPlParser *parser,
item = g_file_get_child (file, g_file_info_get_name (info));
ret = totem_pl_parser_parse_internal (parser, item, NULL, parse_data);
- if (ret != TOTEM_PL_PARSER_RESULT_SUCCESS && ret != TOTEM_PL_PARSER_RESULT_IGNORED) {
+ if (ret != TOTEM_PL_PARSER_RESULT_SUCCESS &&
+ ret != TOTEM_PL_PARSER_RESULT_IGNORED &&
+ ret != TOTEM_PL_PARSER_RESULT_ERROR) {
char *item_uri;
item_uri = g_file_get_uri (item);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]