[totem-pl-parser] plparse: Ignore partially downloaded files when recursing
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem-pl-parser] plparse: Ignore partially downloaded files when recursing
- Date: Tue, 27 May 2014 20:12:39 +0000 (UTC)
commit ef54de848ebd378299cdf64b3376a7677e14d5ed
Author: Bastien Nocera <hadess hadess net>
Date: Tue May 27 22:09:43 2014 +0200
plparse: Ignore partially downloaded files when recursing
When handling directories, ignore partially downloaded files.
plparse/totem-pl-parser-media.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/plparse/totem-pl-parser-media.c b/plparse/totem-pl-parser-media.c
index 6666294..9283b4d 100644
--- a/plparse/totem-pl-parser-media.c
+++ b/plparse/totem-pl-parser-media.c
@@ -207,7 +207,7 @@ totem_pl_parser_load_directory (GFile *file, GList **list, gboolean *unhandled)
*unhandled = FALSE;
e = g_file_enumerate_children (file,
- G_FILE_ATTRIBUTE_STANDARD_NAME,
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL, &err);
if (e == NULL) {
@@ -270,10 +270,17 @@ totem_pl_parser_add_directory (TotemPlParser *parser,
GFileInfo *info = l->data;
GFile *item;
TotemPlParserResult ret;
+ const char *content_type;
item = g_file_get_child (file, g_file_info_get_name (info));
- ret = totem_pl_parser_parse_internal (parser, item, NULL, parse_data);
+ /* Ignore partial files */
+ content_type = g_file_info_get_attribute_string (info,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
+ if (g_strcmp0 ("application/x-partial-download", content_type) == 0)
+ ret = TOTEM_PL_PARSER_RESULT_IGNORED;
+ else
+ ret = totem_pl_parser_parse_internal (parser, item, NULL, parse_data);
+
if (ret != TOTEM_PL_PARSER_RESULT_SUCCESS &&
ret != TOTEM_PL_PARSER_RESULT_IGNORED &&
ret != TOTEM_PL_PARSER_RESULT_ERROR) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]