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 //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, t.hints as hints, i.duration as second, i.year as year" db.each("SELECT i.id as id, i.title as title, i.duration as second, i.year as year"
+ " FROM media_items t, metadata_items i " + " FROM metadata_items i "
+ " WHERE t.metadata_item_id = i.id AND t.hints = '%?%' " + " WHERE t.metadata_item_id = i.id AND i.parent_id = ? ",req.params.id, function(err, row) {
+ " GROUP BY i.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
var params = {}; var params = {};
var tab = row.hints.split('&'); var tab = row.hints.split('&');
tab.forEach(function(val,index,table){ 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'){ 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);

View File

@ -6,33 +6,16 @@ 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 shows = {}; var shows = [];
//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, t.hints as hints, i.year as year" db.each("SELECT id, title, year"
+ " FROM media_items t, metadata_items i " + " FROM metadata_items "
+ " WHERE t.metadata_item_id = i.id AND t.library_section_id = ? " + " WHERE parent_id IS NULL AND library_section_id = ? "
,req.params.id, function(err, row) { ,req.params.id, function(err, row) {
shows.push(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;
}, },
//aprés toute les opération de la base //aprés toute les opération de la base
function(){ function(){

View File

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

View File

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