utilisation de request params id
This commit is contained in:
parent
23b0328132
commit
377c48a430
@ -1,30 +1,19 @@
|
|||||||
var express = require('express');
|
var express = require('express');
|
||||||
var router = express.Router();
|
var router = express.Router();
|
||||||
|
|
||||||
function btoa(string){
|
|
||||||
return new Buffer(string).toString('base64');
|
|
||||||
}
|
|
||||||
|
|
||||||
function atob(string){
|
|
||||||
return new Buffer(string, 'base64').toString('ascii');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GET home page. */
|
/* GET home page. */
|
||||||
router.get('/:id', function(req, res, next) {
|
router.get('/:id', function(req, res, next) {
|
||||||
var config = require('../config');
|
var config = require('../config');
|
||||||
var db = config.init_db();
|
var db = config.init_db();
|
||||||
var data = [];
|
var data = [];
|
||||||
|
|
||||||
var id = /*atob(*/req.params.id/*)*/;
|
|
||||||
console.log(id);
|
|
||||||
|
|
||||||
//on fais toute les opération de base a la suite
|
//on fais toute les opération de base a la suite
|
||||||
db.serialize(function() {
|
db.serialize(function() {
|
||||||
|
|
||||||
db.each("SELECT i.id as id, i.title as title, t.hints as hints, p.file as file, i.duration as second, t.size as size, i.year as year"
|
db.each("SELECT i.id as id, i.title as title, t.hints as hints, p.file as file, i.duration as second, t.size as size, i.year as year"
|
||||||
+ " FROM media_items t, metadata_items i, media_parts p "
|
+ " FROM media_items t, metadata_items i, media_parts p "
|
||||||
+ " WHERE t.id=p.media_item_id AND t.metadata_item_id = i.id AND t.hints LIKE '%show=?%' "
|
+ " WHERE t.id=p.media_item_id AND t.metadata_item_id = i.id AND t.hints LIKE '%show=?%' "
|
||||||
,id, function(err, row) {
|
,req.params.id, function(err, row) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
console.log(row);
|
console.log(row);
|
||||||
//découpage des hints
|
//découpage des hints
|
||||||
@ -53,10 +42,14 @@ router.get('/:id', function(req, res, next) {
|
|||||||
},
|
},
|
||||||
//aprés toute les opération de la base
|
//aprés toute les opération de la base
|
||||||
function() {
|
function() {
|
||||||
res.render('channel', { title: 'Episode de :'+id,channel:{
|
res.render('channel',{
|
||||||
'name': 'Episode de :'+id,
|
title: 'Episode de '+req.params.id,
|
||||||
'type': 2
|
channel: {
|
||||||
},videos: data });
|
'name': 'Episode de '+req.params.id,
|
||||||
|
'type': 2
|
||||||
|
},
|
||||||
|
videos: data
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user