From 64c8713ab4a64eaf53a764530837bd3ae47a89d2 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Thu, 31 Jul 2008 00:16:12 +0200 Subject: The parameter can now be omitted when preview src is specified Skip items with no source or preview image src specified. --- items.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'items.c') diff --git a/items.c b/items.c index c1e1564..2c7b094 100644 --- a/items.c +++ b/items.c @@ -113,20 +113,28 @@ parse_album_xml (const char *filename, TAlbum *index) g_free (s); s = g_strdup_printf ("/gallery/items/item[%d]/nofullsize", i + 1); - item->nofullsize = xml_file_get_node_present (xml, s); + item->nofullsize = (xml_file_get_node_present (xml, s) || item->path == NULL); g_free (s); - g_ptr_array_add (index->items, item); + if (item->path || item->preview) + { + g_ptr_array_add (index->items, item); + } + else + { + fprintf (stderr, "%s: No image src specified, skipping!\n", filename); + free (item); + } } xml_parser_close (xml); /* Print the items */ #ifdef __DEBUG_ALL__ - printf("ID = '%s'\ntitle = '%s'\ndescription = '%s'\n", index->ID, index->title, index->desc); + printf ("ID = '%s'\ntitle = '%s'\ndescription = '%s'\n", index->ID, index->title, index->desc); for (i = 0; i < index->items->len; i++) { - TIndexItem *item = g_ptr_array_index(index->items, i); - printf("item %d: path = '%s', title = '%s', title_description = '%s', thumbnail = '%s'\n", + TIndexItem *item = g_ptr_array_index (index->items, i); + printf ("item %d: path = '%s', title = '%s', title_description = '%s', thumbnail = '%s'\n", i, item->path, item->title, item->title_description, item->thumbnail); } #endif -- cgit v1.2.3