|
|
|
@ -9,20 +9,18 @@ var db; // make it global
|
|
|
|
|
/** |
|
|
|
|
* db name |
|
|
|
|
*/ |
|
|
|
|
function dbName() |
|
|
|
|
{ |
|
|
|
|
function dbName() { |
|
|
|
|
return path.join(__dirname, '../../db/lyrics.sq3'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* turn a phrase into a list of acronyms |
|
|
|
|
*/ |
|
|
|
|
function acronymize(phrase) |
|
|
|
|
{ |
|
|
|
|
function acronymize(phrase) { |
|
|
|
|
var letters = []; |
|
|
|
|
phrase.split(' ').forEach(function (elem, idx, array) { |
|
|
|
|
letters.push(elem[0].toUpperCase()); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return letters.join(''); |
|
|
|
|
} |
|
|
|
@ -54,12 +52,13 @@ function getSong(res) {
|
|
|
|
|
throw err; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
params = {title: 'Round', |
|
|
|
|
var params = {title: 'Round', |
|
|
|
|
lyrics: lyrics.lyrics, |
|
|
|
|
song_title: song.title, |
|
|
|
|
song_artist: artist.name, |
|
|
|
|
acronym_title: acronymize(song.title), |
|
|
|
|
acronym_artist: acronymize(artist.name) |
|
|
|
|
acronym_artist: acronymize(artist.name), |
|
|
|
|
id: song.id |
|
|
|
|
}; |
|
|
|
|
res.render('index', params); |
|
|
|
|
}); |
|
|
|
@ -69,6 +68,5 @@ function getSong(res) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
exports.index = function (req, res) { |
|
|
|
|
// res.render('index', { title: 'Round'} );
|
|
|
|
|
getSong(res); |
|
|
|
|
} |
|
|
|
|
}; |