Skip to content

Instantly share code, notes, and snippets.

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);
<script>
var Movie = Backbone.Model.extend({
});
var MovieList = Backbone.Collection.extend({
model: Movie
});
var GridView = Backbone.View.extend({
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();
});