|
|
|
@ -25,6 +25,10 @@ function acronymize(phrase) {
|
|
|
|
|
return letters.join(''); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*********************************************************************** |
|
|
|
|
* Main page |
|
|
|
|
**********************************************************************/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Pick a song |
|
|
|
|
*/ |
|
|
|
@ -42,24 +46,27 @@ function getSong(res) {
|
|
|
|
|
throw err; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('Retrieving artist for song...') |
|
|
|
|
db.get('SELECT * FROM artists WHERE id = ' + song.artist, function (err, artist) { |
|
|
|
|
if (err) { |
|
|
|
|
throw err; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('Retrieving lyrics for song... ') |
|
|
|
|
db.get('SELECT * FROM lyrics WHERE song = ' + song.id, function (err, lyrics) { |
|
|
|
|
if (err) { |
|
|
|
|
throw err; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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), |
|
|
|
|
id: song.id |
|
|
|
|
}; |
|
|
|
|
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), |
|
|
|
|
id: song.id |
|
|
|
|
}; |
|
|
|
|
res.render('index', params); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
@ -69,4 +76,13 @@ function getSong(res) {
|
|
|
|
|
|
|
|
|
|
exports.index = function (req, res) { |
|
|
|
|
getSong(res); |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************** |
|
|
|
|
* Support for the small box with the "others" picks |
|
|
|
|
**********************************************************************/ |
|
|
|
|
exports.others = function (req, res) { |
|
|
|
|
console.log('Artist: ' + req.body.artist); |
|
|
|
|
console.log('Song: ' + req.body.song); |
|
|
|
|
}; |
|
|
|
|