ajouter la gestion des channels
This commit is contained in:
parent
cdf738cb40
commit
04ae473f75
50
README
50
README
@ -3,20 +3,56 @@ Plex Web Downloader
|
||||
Ce projet permet de créer une liste de vos fichiers vidéo plex et de les partager aux travers d'une interface web.
|
||||
|
||||
|
||||
==================
|
||||
INSTALLATION
|
||||
|
||||
//créée initialement avec
|
||||
Sur Windows
|
||||
pré requis, installer git ( https://git-scm.com/download/win )
|
||||
pré requis, installer nodejs 0.12.x ( https://nodejs.org/dist/v0.12.7/ )
|
||||
ouvrir cmb, se deplacer dans un repertoire où vous voulez installer
|
||||
git clone https://github.com/TwanoO67/plex-web-downloader.git
|
||||
cd plex-web-downloader
|
||||
npm install
|
||||
modifier le fichier config.js, pour le chemin de database (attention il faut doubler les \ et proteger les espaces )
|
||||
exemple: C:\\Users\\yourUsername\\AppData\\Local\\Plex Media Server\\Plug-in\ Support\\Databases\\com.plexapp.plugins.library.db
|
||||
npm start
|
||||
puis ouvrir http://localhost:3000
|
||||
|
||||
Sous mac
|
||||
pré requis, nodejs
|
||||
sinon installer homebrew ( ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" )
|
||||
puis brew install node
|
||||
git clone https://github.com/TwanoO67/plex-web-downloader.git
|
||||
cd plex-web-downloader
|
||||
npm install
|
||||
modifier le fichier config.js, pour le chemin de database
|
||||
exemple: /Users/yourUsername/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
|
||||
npm start
|
||||
puis ouvrir http://localhost:3000
|
||||
|
||||
Sous ubuntu
|
||||
pré requis nodejs, ou apt-get install nodejs
|
||||
ln -s /usr/bin/nodejs /usr/local/bin/node
|
||||
git clone https://github.com/TwanoO67/plex-web-downloader.git
|
||||
cd plex-web-downloader
|
||||
npm install
|
||||
modifier le fichier config.js, pour le chemin de database
|
||||
exemple: /home/yourUsername/plex-config/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
|
||||
npm start
|
||||
puis ouvrir http://localhost:3000
|
||||
|
||||
|
||||
|
||||
==================
|
||||
DEVELOPPEMENT
|
||||
|
||||
//le projet a été créée initialement avec
|
||||
node install express -g
|
||||
node install express-generator -g
|
||||
express nom_du_projet
|
||||
cd nom_du_projet
|
||||
npm install
|
||||
|
||||
//pour installer le projet depuis git
|
||||
sous debian: ln -s /usr/bin/nodejs /usr/local/bin/node
|
||||
npm install
|
||||
npm start
|
||||
puis ouvrir http://localhost:3000
|
||||
|
||||
//pour installer plex (depuis un dockerfile)
|
||||
mkdir ~/plex-config
|
||||
sudo chown 797:797 -R ~/plex-config
|
||||
|
@ -3,7 +3,7 @@
|
||||
Chercher votre fichier de base de données plex, grace à ces indications:
|
||||
|
||||
Windows Vista, Server 2008, Server 2008 R2, WHS 2011, Windows 7, Windows 8:
|
||||
C:\Users\yourusername\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db
|
||||
C:\\Users\\yourusername\\AppData\\Local\\Plex Media Server\\Plug-in\ Support\\Databases\\com.plexapp.plugins.library.db
|
||||
|
||||
Mac OS X:
|
||||
~/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
|
||||
|
@ -1,13 +1,13 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/:id', function(req, res, next) {
|
||||
var config = require('../config');
|
||||
var db = config.init_db();
|
||||
|
||||
var data = [];
|
||||
var channel_info = [];
|
||||
//on fais toute les opération de base a la suite
|
||||
db.serialize(function() {
|
||||
|
||||
@ -18,21 +18,36 @@ router.get('/:id', function(req, res, next) {
|
||||
//}
|
||||
//stmt.finalize();
|
||||
|
||||
db.each("SELECT i.id as id, i.title as title, p.file as file, i.duration as second, i.year as year"
|
||||
+ " FROM metadata_items i, media_parts p "
|
||||
+ " WHERE p.media_item_id=i.id AND i.library_section_id = ? "
|
||||
db.get("SELECT id, name, section_type as type"
|
||||
+ " FROM library_sections ORDER BY name ASC", function(err, row) {
|
||||
channel_info = row;
|
||||
});
|
||||
|
||||
db.each("SELECT i.id as id, i.title as title, t.hints as hints, p.file as file, i.duration as second, i.year as year"
|
||||
+ " FROM media_items t, metadata_items i, media_parts p "
|
||||
+ " WHERE p.media_item_id=i.id AND 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) {
|
||||
|
||||
var tab = row.file.split('/');
|
||||
var tab2 = tab[tab.length -1].split('\\');
|
||||
var filename = tab2[tab2.length -1];
|
||||
if(row.title != ''){
|
||||
row.filename = filename;
|
||||
data.push(row);
|
||||
}
|
||||
row.filename = filename;
|
||||
|
||||
//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;
|
||||
|
||||
data.push(row);
|
||||
},
|
||||
//aprés toute les opération de la base
|
||||
function() {
|
||||
res.render('channel', { title: 'Liste des vidéos',videos: data });
|
||||
res.render('channel', { title: 'Liste des vidéos',videos: data, channel: channel_info });
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -1,12 +1,14 @@
|
||||
extends layout
|
||||
|
||||
block content
|
||||
h1= title
|
||||
h1= channel.name
|
||||
|
||||
table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%")
|
||||
thead
|
||||
tr
|
||||
th Nom
|
||||
if(channel.type == 2)
|
||||
th Série
|
||||
th Durée
|
||||
th Année
|
||||
tbody
|
||||
@ -14,6 +16,10 @@ block content
|
||||
tr
|
||||
td
|
||||
a(href="/file/#{video.id}/#{video.filename}")= video.title
|
||||
if(channel.type == 2)
|
||||
td
|
||||
if(typeof video.info_meta !== 'undefined' && typeof video.info_meta.show !== 'undefined')
|
||||
#{video.info_meta.show}
|
||||
td= video.second
|
||||
td= video.year
|
||||
script.
|
||||
|
@ -9,4 +9,24 @@ html
|
||||
script(type='text/javascript', src='//cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js')
|
||||
script(type='text/javascript', src='//cdn.datatables.net/1.10.9/js/dataTables.bootstrap.min.js')
|
||||
body
|
||||
block content
|
||||
|
||||
nav.navbar.navbar-default.navbar-static-top.transparent(role="navigation")
|
||||
div.container
|
||||
div.navbar-header
|
||||
button.navbar-toggle(type="button",data-toggle="collapse",data-target="#collapse-menu")
|
||||
span.sr-only Toggle navigation
|
||||
i.fa.fa-bars
|
||||
a.navbar-brand(href="/")
|
||||
b Plex
|
||||
| Web Downloader
|
||||
|
||||
div#collapse-menu.collapse.navbar-collapse
|
||||
ul.nav.navbar-nav.navbar-right
|
||||
li.active
|
||||
a(href="/") Accueil
|
||||
li
|
||||
a(href="/divers") Divers
|
||||
|
||||
div.wrapper
|
||||
div.container
|
||||
block content
|
||||
|
Loading…
Reference in New Issue
Block a user