This commit is contained in:
Kip Gebhardt 2014-12-23 15:52:58 -08:00
parent 0b9023f45e
commit a66dc32d25

View File

@ -33,6 +33,7 @@ RssBraider.prototype.feedExists = function (feed_name) {
RssBraider.prototype.processFeed = function(feed_name, format, callback) RssBraider.prototype.processFeed = function(feed_name, format, callback)
{ {
// DEBUG
console.time("process"); console.time("process");
if (!format) { if (!format) {
@ -96,11 +97,8 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback)
function(err){ function(err){
if (err) { if (err) {
logger.error(err); logger.error(err);
return callback(err);
} else { } else {
// all done
logger.info(feed_articles);
// Sort the stories for the source by date descending // Sort the stories for the source by date descending
feed_articles = self.dedupe(feed_articles); feed_articles = self.dedupe(feed_articles);
feed_articles = self.date_sort(feed_articles); feed_articles = self.date_sort(feed_articles);
@ -125,17 +123,19 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback)
case 'json': case 'json':
ret_string = JSON.stringify(newfeed); ret_string = JSON.stringify(newfeed);
break; break;
case 'rss':
case 'xml': case 'xml':
ret_string = newfeed.xml("\t"); ret_string = newfeed.xml("\t");
break; break;
default: default:
logger.error("Unknown format:", format);
ret_string = "{}"; ret_string = "{}";
} }
console.timeEnd("process");
console.log(format, ret_string);
callback(null, ret_string); // DEBUG
// return ret_string; console.timeEnd("process");
return callback(null, ret_string);
} }
}); });
@ -147,9 +147,6 @@ RssBraider.prototype.processItem = function (item) {
logger.error("processItem: no item passed in"); logger.error("processItem: no item passed in");
return null; return null;
} }
// logger.info("item", item);
// Basics // Basics
var itemOptions = { var itemOptions = {
title : item.title, title : item.title,
@ -164,7 +161,7 @@ RssBraider.prototype.processItem = function (item) {
////////////////// //////////////////
// Custom elements // Custom elements PLUGINS
////////////////// //////////////////
// TODO: Generify the following if possible // TODO: Generify the following if possible