This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.genre = function(req, res, next) { | |
var genre_id = req.param('id'), | |
start = req.param('start', 0), | |
num = 12; | |
client.smembers('genre:'+genre_id+':movies', function(err, movie_ids){ | |
var movies = [], end = start + num; | |
if (end > movie_ids.length) end = movie_ids.length; | |
movie_ids = movie_ids.slice(start, end); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var Movie = Backbone.Model.extend({ | |
}); | |
var MovieList = Backbone.Collection.extend({ | |
model: Movie | |
}); | |
var GridView = Backbone.View.extend({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.index = function(req, res, next) { | |
client.sort('movies', 'BY', 'movie:*:data->year', 'LIMIT', '0', '12', 'ALPHA', 'DESC', 'GET', '#', function(err, replies) { | |
var movies = []; | |
async.forEachSeries(replies, function(reply, done) { | |
client.hgetall('movie:'+reply+':data', function(err, movie) { | |
if (err) return done(err); | |
movies.push(movie); | |
done(); | |
}); |