plex-web-downloader/routes/show_list.js

32 lines
742 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
//we do all the basic operations following
2015-09-23 16:32:17 -04:00
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
},
//after all the operations of the database
2015-09-23 17:17:40 -04:00
function(){
2015-09-23 16:32:17 -04:00
console.log(shows);
res.render('show_list', { title: 'List of series',shows: shows, channel_id: req.params.id });
2015-09-23 16:32:17 -04:00
});
});
db.close();
});
module.exports = router;