diff --git a/routes/show.js b/routes/show.js index 0e8cadb..4d1ff7c 100644 --- a/routes/show.js +++ b/routes/show.js @@ -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); diff --git a/routes/show_list.js b/routes/show_list.js index 5966915..2a371b9 100644 --- a/routes/show_list.js +++ b/routes/show_list.js @@ -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(){ diff --git a/views/movie.jade b/views/movie.jade index 903203c..7dc1c00 100644 --- a/views/movie.jade +++ b/views/movie.jade @@ -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é diff --git a/views/show_list.jade b/views/show_list.jade index 32ddb2e..9d67806 100644 --- a/views/show_list.jade +++ b/views/show_list.jade @@ -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() {