aboutsummaryrefslogtreecommitdiffstats
path: root/song.js
blob: bdb90f97689a6c532c514f5fc27fb3186ec27086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var JSON = require('JSON')

var storage = require('./storage')

module.exports = function(req, res) {
    // Get gif placement info from the backend for a song
    rds = GLOBAL.rds;
    song_name = req.params.song_name;
    song_id = req.body.song_id;
    song_key = storage.songMakeKey(song_name);
    rds.get(song_key, function (err, song) {
        if (!song) {
            song = JSON.stringify({
                'project_id': 'whatever',
                'soundcloud_id': song_id,
                'gifs': []
            });
            
            rds.set(song_key, song);
        }

        res.send(song)
    });
};