WIP page des show

This commit is contained in:
WEBER Antoine 2015-09-24 00:41:47 +02:00
parent ba62442238
commit 49d44c3ce8
4 changed files with 12 additions and 31 deletions

View File

@ -24,13 +24,12 @@ router.get('/:id', function(req, res, next) {
//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, t.hints as hints, i.duration as second, i.year as year"
+ " FROM media_items t, metadata_items i "
+ " WHERE t.metadata_item_id = i.id AND t.hints = '%?%' "
+ " GROUP BY i.id",req.params.id, function(err, row) {
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) {
console.log(err);
console.log(row);
//découpage des hints
/*//découpage des hints
var params = {};
var tab = row.hints.split('&');
tab.forEach(function(val,index,table){
@ -41,7 +40,7 @@ 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);

View File

@ -6,33 +6,16 @@ router.get('/:id', function(req, res, next) {
var config = require('../config');
var db = config.init_db();
var shows = {};
var shows = [];
//on fais toute les opération de base a la suite
db.serialize(function() {
db.each("SELECT i.id as id, t.hints as hints, i.year as year"
+ " FROM media_items t, metadata_items i "
+ " WHERE t.metadata_item_id = i.id AND t.library_section_id = ? "
db.each("SELECT id, title, year"
+ " FROM metadata_items "
+ " WHERE parent_id IS NULL AND library_section_id = ? "
,req.params.id, function(err, row) {
//découpage des hints
var params = {};
var tab = row.hints.split('&');
tab.forEach(function(val,index,table){
var tab2 = val.split('=');
params[tab2[0]] = decodeURIComponent(tab2[1]);
});
row.info_meta = params;
var id = params.show;
shows[id] = {
'nom': params.show,
'id': id
};
if(row.year != '' && row.year != null)
shows[id].year = row.year;
shows.push(row);
},
//aprés toute les opération de la base
function(){

View File

@ -9,8 +9,7 @@ block content
label Télécharger
br
each file, i in movie.file
a(href="/file/#{file.id}/#{file.filename}")
#{file.size} #{file.filename}
a(href="/file/#{file.id}/#{file.filename}") #{file.size} #{file.filename}
br
label Résumé

View File

@ -12,7 +12,7 @@ block content
each show, i in shows
tr
td
a(href="/show/#{show.id}")= show.nom
a(href="/show/#{show.id}")= show.title
td= show.year
script.
$(document).ready(function() {