trie des saisons

This commit is contained in:
WEBER Antoine 2015-09-24 01:05:13 +02:00
parent 49d44c3ce8
commit 3762a7ae45
2 changed files with 21 additions and 22 deletions

View File

@ -20,13 +20,21 @@ router.get('/:id', function(req, res, next) {
var config = require('../config');
var db = config.init_db();
var data = [];
var show;
//on fais toute les opération de base a la suite
db.serialize(function() {
db.each("SELECT i.id as id, i.title as title, i.duration as second, i.year as year"
+ " FROM metadata_items i "
+ " WHERE t.metadata_item_id = i.id AND i.parent_id = ? ",req.params.id, function(err, row) {
db.get("SELECT id, title, year"
+ " FROM metadata_items "
+ " WHERE id = ? "
,req.params.id, function(err, row) {
shows = row;
});
db.each("SELECT episode.id as , episode.title as titre, episode.'index' as episode, 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
@ -40,20 +48,17 @@ router.get('/:id', function(req, res, next) {
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);
}*/
}
row.duree = formatDuree(row.second);
row.duree = formatDuree(row.second);*/
data.push(row);
},
//aprés toute les opération de la base
function() {
res.render('show',{
title: 'Episode de '+req.params.id,
channel: {
'name': 'Episode de '+req.params.id,
'type': 2
},
title: 'Episode de '+show.title,
show: show,
videos: data
});
});

View File

@ -1,31 +1,25 @@
extends layout
block content
h1= channel.name
h1= show.title
table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%")
thead
tr
th Nom
th Série
th Saison & Episode
th Saison
th Episode
th Durée
th Année
th Taille
tbody
each video, i in videos
tr
td
a(href="/movie/#{video.id}")= video.title
td
if(typeof video.info_meta !== 'undefined' && typeof video.info_meta.show !== 'undefined')
| #{video.info_meta.show}
td
if(typeof video.season_episode !== 'undefined')
| #{video.season_episode}
a(href="/movie/#{video.id}")= video.titre
td= video.saison
td= video.episode
td= video.duree
td= video.year
td= video.size
script.
$(document).ready(function() {
$('#example').DataTable({