regroupement des commandes sql
This commit is contained in:
parent
d6826c71c4
commit
7625f94a5c
@ -32,11 +32,10 @@ router.get('/:id', function(req, res, next) {
|
|||||||
shows = row;
|
shows = row;
|
||||||
});
|
});
|
||||||
|
|
||||||
db.each("SELECT episode.id as id, episode.title as titre, episode.[index] as episode, season.[index] as saison "+
|
db.each("SELECT episode.id as id, episode.title as titre, episode.[index] as episode, episode.duration as second, season.[index] as saison "+
|
||||||
"FROM metadata_items episode,metadata_items season,metadata_items show "+
|
"FROM metadata_items episode,metadata_items season,metadata_items show "+
|
||||||
"WHERE episode.parent_id=season.id AND season.parent_id = show.id AND show.id = ? ",req.params.id, function(err, row) {
|
"WHERE episode.parent_id=season.id AND season.parent_id = show.id AND show.id = ? ",req.params.id, function(err, row) {
|
||||||
console.log(err);
|
|
||||||
console.log(row);
|
|
||||||
/*//découpage des hints
|
/*//découpage des hints
|
||||||
var params = {};
|
var params = {};
|
||||||
var tab = row.hints.split('&');
|
var tab = row.hints.split('&');
|
||||||
@ -45,29 +44,33 @@ router.get('/:id', function(req, res, next) {
|
|||||||
params[tab2[0]] = decodeURIComponent(tab2[1]);
|
params[tab2[0]] = decodeURIComponent(tab2[1]);
|
||||||
});
|
});
|
||||||
row.info_meta = params;
|
row.info_meta = params;
|
||||||
|
*/
|
||||||
|
|
||||||
if(typeof row.info_meta !== 'undefined' && typeof row.info_meta.season !== 'undefined' && typeof row.info_meta.episode !== 'undefined'){
|
if(typeof row.episode !== '' && row.saison !== '' ){
|
||||||
row.season_episode = "S"+addZero(row.info_meta.season)+"E"+addZero(row.info_meta.episode);
|
row.season_episode = "S"+addZero(row.saison)+"E"+addZero(row.episode );
|
||||||
}
|
}
|
||||||
|
|
||||||
row.duree = formatDuree(row.second);*/
|
row.duree = formatDuree(row.second);
|
||||||
|
|
||||||
data.push(row);
|
data.push(row);
|
||||||
},
|
},
|
||||||
//aprés toute les opération de la base
|
|
||||||
function() {
|
function() {
|
||||||
|
//a la fin du foreach
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},function(){
|
||||||
|
//aprés toute les opération de la base
|
||||||
var titre = "Série inexistante";
|
var titre = "Série inexistante";
|
||||||
if(show != null){
|
if(show != null){
|
||||||
title = 'Episode de '+show.title;
|
title = 'Episode de '+show.title;
|
||||||
}
|
}
|
||||||
res.render('show',{
|
res.render('show',{
|
||||||
title: titre,
|
title: titre,
|
||||||
show: show,
|
show: show,
|
||||||
videos: data
|
videos: data
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
db.close();
|
db.close();
|
||||||
|
@ -7,19 +7,15 @@ block content
|
|||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th Nom
|
th Nom
|
||||||
th Saison
|
th Saison & Episode
|
||||||
th Episode
|
|
||||||
th Durée
|
th Durée
|
||||||
th Année
|
|
||||||
tbody
|
tbody
|
||||||
each video, i in videos
|
each video, i in videos
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
a(href="/movie/#{video.id}")= video.titre
|
a(href="/movie/#{video.id}")= video.titre
|
||||||
td= video.saison
|
td= video.season_episode
|
||||||
td= video.episode
|
|
||||||
td= video.duree
|
td= video.duree
|
||||||
td= video.year
|
|
||||||
script.
|
script.
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').DataTable({
|
$('#example').DataTable({
|
||||||
|
Loading…
Reference in New Issue
Block a user