se baser sur les id de file

This commit is contained in:
WEBER Antoine 2015-09-24 00:02:59 +02:00
parent 813b9e1ed4
commit 512c8bbbb7
4 changed files with 19 additions and 9 deletions

View File

@ -53,10 +53,10 @@ router.get('/:id', function(req, res, next) {
+ " FROM library_sections WHERE id = ? ORDER BY name ASC",req.params.id, function(err, row) {
channel_info = row;
});
console.log("test2")
db.each("SELECT i.id as id, i.title as title, t.hints as hints, p.file as file, i.duration as second, t.size as size, i.year as year"
+ " FROM media_items t, metadata_items i, media_parts p "
+ " WHERE p.media_item_id=t.id AND t.metadata_item_id = i.id AND i.title != '' AND t.library_section_id = ? "
db.each("SELECT i.id as id, i.title as title, t.hints as hints i.duration as second, t.size as size, i.year as year"
+ " FROM media_items t, metadata_items i "
+ " WHERE t.metadata_item_id = i.id AND i.title != '' AND t.library_section_id = ? "
+ " ORDER BY i.title ASC",req.params.id, function(err, row) {
//découpage des hints

View File

@ -14,7 +14,7 @@ router.get('/:id/:filename', function (req, res, next) {
//}
//stmt.finalize();
db.get("SELECT file FROM media_parts WHERE media_item_id = ?",req.params.id, function(err, row) {
db.get("SELECT file FROM media_parts WHERE id = ?",req.params.id, function(err, row) {
var options = {
//root: /*__dirname +*/ '/public/',

View File

@ -14,9 +14,18 @@ router.get('/:id', function(req, res, next) {
row.tags_genre = row.tags_genre.split('|');
row.tags_star = row.tags_star.split('|');
row.rating = Math.round(row.rating,2);
data = row;
row.file = [];
res.render('movie', { title: 'Détail vidéo',movie: data });
db.each("SELECT id,file,size,hash,duration FROM media_parts where media_item_id IN (SELECT id FROM media_items WHERE metadata_items_id = ? )",req.params.id, function(error, ligne) {
var tab = ligne.file.split('/');
var tab2 = tab[tab.length -1].split('\\');
var filename = tab2[tab2.length -1];
ligne.filename = filename;
row.file.push(ligne);
},function(){
res.render('movie', { title: 'Détail vidéo',movie: row });
});
});

View File

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