Compare commits

..

9 Commits

Author SHA1 Message Date
Antoine WEBER f72206156d maj de nwjs 2017-07-10 13:51:00 +02:00
WEBER Antoine 858c5bd713 si la conf n'existe pas on l'ouvre 2015-10-12 19:16:48 +02:00
WEBER Antoine 36838263a3 modification pour build 2015-10-12 19:03:28 +02:00
WEBER Antoine 7f52b8b8a4 modif du chargement 2015-10-12 09:44:48 +02:00
WEBER Antoine 38759dc9d4 modif du chargement 2015-10-11 22:21:01 +02:00
WEBER Antoine 83c11eaa96 mode application clusterisé 2015-10-11 22:15:49 +02:00
WEBER Antoine a9205daf7e mode application clusterisé 2015-10-11 22:13:49 +02:00
WEBER Antoine b3e2fe85bc creation du menu avec tray icon 2015-10-09 21:12:23 +02:00
Antoine WEBER 9e01dd3724 modification de la TODOLIST 2015-10-08 12:19:05 +02:00
25 changed files with 2992 additions and 275 deletions

135
README.md
View File

@ -1,135 +1,112 @@
Plex Web Downloader Plex Web Downloader
=============== ===============
The original translated into english and using pwd url base for nginx reverse proxy use Ce projet permet de créer une liste de vos fichiers vidéo plex et de les partager aux travers d'une interface web.
This project allows you to create a list of your plex video files and to share them through a web interface.
************************************************************************************************************************************** INSTALLATION
I would recomend setting up a crontab that backups the plex database every night then have this use the new file that has been created that way this doesn't lock the plex database
***************************************************************************************************************************************
MANUAL INSTALLATION
-------------------- --------------------
If you prefer to compile the latest version of the project yourself, or if your operating system is not supported: il existe des version packagé pour window et mac, où vous n'avez plus qu'à éditer votre configuration avant de lancer le serveur
** On Windows ** voir ici:
  prerequisites, install git (https://git-scm.com/download/win)
  prerequisites, install nodejs 0.12.x (https://nodejs.org/dist/v0.12.7/)
  open the 'cmb' command prompt, and then move to a directory where you want to install
    git clone https://github.com/12nick12/pwd.git
    cd plex-web-downloader
    npm install
  modify the file config.js, to put the path of the database plex (attention must double the anti-slash and protect the spaces)
  For example: C: \\ Users \\ yourUsername \\ AppData \\ Local \\ Plex \ Media \ Server \\ Plug-in \ Support \\ Databases \\ com.plexapp.plugins.library.db
    npm start
  then open in your browser the address http: // localhost: 3000
** Under MacOS ** INSTALLATION MANUELLE
--------------------
**Sur Windows**
  prerequisites, nodejs pré requis, installer git ( https://git-scm.com/download/win )
    brew install node pré requis, installer nodewebkit (http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-win-ia32.zip)
  then ouvrir l'invite de commande 'cmb', puis se deplacer dans un repertoire où vous voulez installer
    git clone https://github.com/12nick12/pwd.git git clone https://github.com/TwanoO67/plex-web-downloader.git
    cd plex-web-downloader cd plex-web-downloader
    npm install npm install
  modify the file config.js, to put the path of the database plex modifier le fichier config.js, pour y mettre le chemin de la base de données plex (attention il faut doubler les anti-slash et proteger les espaces )
  example: / Users / yourUsername / Library / Application Support / Plex Media Server / Plug-in Support / Databases / com.plexapp.plugins.library.db exemple: C:\\Users\\yourUsername\\AppData\\Local\\Plex\ Media\ Server\\Plug-in\ Support\\Databases\\com.plexapp.plugins.library.db
    npm start npm start
  then open in your browser the address http: // localhost: 3000 puis ouvrir dans votre navigateur l'adresse http://localhost:3000
** Under Ubuntu ** **Sous MacOS**
  prerequisites nodejs, or pré requis, nodewebkit ( http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-osx-ia32.zip )
    apt-get install nodejs git clone https://github.com/TwanoO67/plex-web-downloader.git
    ln -s / usr / bin / nodejs / usr / local / bin / node cd plex-web-downloader
  then move to your directory to install and: npm install
    git clone https://github.com/12nick12/pwd.git modifier le fichier config.js, pour y mettre le chemin de la base de données plex
    cd plex-web-downloader exemple: /Users/yourUsername/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
    npm install npm start
  modify the file config.js, to put the path of the database plex puis ouvrir dans votre navigateur l'adresse http://localhost:3000
  Example: / home / yourUsername / plex-config / Plex Media Server / Plug-in Support / Databases / com.plexapp.plugins.library.db
    npm start
  then open in your browser the address http: // localhost: 3000
DEVELOPMENT
DEVELOPPEMENT
-------------------- --------------------
** the project was originally created with ** **le projet a été créée initialement avec**
    node install express -g node install express -g
    node install express-generator -g node install express-generator -g
    express project_name express nom_du_projet
    cd project_name cd nom_du_projet
    npm install npm install
** to install plex (from a dockerfile) ** **pour installer plex (depuis un dockerfile)**
    mkdir ~ / plex-config mkdir ~/plex-config
    sudo chown 797: 797 -R ~ / plex-config sudo chown 797:797 -R ~/plex-config
    sudo docker -d --restart = always -v ~ / plex-config: / config -v ~ / Movies: / media / plex -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 chmod 777 ~/plex-config/Plex\ Media\ Server/Plug-in\ Support/Databases/*
    sudo chmod 777 ~ / Movies sudo chmod 777 ~/Movies
    sudo ln -s ~ / Movies / media / plex sudo ln -s ~/Movies /media/plex
then configure your channels on: http: // localhost: 32400 / web / index.html puis configurer vos chaines sur: http://localhost:32400/web/index.html
COMPILATION PACKAGING
-------------------- --------------------
voir ici: https://github.com/nwjs/nw.js/wiki/Using-Node-modules
    npm install enclose -g sudo npm install
      enclose -o bin / mac_bin --loglevel info -c enclose_config.js -v 0.12.7 ./bin/www sudo npm install nw-gyp -g
sudo nw-gyp rebuild --target=0.12.3
TODO List TODO Liste
-------------------- --------------------
* Manage thumbnail images * Gérer les images des vignettes
* Manage multi-source downloads by offering a link aria2 (see aria2.sourceforge.net) * Mutualisé les sources avec un mirroir centralisé
* Integrated web ui: http://ziahamza.github.io/webui-aria2/ * Gérer les téléchargements multi-source en proposant un lien aria2 (voir aria2.sourceforge.net)
* Set up an upload limit that can be activated on demand * Intégré web ui: http://ziahamza.github.io/webui-aria2/
* Mettre en place une limite d'upload activable à la demande

114
bin/www
View File

@ -1,114 +0,0 @@
#!/usr/bin/env node
//One begins with the clustering
var cluster = require('cluster');
// Code to run if we're in the master process
if (cluster.isMaster) {
// Count the machine's CPUs
var cpuCount = require('os').cpus().length;
// Create a worker for each CPU
for (var i = 0; i < cpuCount; i += 1) {
console.log('Création du fork ' + i);
cluster.fork();
}
// Listen for dying workers
cluster.on('exit', function (worker) {
// Replace the dead worker, we're not sentimental
console.log('Worker ' + worker.id + ' died :(');
cluster.fork();
console.log('Remplacement du worker ');
});
// Code to run if we're in a worker process
} else {
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('plex_webdown:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
}
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>PLEX Web Downloader</title>
<script src="./js/startup.js"></script>
</head>
<body>
<section>
Chargement en cours...
</section>
</body>
</html>

View File

@ -4,17 +4,17 @@ var favicon = require('serve-favicon');
var logger = require('morgan'); var logger = require('morgan');
var cookieParser = require('cookie-parser'); var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser'); var bodyParser = require('body-parser');
var config = require('./config'); var config = require('../config');
var app = express(); var app = express();
// view engine setup // view engine setup
app.set('views', path.join(__dirname, 'views')); app.set('views', path.join(__dirname, '../views'));
app.set('view engine', 'jade'); app.set('view engine', 'jade');
//password protection //protection par mot de passe
if( typeof config.auth_user !== 'undefined' && typeof config.auth_password !== 'undefined' ){ if( typeof config.auth_user !== 'undefined' && typeof config.auth_password !== 'undefined' ){
console.log("SAFE MODE: votre serveur est protégé par mot de passe."); //console.log("SAFE MODE: votre serveur est protégé par mot de passe.");
var basicAuth = require('basic-auth'); var basicAuth = require('basic-auth');
app.use(function(req, res, next) { app.use(function(req, res, next) {
var user = basicAuth(req); var user = basicAuth(req);
@ -27,32 +27,32 @@ if( typeof config.auth_user !== 'undefined' && typeof config.auth_password !== '
} }
}); });
} }
else{ /*else{
console.log("UNSAFE MODE: configurez un auth_user et auth_password dans le fichier config.js"); console.log("UNSAFE MODE: configurez un auth_user et auth_password dans le fichier config.js");
} }*/
//send config to everyone //envoyer config a tout le monde
app.use(function(req, res, next) { app.use(function(req, res, next) {
res.locals.config = config; res.locals.config = config;
next(); next();
}); });
app.use(favicon(path.join(__dirname, 'public', 'iconarchive_plex.ico'))); app.use(favicon(path.join(__dirname, '../public', 'iconarchive_plex.ico')));
app.use(logger('dev')); app.use(logger('dev'));
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser()); app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, '../public')));
app.use('/pwd/', require('./routes/index')); app.use('/', require('../routes/index'));
app.use('/pwd/users', require('./routes/users')); app.use('/users', require('../routes/users'));
app.use('/pwd/file', require('./routes/file')); app.use('/file', require('../routes/file'));
app.use('/pwd/channel', require('./routes/channel')); app.use('/channel', require('../routes/channel'));
app.use('/pwd/movie', require('./routes/movie')); app.use('/movie', require('../routes/movie'));
app.use('/pwd/show_list', require('./routes/show_list')); app.use('/show_list', require('../routes/show_list'));
app.use('/pwd/show', require('./routes/show')); app.use('/show', require('../routes/show'));
app.use('/pwd/divers', require('./routes/divers')); app.use('/divers', require('../routes/divers'));
// catch 404 and forward to error handler // catch 404 and forward to error handler
app.use(function(req, res, next) { app.use(function(req, res, next) {

113
js/clustering.js Normal file
View File

@ -0,0 +1,113 @@
//On commence par la mise en cluster
var cluster = require('cluster');
// Code to run if we're in the master process
if (cluster.isMaster) {
// Count the machine's CPUs
var cpuCount = require('os').cpus().length;
// Create a worker for each CPU
for (var i = 0; i < cpuCount; i += 1) {
//console.log('Création du fork ' + i);
cluster.fork();
}
console.log('Création de '+cpuCount+' thread');
// Listen for dying workers
cluster.on('exit', function (worker) {
// Replace the dead worker, we're not sentimental
cluster.fork();
console.log('Remplacement du worker ' + worker.id);
});
// Code to run if we're in a worker process
} else {
/**
* Module dependencies.
*/
var app = require('./build_server');
var debug = require('debug')('plex_webdown:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
}
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}

112
js/custom-tray-menu.js Normal file
View File

@ -0,0 +1,112 @@
"use strict";
var gui = window.require('nw.gui');
var util = require('util');
class CustomTrayMenu {
constructor(windowPath, trayIcon, windowOptions) {
this.shown = false;
this.iconWidth = 12;
//valeur par défaut
this.trayIcon = trayIcon || 'tray2.png';
this.menuWindowPath = windowPath || 'custom-tray-menu.html';
this.menuWndowOptions = windowOptions || {
width: 185,
height: 143
};
this._initTray();
this._initMenuWindow();
this.tray.on('click', this.toggleTrayMenuAt.bind(this));
}
// remove tray, cose custom menu window
remove() {
this.tray.remove();
this.tray = null;
this.trayMenu.close();
}
_initTray() {
this.tray = new gui.Tray({
title: '',
icon: this.trayIcon,
alticon: '',
tooltip: window.document.title,
iconsAreTemplates: false
});
}
_initMenuWindow() {
var windowOptions = util._extend({
width: 200,
height: 100,
frame: false,
transparent: true,
resizable: false,
show: false,
'show_in_taskbar': process.platform == "darwin"
}, this.menuWndowOptions);
this.trayMenu = gui.Window.open(this.menuWindowPath, windowOptions);
// add class to new window's body to apply platform specific css
this.trayMenu.on('document-end', function() {
this.trayMenu.window.document.body.className += ' ' + process.platform;
//console.log("Adding class " + process.platform);
}.bind(this));
this.trayMenu.on('blur', function () {
this.trayMenu.hide();
this.shown = false;
//console.log('Hide custom menu');
}.bind(this));
}
// called when user click on tray icon
toggleTrayMenuAt(position) {
/*if (this.shown) {
this.trayMenu.hide(); // this will trigger listener added above
this.shown = false;
} else {*/
this.translate(position);
this.trayMenu.moveTo(position.x, position.y);
//global.main_win.show();
//global.main_win.focus();
this.trayMenu.show();
//this.trayMenu.focus();
this.shown = true;
//console.log('Show custom menu');
//}
}
// calculdate position for window to appear
translate(pos) {
//console.log("Click position: " + util.inspect(pos));
if (process.platform == 'darwin') {
pos.x -= Math.floor(this.trayMenu.width / 2 - this.iconWidth);
} else {
pos.x -= Math.floor(this.trayMenu.width / 2);
// for windows can not make exac position, because we have position of click. Just move it 5px up
pos.y -= this._trayAreaIsTop(pos) ? 0 : this.trayMenu.height + this.iconWidth / 2 + 5;
}
}
_trayAreaIsTop(pos) {
var screen;
if (gui.Screen.Init) gui.Screen.Init();
function posInBounds(s) {
return pos.y > s.bounds.y && pos.y < (s.bounds.y + s.bounds.height) &&
pos.x > s.bounds.x && pos.x < (s.bounds.x + s.bounds.width);
}
screen = gui.Screen.screens.filter(posInBounds)[0];
return pos.y < (screen.bounds.y + screen.bounds.height) / 2;
}
}
module.exports = CustomTrayMenu;

92
js/startup.js Normal file
View File

@ -0,0 +1,92 @@
//sur le master on cree l'interface
"use strict";
var gui = require('nw.gui');
var CustomTrayMenu = require('./js/custom-tray-menu');
var win = gui.Window.get();
global.main_win = win;
//Test la presence du fichier de config
var fs = require('fs.extra');
fs.exists('config.js', function(exists) {
if (!exists) {
console.log('Config.js a été ré-initialisé');
fs.copy('config.js_example','config.js');
var child_process = require('child_process');
// exec: spawns a shell.
var cp = child_process.exec('open config.js', function(error, stdout, stderr){
//var gui = require('nw.gui');
//gui.App.closeAllWindows();
//global.main_server.kill();
//gui.App.quit();
});
cp.on('exit',function(stream){
var gui = require('nw.gui');
gui.App.closeAllWindows();
//global.main_server.kill();
gui.App.quit();
});
}
else{
//lancement normal
var config = require('./config');
//Prevenir des informations de config
if( typeof config.auth_user !== 'undefined' && typeof config.auth_password !== 'undefined' ){
console.log("SAFE MODE: votre serveur est protégé par mot de passe.");
}
else{
console.log("UNSAFE MODE: configurez un auth_user et auth_password dans le fichier config.js");
}
if( typeof config.database !== undefined){
fs.exists(config.database, function(exists) {
if (!exists) {
console.log("La base plex n'existe pas. Mettez à jour le champ DATABASE du fichier config.js");
}
else{
console.log("La base plex a bien été trouvée.");
}
});
}
else{
console.log("La base plex n'est pas définie. Mettez à jour le champ DATABASE du fichier config.js");
}
// Extend application menu for Mac OS
if (process.platform == "darwin") {
var menu = new gui.Menu({type: "menubar"});
menu.createMacBuiltin && menu.createMacBuiltin(window.document.title);
win.menu = menu;
}
var $ = function (selector) {
return document.querySelector(selector);
}
var customTray;
customTray = new CustomTrayMenu('views/custom-tray-menu.html', 'public/icon.png', {
width: 200,
height: 180
});
//lancement du serveur
var child_process = require('child_process');
global.main_server = child_process.exec('./bin/node ./js/clustering.js');
//on tue le serveur quand on quite l'interface
process.on('exit', function (exitCode) {
child_process.kill();
});
}
});
win.hide();

View File

@ -1,20 +1,33 @@
{ {
"name": "plex_webdown", "name": "plex_webdown",
"version": "0.0.1", "version": "0.1.0",
"private": true, "main": "index.html",
"scripts": { "window": {
"start": "node ./bin/www" "show": true,
"frame": true,
"toolbar": false,
"focus": true,
"icon": "public/iconarchive_plex.ico",
"width": 550,
"height": 348
}, },
"scripts": {
"start": "nw .",
"vers": "nw --version"
},
"private": true,
"dependencies": { "dependencies": {
"basic-auth": "^1.0.3", "basic-auth": "^1.1.0",
"body-parser": "~1.13.2", "body-parser": "~1.17.2",
"cluster": "~0.7.7", "cluster": "~0.7.7",
"cookie-parser": "~1.3.5", "cookie-parser": "~1.4.3",
"debug": "~2.2.0", "debug": "~2.6.8",
"express": "~4.13.1", "express": "~4.15.3",
"fs.extra": "^1.3.2",
"jade": "~1.11.0", "jade": "~1.11.0",
"morgan": "~1.6.1", "morgan": "~1.8.2",
"serve-favicon": "~2.3.0", "nw": "0.20.1",
"sqlite3": "~3" "serve-favicon": "~2.4.3",
"sqlite3": "~3.1.8"
} }
} }

BIN
public/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

View File

@ -23,7 +23,7 @@ router.get('/:id', function(req, res, next) {
} }
} }
//we do all the basic operations following //on fais toute les opération de base a la suite
db.serialize(function() { db.serialize(function() {
//db.run("CREATE TABLE if not exists user_info (info TEXT)"); //db.run("CREATE TABLE if not exists user_info (info TEXT)");
@ -47,9 +47,9 @@ router.get('/:id', function(req, res, next) {
data.push(row); data.push(row);
}, },
//after all the operations of the database //aprés toute les opération de la base
function() { function() {
res.render('channel', { title: 'List of videos',videos: data, channel: channel_info }); res.render('channel', { title: 'Liste des vidéos',videos: data, channel: channel_info });
}); });
}); });

View File

@ -42,7 +42,7 @@ router.get('/', function(req, res, next) {
var db = config.init_db(); var db = config.init_db();
/*var data = []; /*var data = [];
//we do all the basic operations following //on fais toute les opération de base a la suite
db.serialize(function() { db.serialize(function() {
//db.run("CREATE TABLE if not exists user_info (info TEXT)"); //db.run("CREATE TABLE if not exists user_info (info TEXT)");

View File

@ -8,7 +8,7 @@ router.get('/', function(req, res, next) {
var db = config.init_db(); var db = config.init_db();
var data = []; var data = [];
//we do all the basic operations following //on fais toute les opération de base a la suite
db.serialize(function() { db.serialize(function() {
//db.run("CREATE TABLE if not exists user_info (info TEXT)"); //db.run("CREATE TABLE if not exists user_info (info TEXT)");
@ -22,9 +22,9 @@ router.get('/', function(req, res, next) {
+ " FROM library_sections ORDER BY name ASC", function(err, row) { + " FROM library_sections ORDER BY name ASC", function(err, row) {
data.push(row); data.push(row);
}, },
//after all the operations of the database //aprés toute les opération de la base
function() { function() {
res.render('index', { title: 'List of videos',channels: data, presentation: config.presentation }); res.render('index', { title: 'Liste des channel',channels: data, presentation: config.presentation });
}); });
}); });

View File

@ -41,7 +41,7 @@ router.get('/:id', function(req, res, next) {
row.file.push(ligne); row.file.push(ligne);
},function(){ },function(){
res.render('movie', { title: 'Video Detail',movie: row }); res.render('movie', { title: 'Détail vidéo',movie: row });
}); });
}); });

View File

@ -21,7 +21,7 @@ router.get('/:id/:incoming_chan', function(req, res, next) {
var db = config.init_db(); var db = config.init_db();
var data = []; var data = [];
//we do all the basic operations following //on fais toute les opération de base a la suite
db.serialize(function() { db.serialize(function() {
db.each("SELECT episode.id as id, episode.title as titre, episode.[index] as episode, episode.duration as second, season.[index] as saison, show.title as serie "+ db.each("SELECT episode.id as id, episode.title as titre, episode.[index] as episode, episode.duration as second, season.[index] as saison, show.title as serie "+
@ -51,7 +51,7 @@ router.get('/:id/:incoming_chan', function(req, res, next) {
}); });
db.close(function(){ db.close(function(){
//after all the operations of the database //aprés toute les opération de la base
var titre = "Série inexistante"; var titre = "Série inexistante";
if(data.length > 0){ if(data.length > 0){
titre = 'Episode de '+data[0].serie; titre = 'Episode de '+data[0].serie;

View File

@ -8,7 +8,7 @@ router.get('/:id', function(req, res, next) {
var shows = []; var shows = [];
//we do all the basic operations following //on fais toute les opération de base a la suite
db.serialize(function() { db.serialize(function() {
db.each("SELECT id, title, year" db.each("SELECT id, title, year"
@ -17,10 +17,10 @@ router.get('/:id', function(req, res, next) {
,req.params.id, function(err, row) { ,req.params.id, function(err, row) {
shows.push(row); shows.push(row);
}, },
//after all the operations of the database //aprés toute les opération de la base
function(){ function(){
console.log(shows); console.log(shows);
res.render('show_list', { title: 'List of series',shows: shows, channel_id: req.params.id }); res.render('show_list', { title: 'Liste des séries',shows: shows, channel_id: req.params.id });
}); });
}); });

View File

@ -1,15 +0,0 @@
# /etc/systemd/system/pwd.service
# change user to someone whos not root
[Unit]
Description=pwd
After=network-online.target
[Service]
User=root
Type=simple
ExecStart=/usr/bin/npm start /opt/plex-web-downloader/
Restart=on-abort
[Install]
WantedBy=default.target

View File

@ -6,21 +6,21 @@ block content
table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%") table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%")
thead thead
tr tr
th Name th Nom
th duration th Durée
th Year th Année
tbody tbody
each video, i in videos each video, i in videos
tr tr
td td
a(href="/pwd/movie/#{video.id}") #{video.title}&nbsp; a(href="/movie/#{video.id}") #{video.title}&nbsp;
td= video.duration td= video.duree
td= video.year td= video.year
script. script.
$(document).ready(function() { $(document).ready(function() {
$('#example').DataTable({ $('#example').DataTable({
"language": { "language": {
"url": "//cdn.datatables.net/plug-ins/1.10.8/i18n/English.json" "url": "//cdn.datatables.net/plug-ins/1.10.8/i18n/French.json"
} }
}); });
}); });

106
views/custom-tray-menu.html Normal file
View File

@ -0,0 +1,106 @@
<html>
<script>
var gui = require('nw.gui');
var win = gui.Window.get();
function open_conf(){
var child_process = require('child_process');
// exec: spawns a shell.
child_process.exec('open config.js', function(error, stdout, stderr){
console.log(stdout);
});
}
function proper_quit(){
gui.App.closeAllWindows();
global.main_server.kill();
gui.App.quit();
}
</script>
<style>
body, html {
margin: 0;
font-size: 12px;
font-family: Helvetica Neue, Lucida Grande, Segoe UI, Tahoma, sans;
overflow: hidden !important;
color: #333;
}
section {
background: #fff;
margin: 10px 13px 13px 13px;
padding: 9px;
border-radius: 7px;
border: 1px solid #A9A9A9;
/*overflow: hidden;*/
box-shadow: 0px 3px 13px rgba(0, 0, 0, 0.25);
position: relative;
text-align: center;
}
section::after, section::before {
position: absolute;
content: '';
display: block;
width: 0;
height: 0;
}
section::before {
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #A9A9A9;
top: -10px;
left: calc(50% - 11px);
}
section::after {
border-left: 9px solid transparent;
border-right: 9px solid transparent;
border-bottom: 9px solid #fff;
top: -9px;
left: calc(50% - 10px);
}
h4 {
color: #555555;
height: 33px;
line-height: 33px;
margin: -9px -9px 10px -9px;
background: linear-gradient(180deg, #fff, #E9E9E9);
border-top-left-radius: 7px;
border-top-right-radius: 7px;
text-align: center;
font-size: 12px;
border-bottom: 1px solid #adadad;
}
/* FOR WINDOWS */
body.win32 section::before, body.win64 section::before {
border-bottom: none;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #A9A9A9;
top: auto;
bottom: -10px;
left: calc(50% - 11px);
}
body.win32 section::after, body.win64 section::after {
border-bottom: none;
border-left: 9px solid transparent;
border-right: 9px solid transparent;
border-top: 9px solid #fff;
top: auto;
bottom: -9px;
left: calc(50% - 10px);
}
body.win32, body.win64 {{
section {
border-color: red;
}
}}
</style>
<body>
<section>
<h4>Plex Web Downloader</h4>
<p><button onclick="win.hide();">Minimiser le Menu</button></p>
<p><button onclick="open_conf();">Ouvrir la configuration</button></p>
<p><button onclick="proper_quit();">Arreter le Serveur</button></p>
</section>
</body>
</html>

View File

@ -11,6 +11,6 @@ block content
each channel, i in channels each channel, i in channels
li li
if(channel.type == 2) if(channel.type == 2)
a(href="/pwd/show_list/#{channel.id}")= channel.name a(href="/show_list/#{channel.id}")= channel.name
else else
a(href="/pwd/channel/#{channel.id}")= channel.name a(href="/channel/#{channel.id}")= channel.name

View File

@ -16,16 +16,16 @@ html
button.navbar-toggle(type="button",data-toggle="collapse",data-target="#collapse-menu") button.navbar-toggle(type="button",data-toggle="collapse",data-target="#collapse-menu")
span.sr-only Toggle navigation span.sr-only Toggle navigation
i.fa.fa-bars i.fa.fa-bars
a.navbar-brand(href="/pwd/") a.navbar-brand(href="/")
b Plex&nbsp; b Plex&nbsp;
| Web Downloader | Web Downloader
div#collapse-menu.collapse.navbar-collapse div#collapse-menu.collapse.navbar-collapse
ul.nav.navbar-nav.navbar-right ul.nav.navbar-nav.navbar-right
li.active li.active
a(href="/pwd/") Home a(href="/") Accueil
li li
a(href="/pwd/divers") Divers a(href="/divers") Divers
div.wrapper div.wrapper
div.container div.container

View File

@ -3,17 +3,17 @@ extends layout
block content block content
h1= movie.title h1= movie.title
a(href="#",onclick="window.history.back();") back to the list a(href="#",onclick="window.history.back();") Retour à la liste
br br
br br
label Note label Note
p= movie.rating p= movie.rating
label Download label Télécharger
br br
each file, i in movie.file each file, i in movie.file
a(href="/pwd/file/#{file.id}/#{file.filename}") #{file.size} #{file.filename} a(href="/file/#{file.id}/#{file.filename}") #{file.size} #{file.filename}
br br
br br
label Résumé label Résumé

View File

@ -3,28 +3,28 @@ extends layout
block content block content
h1= title h1= title
a(href="/pwd/show_list/#{channel_id}") Back to the list of series a(href="/show_list/#{channel_id}") Retour à la liste des séries
br br
br br
table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%") table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%")
thead thead
tr tr
th Name th Nom
th Season & Episode th Saison & Episode
th duration th Durée
tbody tbody
each video, i in videos each video, i in videos
tr tr
td td
a(href="/pwd/movie/#{video.id}") #{video.titre}&nbsp; a(href="/movie/#{video.id}") #{video.titre}&nbsp;
td= video.season_episode td= video.season_episode
td= video.duration td= video.duree
script. script.
$(document).ready(function() { $(document).ready(function() {
$('#example').DataTable({ $('#example').DataTable({
"language": { "language": {
"url": "//cdn.datatables.net/plug-ins/1.10.8/i18n/English.json" "url": "//cdn.datatables.net/plug-ins/1.10.8/i18n/French.json"
} }
}); });
}); });

View File

@ -6,19 +6,19 @@ block content
table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%") table(id="example", class="table table-striped table-bordered", cellspacing="0", width="100%")
thead thead
tr tr
th Series th Série
th Year th Année
tbody tbody
each show, i in shows each show, i in shows
tr tr
td td
a(href="/pwd/show/#{show.id}/#{channel_id}")= show.title a(href="/show/#{show.id}/#{channel_id}")= show.title
td= show.year td= show.year
script. script.
$(document).ready(function() { $(document).ready(function() {
$('#example').DataTable({ $('#example').DataTable({
"language": { "language": {
"url": "//cdn.datatables.net/plug-ins/1.10.8/i18n/English.json" "url": "//cdn.datatables.net/plug-ins/1.10.8/i18n/French.json"
} }
}); });
}); });

2420
yarn.lock Normal file

File diff suppressed because it is too large Load Diff