plex-web-downloader/routes/show_list.js

32 lines
750 B
JavaScript
Raw Normal View History

2015-09-23 16:32:17 -04:00
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/:id', function(req, res, next) {
var config = res.locals.config;
2015-09-23 16:32:17 -04:00
var db = config.init_db();
2015-09-23 18:41:47 -04:00
var shows = [];
2015-09-23 16:32:17 -04:00
//on fais toute les opération de base a la suite
db.serialize(function() {
2015-09-23 18:41:47 -04:00
db.each("SELECT id, title, year"
+ " FROM metadata_items "
+ " WHERE parent_id IS NULL AND library_section_id = ? "
2015-09-23 16:32:17 -04:00
,req.params.id, function(err, row) {
2015-09-23 18:41:47 -04:00
shows.push(row);
2015-09-23 16:32:17 -04:00
},
//aprés toute les opération de la base
2015-09-23 17:17:40 -04:00
function(){
2015-09-23 16:32:17 -04:00
console.log(shows);
2015-10-08 06:07:47 -04:00
res.render('show_list', { title: 'Liste des séries',shows: shows, channel_id: req.params.id });
2015-09-23 16:32:17 -04:00
});
});
db.close();
});
module.exports = router;