mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 04:02:12 +00:00
Final cleanups I think
This commit is contained in:
parent
008ac2876b
commit
963b1aa6b1
@ -34,10 +34,10 @@ if (process.env.MM_PORT) {
|
|||||||
// The next part is here to prevent a major exception when there
|
// The next part is here to prevent a major exception when there
|
||||||
// is no internet connection. This could probable be solved better.
|
// is no internet connection. This could probable be solved better.
|
||||||
process.on("uncaughtException", function (err) {
|
process.on("uncaughtException", function (err) {
|
||||||
Log.log("Whoops! There was an uncaught exception...");
|
Log.error("Whoops! There was an uncaught exception...");
|
||||||
Log.error(err);
|
Log.error(err);
|
||||||
Log.log("MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?");
|
Log.error("MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?");
|
||||||
Log.log("If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues");
|
Log.error("If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues");
|
||||||
});
|
});
|
||||||
|
|
||||||
/* App - The core app.
|
/* App - The core app.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Logger
|
* Log
|
||||||
|
*
|
||||||
* This logger is very simple, but needs to be extended.
|
* This logger is very simple, but needs to be extended.
|
||||||
* This system can eventually be used to push the log messages to an external target.
|
* This system can eventually be used to push the log messages to an external target.
|
||||||
*
|
*
|
||||||
|
@ -436,7 +436,7 @@ var CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEntr
|
|||||||
* Broadcast the existing events.
|
* Broadcast the existing events.
|
||||||
*/
|
*/
|
||||||
this.broadcastEvents = function () {
|
this.broadcastEvents = function () {
|
||||||
Log.info("Broadcasting " + events.length + " events.");
|
Log.info("Calendar-Fetcher: Broadcasting " + events.length + " events.");
|
||||||
eventsReceivedCallback(self);
|
eventsReceivedCallback(self);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ var Fetcher = function (url, reloadInterval, encoding, logFeedWarnings) {
|
|||||||
/* fetchNews()
|
/* fetchNews()
|
||||||
* Request the new items.
|
* Request the new items.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var fetchNews = function () {
|
var fetchNews = function () {
|
||||||
clearTimeout(reloadTimer);
|
clearTimeout(reloadTimer);
|
||||||
reloadTimer = null;
|
reloadTimer = null;
|
||||||
@ -60,16 +59,15 @@ var Fetcher = function (url, reloadInterval, encoding, logFeedWarnings) {
|
|||||||
url: url
|
url: url
|
||||||
});
|
});
|
||||||
} else if (logFeedWarnings) {
|
} else if (logFeedWarnings) {
|
||||||
console.log("Can't parse feed item:");
|
Log.warn("Can't parse feed item:");
|
||||||
console.log(item);
|
Log.warn(item);
|
||||||
console.log("Title: " + title);
|
Log.warn("Title: " + title);
|
||||||
console.log("Description: " + description);
|
Log.warn("Description: " + description);
|
||||||
console.log("Pubdate: " + pubdate);
|
Log.warn("Pubdate: " + pubdate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
parser.on("end", function () {
|
parser.on("end", function () {
|
||||||
//console.log("end parsing - " + url);
|
|
||||||
self.broadcastItems();
|
self.broadcastItems();
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
});
|
});
|
||||||
@ -94,9 +92,7 @@ var Fetcher = function (url, reloadInterval, encoding, logFeedWarnings) {
|
|||||||
/* scheduleTimer()
|
/* scheduleTimer()
|
||||||
* Schedule the timer for the next update.
|
* Schedule the timer for the next update.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var scheduleTimer = function () {
|
var scheduleTimer = function () {
|
||||||
//console.log('Schedule update timer.');
|
|
||||||
clearTimeout(reloadTimer);
|
clearTimeout(reloadTimer);
|
||||||
reloadTimer = setTimeout(function () {
|
reloadTimer = setTimeout(function () {
|
||||||
fetchNews();
|
fetchNews();
|
||||||
@ -128,10 +124,10 @@ var Fetcher = function (url, reloadInterval, encoding, logFeedWarnings) {
|
|||||||
*/
|
*/
|
||||||
this.broadcastItems = function () {
|
this.broadcastItems = function () {
|
||||||
if (items.length <= 0) {
|
if (items.length <= 0) {
|
||||||
//console.log('No items to broadcast yet.');
|
Log.info("Newsfeed-Fetcher: No items to broadcast yet.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.info("Broadcasting " + items.length + " items.");
|
Log.info("Newsfeed-Fetcher: Broadcasting " + items.length + " items.");
|
||||||
itemsReceivedCallback(self);
|
itemsReceivedCallback(self);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user