mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
catch empty rss results, fix catching of bad feed options
This commit is contained in:
parent
859b7591fc
commit
e35c9e9fc5
@ -45,7 +45,11 @@ news.fetchFeed = function (yqUrl) {
|
|||||||
url: yqUrl,
|
url: yqUrl,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
||||||
|
if (data.query.count > 0) {
|
||||||
this.parseFeed(data.query.results.item);
|
this.parseFeed(data.query.results.item);
|
||||||
|
} else {
|
||||||
|
console.error('No feed results for: ' + yqUrl);
|
||||||
|
}
|
||||||
|
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
error: function () {
|
error: function () {
|
||||||
@ -85,7 +89,7 @@ news.showNews = function () {
|
|||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
this.showNews();
|
this.showNews();
|
||||||
}.bind(this), 30000);
|
}.bind(this), 3000);
|
||||||
|
|
||||||
} else if (this.newsItems.length === 0 && this.seenNewsItem.length !== 0) {
|
} else if (this.newsItems.length === 0 && this.seenNewsItem.length !== 0) {
|
||||||
this.newsItems = this.seenNewsItem.splice(0);
|
this.newsItems = this.seenNewsItem.splice(0);
|
||||||
@ -103,7 +107,7 @@ news.showNews = function () {
|
|||||||
|
|
||||||
news.init = function () {
|
news.init = function () {
|
||||||
|
|
||||||
if (this.feed === null || this.feed instanceof Array) {
|
if (this.feed === null || (this.feed instanceof Array === false && typeof this.feed !== 'string')) {
|
||||||
return false;
|
return false;
|
||||||
} else if (typeof this.feed === 'string') {
|
} else if (typeof this.feed === 'string') {
|
||||||
this.feed = [this.feed];
|
this.feed = [this.feed];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user