|
|
|
@ -133,7 +133,7 @@ exports.others = function (req, res) {
|
|
|
|
|
var now = new Date(); |
|
|
|
|
console.log('Adding song as played in ' + now.toJSON() + '...'); |
|
|
|
|
|
|
|
|
|
var stmt = db.run('INSERT INTO songs (id, title, artist, done_in) VALUES (NULL, ?, ?, ?)', [ |
|
|
|
|
db.run('INSERT INTO songs (id, title, artist, done_in) VALUES (NULL, ?, ?, ?)', [ |
|
|
|
|
posted_song, |
|
|
|
|
artist, |
|
|
|
|
now.toJSON() |
|
|
|
@ -158,7 +158,7 @@ exports.others = function (req, res) {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var stmt = db.run('INSERT INTO artists (id, name) VALUES (NULL, ?)', [ |
|
|
|
|
db.run('INSERT INTO artists (id, name) VALUES (NULL, ?)', [ |
|
|
|
|
posted_artist |
|
|
|
|
], |
|
|
|
|
function (error) { |
|
|
|
@ -180,3 +180,19 @@ exports.others = function (req, res) {
|
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/********************************************************************** |
|
|
|
|
* Mark a song as played |
|
|
|
|
*********************************************************************/ |
|
|
|
|
|
|
|
|
|
exports.played = function (req, res) { |
|
|
|
|
var now = new Date(); |
|
|
|
|
db.run('UPDATE songs SET done_in = ? WHERE id = ?', [ |
|
|
|
|
now.toJSON(), req.body.id |
|
|
|
|
], function (error) { |
|
|
|
|
if (error) { |
|
|
|
|
throw error; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|