reduire les doublons

This commit is contained in:
WEBER Antoine 2015-09-24 00:17:03 +02:00
parent 00952c81d7
commit 6cc56aef44
4 changed files with 24 additions and 23 deletions

View File

@ -54,9 +54,9 @@ router.get('/:id', function(req, res, next) {
channel_info = row; channel_info = row;
}); });
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" 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, media_items t "
+ " WHERE t.metadata_item_id = i.id AND i.title != '' AND t.library_section_id = ? " + " WHERE i.id = t.metadata_item_id AND i.title != '' AND t.library_section_id = ? "
+ " ORDER BY i.title ASC",req.params.id, function(err, row) { + " ORDER BY i.title ASC",req.params.id, function(err, row) {
//découpage des hints //découpage des hints

View File

@ -1,6 +1,22 @@
var express = require('express'); var express = require('express');
var router = express.Router(); var router = express.Router();
function humanFileSize(bytes, si) {
var thresh = si ? 1000 : 1024;
if(Math.abs(bytes) < thresh) {
return bytes + ' B';
}
var units = si
? ['kB','MB','GB','TB','PB','EB','ZB','YB']
: ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
var u = -1;
do {
bytes /= thresh;
++u;
} while(Math.abs(bytes) >= thresh && u < units.length - 1);
return bytes.toFixed(1)+' '+units[u];
}
/* GET home page. */ /* GET home page. */
router.get('/:id', function(req, res, next) { router.get('/:id', function(req, res, next) {
@ -22,6 +38,8 @@ router.get('/:id', function(req, res, next) {
var filename = tab2[tab2.length -1]; var filename = tab2[tab2.length -1];
ligne.filename = filename; ligne.filename = filename;
ligne.size = humanFileSize(ligne.size,true);
row.file.push(ligne); row.file.push(ligne);
},function(){ },function(){
res.render('movie', { title: 'Détail vidéo',movie: row }); res.render('movie', { title: 'Détail vidéo',movie: row });

View File

@ -7,39 +7,20 @@ block content
thead thead
tr tr
th Nom th Nom
if(channel.type == 2)
th Série
th Saison & 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.title
if(channel.type == 2)
td
if(typeof video.info_meta !== 'undefined' && typeof video.info_meta.show !== 'undefined')
| #{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({
"language": { "language": {
"url": "//cdn.datatables.net/plug-ins/1.10.8/i18n/French.json" "url": "//cdn.datatables.net/plug-ins/1.10.8/i18n/French.json"
}/*, }
"columnDefs": [
{ "targets": 2,
"searchable": false,
"orderable": false,
}
]*/
//"dom": '<"toolbar">frtip'
}); });
}); });

View File

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