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 config = require('../config');
var db = config.init_db(); var db = config.init_db();
var data = []; var data = [];
var show;
//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, i.duration as second, i.year as year" db.get("SELECT id, title, year"
+ " FROM metadata_items i " + " FROM metadata_items "
+ " WHERE t.metadata_item_id = i.id AND i.parent_id = ? ",req.params.id, function(err, row) { + " 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(err);
console.log(row); console.log(row);
/*//découpage des hints /*//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'){ 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.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); data.push(row);
}, },
//aprés toute les opération de la base //aprés toute les opération de la base
function() { function() {
res.render('show',{ res.render('show',{
title: 'Episode de '+req.params.id, title: 'Episode de '+show.title,
channel: { show: show,
'name': 'Episode de '+req.params.id,
'type': 2
},
videos: data videos: data
}); });
}); });

View File

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