added swedish word of the day

This commit is contained in:
martind2000 2016-02-20 00:44:28 +00:00
parent 87f98af3f6
commit 62e3c8711e
5 changed files with 29 additions and 6 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$" libraries="{silvrgit node_modules}" />
</component>
</project>

View File

@ -1,6 +1,6 @@
doctype html
html(lang="en") html(lang="en")
head head
meta(charset='utf-8')
title title
Today Today
body body
@ -35,6 +35,12 @@ html(lang="en")
h2 Calendar h2 Calendar
each line in data.cal.entries each line in data.cal.entries
p !{line.combined} p !{line.combined}
.swedish
h2 Word of the day
p(style="font-weight:900;")= data.swedish.xml.words.word
p It is an #{data.swedish.xml.words.wordtype} which means '<em>#{data.swedish.xml.words.translation}</em>'.
p Example: #{data.swedish.xml.words.fnphrase}
p Translated: #{data.swedish.xml.words.enphrase}
.history .history
h2 Today in history h2 Today in history
if data.history.length > 0 if data.history.length > 0

View File

@ -42,4 +42,4 @@ module.exports = {
} }
}; };
module.exports.getSwedishWord(); //module.exports.getSwedishWord();

View File

@ -7,7 +7,7 @@ var jsonfile = require('jsonfile'), fs = require('fs'), STRING = require('string
var log4js = require('log4js'); var log4js = require('log4js');
var logger = log4js.getLogger(); var logger = log4js.getLogger();
var calHandler = require('./calHandler'); var calHandler = require('./calHandler');
var swedishWord = require('./swedishword');
var todayCache = { var todayCache = {
last: 0, last: 0,
@ -17,7 +17,8 @@ var todayCache = {
history: [], history: [],
today: '', today: '',
tv:{entries:[]}, tv:{entries:[]},
cal:{entries:[]} cal:{entries:[]},
swedish:{}
}, },
expire: ((60 * 1000) * 60) expire: ((60 * 1000) * 60)
}; };
@ -359,6 +360,15 @@ module.exports = {
logger.error(e); logger.error(e);
} }
try {
swedishWord.getSwedishWord(function(v) {
todayCache.data.swedish = v ;
});
}
catch (e) {
logger.error(e);
}
// word of the day http://wotd.transparent.com/rss/swedish-widget.xml?t=1455840000000 // word of the day http://wotd.transparent.com/rss/swedish-widget.xml?t=1455840000000
@ -389,12 +399,12 @@ function sendEmailV1() {
console.log('compiled template email sent'); console.log('compiled template email sent');
}); });
//saveData(); // saveData();
var fn = jade.compileFile(template.file); var fn = jade.compileFile(template.file);
console.log(fn(todayCache)); console.log(fn(todayCache));
//fs.writeFileSync(htmlfile, fn(todayCache)); // fs.writeFileSync(htmlfile, fn(todayCache));
} }

View File

@ -15,6 +15,7 @@
"request": "^2.67.0", "request": "^2.67.0",
"simple-weather": "^1.2.2", "simple-weather": "^1.2.2",
"wordsoap": "^0.2.0", "wordsoap": "^0.2.0",
"xmljson": "^0.2.0",
"xmltojson": "^1.1.0" "xmltojson": "^1.1.0"
}, },
"dependencies": { "dependencies": {