I have written an additional parser for aggregating pictures from flickr. Everything works well except the assignment of multiple parsers to one Feed. In this case only the first parser is taken if the content type fits or no parser at all.

function parser_flickr_feedapi_feed($op) {
$args = func_get_args();
switch ($op) {
case 'type':
return array("flickr feed");
case 'compatible':
if (!function_exists('simplexml_load_string')) {
return FALSE;
}
$url = $args[1]->url;
if(strpos($url, "http://www.flickr.com/") === 0) {
return "flickr feed";
}
return FALSE;
case 'parse':
$feed = $args[1];
$parsed_feed = _parser_flickr_feedapi_parse($feed);
return $parsed_feed;
}
}

If I check for the type in the 'parse' part and I return FALSE if the Content Type of the feed is not "flickr feed" then no parser works anymore because of:

function _feedapi_call_parsers($feed, $parsers) {
$nid = isset($feed->nid) ? $feed->nid : '';
$parser_primary = array_shift($parsers);
$parsers_secondary = $parsers;
if (module_exists($parser_primary)) {
$feed->feed_type = module_invoke($parser_primary, 'feedapi_feed', 'compatible', $feed);
$parser_output = module_invoke($parser_primary, 'feedapi_feed', 'parse', $feed);
if ($parser_output === FALSE) {
return $parser_output;
}

if the $parser_output === FALSE no other parsers are checked anymore.

Comments

aron novak’s picture

Component: Code » Documentation
Status: Active » Closed (won't fix)

This is how FeedAPI was designed.
Unfortunately it was poorly documented, now I added a sentence to the developer wiki guide to make it clear:
http://groups.drupal.org/node/5301
See the last sentence of the Writing a parser section.