From 7434538e37991fd8e9d606270e4542688bc320b6 Mon Sep 17 00:00:00 2001 From: WEBER Antoine Date: Mon, 14 Sep 2015 21:39:36 +0200 Subject: [PATCH] ajout d'une datatables --- README | 6 ++++-- routes/file.js | 2 +- routes/index.js | 27 +++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/README b/README index 6a63f82..7cf0f49 100644 --- a/README +++ b/README @@ -6,12 +6,14 @@ cd nom_du_projet npm install //pour reprendre le projet depuis git +sous debian: ln -s /usr/bin/nodejs /usr/local/bin/node npm install npm start -ou sous debian: nodejs ./bin/www puis ouvrir localhost:3000 //pour installer plex (depuis un dockerfile) mkdir ~/plex-config sudo chown 797:797 -R ~/plex-config -sudo docker run -d --restart=always -v ~/plex-config:/config -v ~/Movies:/media -p 32400:32400 wernight/plex-media-server +sudo docker run -d --restart=always -v ~/plex-config:/config -v ~/Movies:/media/plex -p 32400:32400 wernight/plex-media-server +sudo chmod 777 ~/plex-config/Plex\ Media\ Server/Plug-in\ Support/Databases/* +sudo ln -s ~/Movies /media/plex diff --git a/routes/file.js b/routes/file.js index cbd1c10..42de058 100644 --- a/routes/file.js +++ b/routes/file.js @@ -2,7 +2,7 @@ var express = require('express'); var router = express.Router(); /* GET users listing. */ -router.get('/:id', function (req, res, next) { +router.get('/:id/:filename', function (req, res, next) { var config = require('../config'); var db = config.init_db(); diff --git a/routes/index.js b/routes/index.js index 6573091..1aa75ac 100644 --- a/routes/index.js +++ b/routes/index.js @@ -7,7 +7,22 @@ router.get('/', function(req, res, next) { var config = require('../config'); var db = config.init_db(); - var html = "

liste des fichiers

"; + var html = "" + +"" + +"" + +"" + +"" + +"" + + + +"

liste des fichiers

" + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' '; //on fais toute les opération de base a la suite db.serialize(function() { @@ -19,13 +34,17 @@ router.get('/', function(req, res, next) { //} //stmt.finalize(); - db.each("SELECT id, title FROM metadata_items", function(err, row) { - html += " " + row.title + "
"; + db.each("SELECT i.id as id, i.title as title, p.file as file FROM metadata_items i, media_parts p WHERE p.media_item_id=i.id ORDER BY i.title ASC", function(err, row) { + var tab = row.file.split('/'); + var filename = tab[tab.length -1]; + html += ""; }, //aprés toute les opération de la base function() { // All done fetching records, render response - html += ""; + html += "
Nom
" + row.title + "
"; res.end(html); });