mirror of
https://gitlab.silvrtree.co.uk/martind2000/old-silvrgit.git
synced 2025-02-10 12:19:16 +00:00
updated work calendar link
This commit is contained in:
parent
70d7320c64
commit
87f98af3f6
@ -19,7 +19,8 @@ function processICAL(ical) {
|
||||
summaryID: 'SUMMARY:',
|
||||
begin: 'BEGIN:VEVENT',
|
||||
end: 'END:VEVENT',
|
||||
beginAlarm: 'BEGIN:VALARM'
|
||||
beginAlarm: 'BEGIN:VALARM',
|
||||
recur : 'RRULE'
|
||||
};
|
||||
|
||||
function processBlock(block) {
|
||||
@ -109,7 +110,7 @@ module.exports = {
|
||||
jsonBlock: [],
|
||||
getTodaysSimple: function () {
|
||||
"use strict";
|
||||
logger.info('+ getTodaysMeetings');
|
||||
logger.info('+ getTodaysSimple');
|
||||
var today = {
|
||||
entries: []
|
||||
};
|
||||
@ -121,7 +122,7 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
// logger.debug(today);
|
||||
logger.info('- getTodaysMeetings');
|
||||
logger.info('- getTodaysSimple');
|
||||
return today;
|
||||
},
|
||||
getTodaysMeetings: function () {
|
||||
@ -181,10 +182,3 @@ module.exports = {
|
||||
* Created by Martin on 16/02/2016.
|
||||
*/
|
||||
};
|
||||
|
||||
/*module.exports.getSimpleCalV2('http://www.pogdesign.co.uk/cat/download_ics/60cfdff469d0490545d33d7e3b5c0bcc', function (v) {
|
||||
console.log(v);
|
||||
});*/
|
||||
|
||||
// https://calendar.google.com/calendar/ical/martind2000%40gmail.com/private-40cfebc9f7dcfa7fde6b9bf2f0092c93/basic.ics
|
||||
// http://www.pogdesign.co.uk/cat/download_ics/60cfdff469d0490545d33d7e3b5c0bcc
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Created by Martin on 15/02/2016.
|
||||
*/
|
||||
var http = require('http'), request = require('request'), ical2json = require('ical2json'), util = require('util');
|
||||
var http = require('http'), request = require('request'), calHandler = require('./calHandler'), util = require('util');
|
||||
var jsonfile = require('jsonfile');
|
||||
var log4js = require('log4js');
|
||||
var logger = log4js.getLogger();
|
||||
@ -17,39 +17,9 @@ function saveData(v) {
|
||||
module.exports = {
|
||||
getCal: function () {
|
||||
|
||||
var url = 'https://calendar.google.com/calendar/ical/martind2000%40gmail.com/private-40cfebc9f7dcfa7fde6b9bf2f0092c93/basic.ics';
|
||||
|
||||
request(url, function (err, resp, body) {
|
||||
if (err)
|
||||
throw err;
|
||||
|
||||
var output = ical2json.convert(body);
|
||||
|
||||
// saveData(output);
|
||||
|
||||
for (var i = 0; i < output.VCALENDAR[0].VEVENT.length; i++) {
|
||||
var item = output.VCALENDAR[0].VEVENT[i];
|
||||
var d;
|
||||
if (item.hasOwnProperty('DTSTART')) {
|
||||
|
||||
d = Date.create(item.DTSTART);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
d = Date.create(item['DTSTART;VALUE=DATE']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (d.getFullYear() == 2016) {
|
||||
logger.debug(item);
|
||||
//console.log(item['SUMMARY']);
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(util.inspect(output));
|
||||
// output.VCALENDAR.VEVENT[1];
|
||||
calHandler.getSimpleCalV2('https://www.tripit.com/feed/ical/private/DB96E4BB-94A9BD8F9CC1CF51C6CC0D920840F4F5/tripit.ics', function(v) {
|
||||
logger.debug(v) ;
|
||||
});
|
||||
|
||||
}
|
||||
|
45
lib/swedishword.js
Normal file
45
lib/swedishword.js
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Created by Martin on 15/02/2016.
|
||||
*/
|
||||
var http = require('http'), request = require('request'), util = require('util');
|
||||
var jsonfile = require('jsonfile');
|
||||
var log4js = require('log4js');
|
||||
var logger = log4js.getLogger();
|
||||
var to_json = require('xmljson').to_json;
|
||||
|
||||
require('sugar-date');
|
||||
|
||||
|
||||
var file = __dirname + '/' + 'cal.json';
|
||||
|
||||
function saveData(v) {
|
||||
jsonfile.writeFileSync(file, v);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSwedishWord: function (cb) {
|
||||
|
||||
var t= new Date(), ms = t.getTime();
|
||||
|
||||
|
||||
url = ['http://wotd.transparent.com/rss/swedish-widget.xml?t=', ms].join('');
|
||||
logger.info(url);
|
||||
request(url, function (err, resp, body) {
|
||||
if (err)
|
||||
throw err;
|
||||
|
||||
logger.debug(body);
|
||||
|
||||
to_json(body, function (error, data) {
|
||||
console.log(data);
|
||||
if(typeof cb === 'function') {
|
||||
cb(data);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.getSwedishWord();
|
11
lib/today.js
11
lib/today.js
@ -350,9 +350,20 @@ module.exports = {
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
calHandler.getSimpleCalV2('https://www.tripit.com/feed/ical/private/DB96E4BB-94A9BD8F9CC1CF51C6CC0D920840F4F5/tripit.ics', function(v) {
|
||||
todayCache.data.cal.entries = todayCache.data.cal.entries.concat(v.entries) ;
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// word of the day http://wotd.transparent.com/rss/swedish-widget.xml?t=1455840000000
|
||||
// time stamp
|
||||
|
||||
}
|
||||
}
|
||||
;
|
||||
|
@ -14,7 +14,8 @@
|
||||
"mammoth": "^0.3.25-pre.1",
|
||||
"request": "^2.67.0",
|
||||
"simple-weather": "^1.2.2",
|
||||
"wordsoap": "^0.2.0"
|
||||
"wordsoap": "^0.2.0",
|
||||
"xmltojson": "^1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"elapsed": "0.0.7",
|
||||
|
Loading…
Reference in New Issue
Block a user