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;
|
||||
});
|
||||
|
||||
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 "+
|
||||
"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
|
||||
var params = {};
|
||||
var tab = row.hints.split('&');
|
||||
|
@ -45,29 +44,33 @@ router.get('/:id', function(req, res, next) {
|
|||
params[tab2[0]] = decodeURIComponent(tab2[1]);
|
||||
});
|
||||
row.info_meta = params;
|
||||
*/
|
||||
|
||||
if(typeof row.info_meta !== 'undefined' && typeof row.info_meta.season !== 'undefined' && typeof row.info_meta.episode !== 'undefined'){
|
||||
row.season_episode = "S"+addZero(row.info_meta.season)+"E"+addZero(row.info_meta.episode);
|
||||
if(typeof row.episode !== '' && row.saison !== '' ){
|
||||
row.season_episode = "S"+addZero(row.saison)+"E"+addZero(row.episode );
|
||||
}
|
||||
|
||||
row.duree = formatDuree(row.second);*/
|
||||
row.duree = formatDuree(row.second);
|
||||
|
||||
data.push(row);
|
||||
},
|
||||
//aprés toute les opération de la base
|
||||
|
||||
function() {
|
||||
//a la fin du foreach
|
||||
});
|
||||
|
||||
|
||||
},function(){
|
||||
//aprés toute les opération de la base
|
||||
var titre = "Série inexistante";
|
||||
if(show != null){
|
||||
title = 'Episode de '+show.title;
|
||||
}
|
||||
res.render('show',{
|
||||
title: titre,
|
||||
show: show,
|
||||
videos: data
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
res.render('show',{
|
||||
title: titre,
|
||||
show: show,
|
||||
videos: data
|
||||
});
|
||||
});
|
||||
|
||||
db.close();
|
||||
|
|
|
@ -7,19 +7,15 @@ block content
|
|||
thead
|
||||
tr
|
||||
th Nom
|
||||
th Saison
|
||||
th Episode
|
||||
th Saison & Episode
|
||||
th Durée
|
||||
th Année
|
||||
tbody
|
||||
each video, i in videos
|
||||
tr
|
||||
td
|
||||
a(href="/movie/#{video.id}")= video.titre
|
||||
td= video.saison
|
||||
td= video.episode
|
||||
td= video.season_episode
|
||||
td= video.duree
|
||||
td= video.year
|
||||
script.
|
||||
$(document).ready(function() {
|
||||
$('#example').DataTable({
|
||||
|
|
Loading…
Reference in New Issue