Add admin, reforge view, fix error load servers, fix throwing error

pull/9/head
Chewbaka69 6 years ago
parent faac5bb05a
commit b44472a203

185
composer.lock generated

@ -1,24 +1,23 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"hash": "25cbf2308918f775e251cffcf914c557",
"content-hash": "a9efe46743688d5b1f2f64de7f780195",
"content-hash": "85fd9d3cc030402a776db7f7553ced3f",
"packages": [
{
"name": "composer/installers",
"version": "v1.0.24",
"version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "1cf7cc4b89d5e8549bbb7d6ab1de75da13d27988"
"reference": "049797d727261bf27f2690430d935067710049c2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/1cf7cc4b89d5e8549bbb7d6ab1de75da13d27988",
"reference": "1cf7cc4b89d5e8549bbb7d6ab1de75da13d27988",
"url": "https://api.github.com/repos/composer/installers/zipball/049797d727261bf27f2690430d935067710049c2",
"reference": "049797d727261bf27f2690430d935067710049c2",
"shasum": ""
},
"require": {
@ -30,7 +29,7 @@
},
"require-dev": {
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "4.1.*"
"phpunit/phpunit": "^4.8.36"
},
"type": "composer-plugin",
"extra": {
@ -60,71 +59,92 @@
"keywords": [
"Craft",
"Dolibarr",
"Eliasis",
"Hurad",
"ImageCMS",
"Kanboard",
"Lan Management System",
"MODX Evo",
"Mautic",
"Maya",
"OXID",
"Plentymarkets",
"Porto",
"RadPHP",
"SMF",
"Thelia",
"WolfCMS",
"agl",
"aimeos",
"annotatecms",
"attogram",
"bitrix",
"cakephp",
"chef",
"cockpit",
"codeigniter",
"concrete5",
"croogo",
"dokuwiki",
"drupal",
"eZ Platform",
"elgg",
"expressionengine",
"fuelphp",
"grav",
"installer",
"itop",
"joomla",
"kohana",
"laravel",
"lavalite",
"lithium",
"magento",
"majima",
"mako",
"mediawiki",
"modulework",
"modx",
"moodle",
"osclass",
"phpbb",
"piwik",
"ppi",
"puppet",
"pxcms",
"reindex",
"roundcube",
"shopware",
"silverstripe",
"sydes",
"symfony",
"typo3",
"wordpress",
"yawik",
"zend",
"zikula"
],
"time": "2016-04-05 11:42:46"
"time": "2017-12-29T09:13:20+00:00"
},
{
"name": "fuel/auth",
"version": "dev-1.8/master",
"version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/fuel/auth.git",
"reference": "a645dbe2f80b6b4cecb069b57ea70150b6e53929"
"reference": "b19a63e27903760d41a8641b8a42b1ddaaa646f2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fuel/auth/zipball/a645dbe2f80b6b4cecb069b57ea70150b6e53929",
"reference": "a645dbe2f80b6b4cecb069b57ea70150b6e53929",
"url": "https://api.github.com/repos/fuel/auth/zipball/b19a63e27903760d41a8641b8a42b1ddaaa646f2",
"reference": "b19a63e27903760d41a8641b8a42b1ddaaa646f2",
"shasum": ""
},
"require": {
"composer/installers": "~1.0"
},
"type": "fuel-package",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@ -136,30 +156,27 @@
],
"description": "FuelPHP 1.x Auth Package",
"homepage": "https://github.com/fuel/auth",
"support": {
"source": "https://github.com/fuel/auth/tree/1.8/develop",
"issues": "https://github.com/fuel/auth/issues"
},
"time": "2016-01-23 12:30:25"
"time": "2018-04-18T14:45:14+00:00"
},
{
"name": "fuel/core",
"version": "dev-1.8/master",
"version": "1.8.0.3",
"source": {
"type": "git",
"url": "https://github.com/fuel/core.git",
"reference": "26f6432a9f41659280c70ba47c16170adf1e7611"
"reference": "c8e190b22cb9fc1a9acfdde4ed7487e04051bbe7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fuel/core/zipball/26f6432a9f41659280c70ba47c16170adf1e7611",
"reference": "26f6432a9f41659280c70ba47c16170adf1e7611",
"url": "https://api.github.com/repos/fuel/core/zipball/c8e190b22cb9fc1a9acfdde4ed7487e04051bbe7",
"reference": "c8e190b22cb9fc1a9acfdde4ed7487e04051bbe7",
"shasum": ""
},
"require": {
"composer/installers": "~1.0"
},
"type": "fuel-package",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@ -171,30 +188,27 @@
],
"description": "FuelPHP 1.x Core",
"homepage": "https://github.com/fuel/core",
"support": {
"source": "https://github.com/fuel/core/tree/1.8/master",
"issues": "https://github.com/fuel/core/issues"
},
"time": "2016-04-09 16:28:31"
"time": "2016-07-21T08:45:05+00:00"
},
{
"name": "fuel/email",
"version": "dev-1.8/master",
"version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/fuel/email.git",
"reference": "79133b3951068bbcff9a9c7b77f9f27a777ebdbd"
"reference": "a12df7db925c81f3ace52cdec3dfd925193c8e4b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fuel/email/zipball/79133b3951068bbcff9a9c7b77f9f27a777ebdbd",
"reference": "79133b3951068bbcff9a9c7b77f9f27a777ebdbd",
"url": "https://api.github.com/repos/fuel/email/zipball/a12df7db925c81f3ace52cdec3dfd925193c8e4b",
"reference": "a12df7db925c81f3ace52cdec3dfd925193c8e4b",
"shasum": ""
},
"require": {
"composer/installers": "~1.0"
},
"type": "fuel-package",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@ -206,30 +220,27 @@
],
"description": "FuelPHP 1.x Email Package",
"homepage": "https://github.com/fuel/email",
"support": {
"source": "https://github.com/fuel/email/tree/1.8/develop",
"issues": "https://github.com/fuel/email/issues"
},
"time": "2016-01-23 12:31:34"
"time": "2018-04-18T14:49:14+00:00"
},
{
"name": "fuel/oil",
"version": "dev-1.8/master",
"version": "1.8.1.1",
"source": {
"type": "git",
"url": "https://github.com/fuel/oil.git",
"reference": "b29b80f29f090b9ad12b931da6e979587de6ced1"
"reference": "548d0fc1c07793e21128ecd4ebf5badc36908865"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fuel/oil/zipball/b29b80f29f090b9ad12b931da6e979587de6ced1",
"reference": "b29b80f29f090b9ad12b931da6e979587de6ced1",
"url": "https://api.github.com/repos/fuel/oil/zipball/548d0fc1c07793e21128ecd4ebf5badc36908865",
"reference": "548d0fc1c07793e21128ecd4ebf5badc36908865",
"shasum": ""
},
"require": {
"composer/installers": "~1.0"
},
"type": "fuel-package",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@ -241,30 +252,27 @@
],
"description": "FuelPHP 1.x Oil Package",
"homepage": "https://github.com/fuel/oil",
"support": {
"source": "https://github.com/fuel/oil/tree/1.8/develop",
"issues": "https://github.com/fuel/oil/issues"
},
"time": "2016-01-23 12:32:54"
"time": "2018-05-03T20:59:29+00:00"
},
{
"name": "fuel/orm",
"version": "dev-1.8/master",
"version": "1.8.1.2",
"source": {
"type": "git",
"url": "https://github.com/fuel/orm.git",
"reference": "2c1da635127c9fbedc9c76132fc904188892c365"
"reference": "372a5ffbbef797c4532eaf0283c9483309809206"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fuel/orm/zipball/2c1da635127c9fbedc9c76132fc904188892c365",
"reference": "2c1da635127c9fbedc9c76132fc904188892c365",
"url": "https://api.github.com/repos/fuel/orm/zipball/372a5ffbbef797c4532eaf0283c9483309809206",
"reference": "372a5ffbbef797c4532eaf0283c9483309809206",
"shasum": ""
},
"require": {
"composer/installers": "~1.0"
},
"type": "fuel-package",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@ -276,30 +284,27 @@
],
"description": "FuelPHP 1.x ORM Package",
"homepage": "https://github.com/fuel/orm",
"support": {
"source": "https://github.com/fuel/orm/tree/1.8/develop",
"issues": "https://github.com/fuel/orm/issues"
},
"time": "2016-02-07 12:09:12"
"time": "2018-04-22T10:09:22+00:00"
},
{
"name": "fuel/parser",
"version": "dev-1.8/master",
"version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/fuel/parser.git",
"reference": "bec50ec304e696d72dba7f13494828532c6e18df"
"reference": "c8725e112ef59f70f73ddff754a9fe762229fa88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fuel/parser/zipball/bec50ec304e696d72dba7f13494828532c6e18df",
"reference": "bec50ec304e696d72dba7f13494828532c6e18df",
"url": "https://api.github.com/repos/fuel/parser/zipball/c8725e112ef59f70f73ddff754a9fe762229fa88",
"reference": "c8725e112ef59f70f73ddff754a9fe762229fa88",
"shasum": ""
},
"require": {
"composer/installers": "~1.0"
},
"type": "fuel-package",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@ -311,11 +316,7 @@
],
"description": "FuelPHP 1.x Parser Package",
"homepage": "https://github.com/fuel/parser",
"support": {
"source": "https://github.com/fuel/parser/tree/1.8/develop",
"issues": "https://github.com/fuel/parser/issues"
},
"time": "2016-03-12 12:08:41"
"time": "2018-04-18T14:52:18+00:00"
},
{
"name": "fuelphp/upload",
@ -365,7 +366,7 @@
"file uploads",
"upload"
],
"time": "2015-11-04 17:19:56"
"time": "2015-11-04T17:19:56+00:00"
},
{
"name": "michelf/php-markdown",
@ -416,7 +417,7 @@
"keywords": [
"markdown"
],
"time": "2013-11-29 17:09:24"
"time": "2013-11-29T17:09:24+00:00"
},
{
"name": "monolog/monolog",
@ -478,7 +479,7 @@
"logging",
"psr-3"
],
"time": "2013-04-23 10:09:48"
"time": "2013-04-23T10:09:48+00:00"
},
{
"name": "phpseclib/phpseclib",
@ -566,26 +567,34 @@
"x.509",
"x509"
],
"time": "2015-08-04 04:48:03"
"time": "2015-08-04T04:48:03+00:00"
},
{
"name": "psr/log",
"version": "1.0.0",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Psr\\Log\\": ""
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -599,33 +608,35 @@
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2012-12-21 11:40:51"
"time": "2016-10-10T12:19:37+00:00"
}
],
"packages-dev": [
{
"name": "fuel/docs",
"version": "dev-1.8/master",
"version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/fuel/docs.git",
"reference": "d16972d39cef5f936779fca83bb19037cc2a3140"
"reference": "819d65d744ef29cacec96649a6f39be28c854038"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fuel/docs/zipball/d16972d39cef5f936779fca83bb19037cc2a3140",
"reference": "d16972d39cef5f936779fca83bb19037cc2a3140",
"url": "https://api.github.com/repos/fuel/docs/zipball/819d65d744ef29cacec96649a6f39be28c854038",
"reference": "819d65d744ef29cacec96649a6f39be28c854038",
"shasum": ""
},
"require": {
"composer/installers": "~1.0"
},
"type": "fuel-package",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@ -637,28 +648,16 @@
],
"description": "FuelPHP 1.x Documenataion",
"homepage": "https://github.com/fuel/docs",
"support": {
"source": "https://github.com/fuel/docs/tree/1.8/master",
"issues": "https://github.com/fuel/docs/issues"
},
"time": "2016-04-09 11:48:09"
"time": "2018-04-17T16:29:24+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"fuel/core": 20,
"fuel/auth": 20,
"fuel/email": 20,
"fuel/oil": 20,
"fuel/orm": 20,
"fuel/parser": 20,
"fuel/docs": 20
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.3"
"php": ">=5.6.33"
},
"platform-dev": []
}

Binary file not shown.

@ -1,22 +1,60 @@
<?php
use Fuel\Core\Controller_Template;
use Fuel\Core\Response;
use Fuel\Core\Session;
use Fuel\Core\View;
class Controller_Admin extends Controller_Home
class Controller_Admin extends Controller_Template
{
public $template = 'admin/body';
public function before()
{
parent::before();
$user = Session::get('user');
if(!$user->admin)
if(!$user)
Response::redirect('/login');
if(!$user->admin)
Response::redirect('/home');
$this->template->user = Session::get('user');
$this->template->js_bottom = [];
}
public function action_index()
{
Response::forge(View::forge('admin/index'));
$body = View::forge('admin/index');
$this->template->body = $body;
}
public function action_servers()
{
$this->template->js_bottom = ['plex_alert.js', 'server_refresh.js'];
$body = View::forge('admin/servers');
$servers = Model_Server::find_all();
$body->set('servers', $servers);
$this->template->body = $body;
}
public function action_users()
{
$this->template->js_bottom = ['plex_alert.js'];
$body = View::forge('admin/users');
$users = Model_User::find_all();
$body->set('users', $users);
$this->template->body = $body;
}
}

@ -0,0 +1,36 @@
<?php
use Fuel\Core\Session;
use Fuel\Core\View;
class Controller_Admin_Libraries extends Controller_Admin
{
public function action_index()
{
$this->template->js_bottom = ['plex_alert.js', 'server_refresh.js'];
$body = View::forge('admin/libraries');
$libraries = Model_Library::find_all();
$body->set('libraries', $libraries);
$this->template->body = $body;
}
public function action_permissions()
{
$this->template->js_bottom = ['plex_alert.js'];
$body = View::forge('admin/libraries/permissions');
$library_id = $this->param('library_id');
$permissions = Model_Permission::find_all();
$body->set('permissions', $permissions);
$body->set('user', Session::get('user'));
$this->template->body = $body;
}
}

@ -12,23 +12,25 @@ class Controller_Home extends Controller_Template
public function before()
{
parent::before();
$user = Session::get('user');
$sessionServer = Session::get('server');
$sessionLibraries = Session::get('libraries');
if(!$user)
Response::redirect('/login');
$server = $sessionServer ? Model_Server::find_by_pk($sessionServer->id) : Model_Server::find_all()[0];
$server = $sessionServer ? Model_Server::find_by_pk($sessionServer->id) : Model_Server::find_one_by('user_id', $user->id);
if(!$server)
Response::redirect('/login');
$libraries = $sessionLibraries ?: $server->getLibraries();
//var_dump($sessionLibraries);die();
$libraries = $server->getLibraries();
$this->template->user = Session::get('user');
$this->template->server = $server;
$this->template->libraries = $libraries;
$this->template->MenuServer = $server;
$this->template->MenuLibraries = $libraries;
$this->template->js_bottom = ['clappr.min.js', 'player.js'];
}
@ -39,21 +41,21 @@ class Controller_Home extends Controller_Template
$server_id = $this->param('server_id');
if($server_id) {
if($server_id !== NULL) {
$server = Model_Server::find_by_pk($server_id);
if($server)
$this->template->server = $server;
$this->template->MenuServer = $server;
}
$this->template->libraries = $this->template->server->getLibraries();
Session::delete('server');
Session::set('server', $this->template->MenuServer);
Session::set('server', $this->template->server);
Session::set('libraries', $this->template->libraries);
$this->template->MenuLibraries = $this->template->MenuServer->getLibraries();
$episodes = Model_Movie::getThirtyLastedTvShows($this->template->server);
$episodes = Model_Movie::getThirtyLastedTvShows($this->template->MenuServer);
$movies = Model_Movie::getThirtyLastedMovies($this->template->server);
$movies = Model_Movie::getThirtyLastedMovies($this->template->MenuServer);
$body->set('episodes', $episodes);
$body->set('movies', $movies);

@ -22,9 +22,17 @@ class Controller_Library extends Controller_Home
$content = null;
if($library->type === 'movie') {
$content = Model_Movie::find_by('library_id', $library->id);
$content = Model_Movie::find_by(function ($query) use ($library_id){
$query->where('library_id', $library_id)
->order_by('title', 'ASC')
;
});
} else if($library->type === 'show') {
$content = Model_Tvshow::find_by('library_id', $library->id);
$content = Model_Tvshow::find_by(function ($query) use ($library_id){
$query->where('library_id', $library_id)
->order_by('title', 'ASC')
;
});
}
$body->set('movies', $content);

@ -35,6 +35,9 @@ class Controller_Login extends Controller
if (Input::method() === 'POST') {
if($user = Model_User::Login($login, $password)) {
$user->lastlogin = time();
$user->save();
Session::set('user', $user);
Response::redirect('/home');
}

@ -3,11 +3,6 @@
use Fuel\Core\Controller;
use Fuel\Core\Response;
use Fuel\Core\Session;
use Fuel\Core\View;
use Fuel\Core\Asset;
use Fuel\Core\Input;
use Fuel\Core\Config;
use Fuel\Core\FuelException;
class Controller_Logout extends Controller
{

@ -26,25 +26,32 @@ class Controller_Rest_Browse extends Controller_Rest
}
if(!$server)
$this->response(array('error' => true, 'message' => 'No server found!'));
return $this->response(array('error' => true, 'message' => 'No server found!'));
$this->response($server);
}
public function get_library()
{
$library = Model_Library::find_one_by(function($query) {
$library_id = Input::get('library_id');
$library = Model_Library::find_one_by(function($query) use ($library_id) {
$query
->select('library.*', 'server.id as server_id', 'server.name as server_name')
->select_array([
'library.*',
['server.id', 'server_id'],
['server.name', 'server_name']
])
->join('server', 'LEFT')
->on('server.id', '=','library.server_id' )
->where('server.user_id', Session::get('user')->id)
->and_where('library.id', $library_id)
->and_where('server.disable', 0)
;
});
if(!$library)
$this->response(array('error' => true, 'message' => 'No server found!'));
return $this->response(array('error' => true, 'message' => 'No server found!'));
$this->response($library);
}
@ -58,22 +65,25 @@ class Controller_Rest_Browse extends Controller_Rest
)
));
$this->response($servers);
return $this->response($servers);
}
public function put_server()
{
try {
$server_id = Input::put('server_id');
$server = Model_Server::find_by('id', $server_id);
if(!$server)
$this->response(array('error' => true, 'message' => 'No server found!'));
if (!$server)
return $this->response(array('error' => true, 'message' => 'No server found!'));
Model_Server::BrowseServeur($server);
$this->response(['error' => false, 'message' => 'Servers informations update!']);
return $this->response(['error' => false, 'message' => 'Servers informations update!']);
} catch (Exception $e) {
return $this->response(['error' => true, 'message' => $e->getMessage()]);
}
}
public function get_libraries()
@ -83,12 +93,12 @@ class Controller_Rest_Browse extends Controller_Rest
$server = Model_Server::find_by_pk($server_id);
if(!$server)
$this->response(array('error' => true, 'message' => 'No server found!'));
return $this->response(array('error' => true, 'message' => 'No server found!'));
$libraries = Model_Library::BrowseLibraries($server);
if(!$libraries)
$this->response(array('error' => true, 'message' => 'No library found!'));
return $this->response(array('error' => true, 'message' => 'No library found!'));
$this->response(['error' => false, 'libraries' => $libraries]);
}
@ -102,10 +112,10 @@ class Controller_Rest_Browse extends Controller_Rest
$library = Model_Library::find_by_pk($library_id);
if(!$server)
$this->response(array('error' => true, 'message' => 'No server found!'));
return $this->response(array('error' => true, 'message' => 'No server found!'));
if(!$library)
$this->response(array('error' => true, 'message' => 'No library found!'));
return $this->response(array('error' => true, 'message' => 'No library found!'));
return Model_Library::getSectionsContent($server, $library);
}
@ -119,15 +129,15 @@ class Controller_Rest_Browse extends Controller_Rest
$tvshow = Model_Tvshow::find_by_pk($tvshow_id);
if(!$server)
$this->response(array('error' => true, 'message' => 'No server found!'));
return $this->response(array('error' => true, 'message' => 'No server found!'));
if(!$tvshow)
$this->response(array('error' => true, 'message' => 'No tvshow found!'));
return $this->response(array('error' => true, 'message' => 'No tvshow found!'));
$seasons = Model_Tvshow::getTvShowSeasons($server,$tvshow);
if(!$seasons)
$this->response(array('error' => true, 'message' => 'No season found!'));
return $this->response(array('error' => true, 'message' => 'No season found!'));
$this->response(['error' => false, 'seasons' => $seasons]);
}
@ -141,15 +151,15 @@ class Controller_Rest_Browse extends Controller_Rest
$season = Model_Season::find_by_pk($season_id);
if(!$server)
$this->response(array('error' => true, 'message' => 'No server found!'));
return $this->response(array('error' => true, 'message' => 'No server found!'));
if(!$season)
$this->response(array('error' => true, 'message' => 'No season found!'));
return $this->response(array('error' => true, 'message' => 'No season found!'));
$movies = Model_Season::getMovies($server,$season);
if(!$movies)
$this->response(array('error' => true, 'message' => 'No movie found!'));
return $this->response(array('error' => true, 'message' => 'No movie found!'));
$this->response(array_merge(['error' => false], $movies));
}

@ -8,6 +8,7 @@ use Fuel\Core\FuelException;
use Fuel\Core\Input;
use Fuel\Core\Request;
use Fuel\Core\Str;
use function PHPSTORM_META\type;
class Controller_Rest_Install extends Controller_Rest
{
@ -92,6 +93,7 @@ class Controller_Rest_Install extends Controller_Rest
'password' => array('constraint' => 255, 'type' => 'varchar'),
'admin' => array('constraint' => 1, 'type' => 'int', 'default' => 0),
'lastlogin' => array('constraint' => 11, 'type' => 'int'),
'parent_id' => array('constraint' => 36, 'type' => 'varchar', 'default' => null, 'null' => true),
'disable' => array('constraint' => 1, 'type' => 'int', 'default' => 0)
),
array('id'), false, 'InnoDB', 'utf8_unicode_ci'
@ -187,7 +189,7 @@ class Controller_Rest_Install extends Controller_Rest
'plex_key' => array('constraint' => 36, 'type' => 'varchar'),
'number' => array('constraint' => 11, 'type' => 'int'),
'title' => array('constraint' => 255, 'type' => 'varchar'),
'thumb' => array('constraint' => 255, 'type' => 'varchar'),
'thumb' => array('constraint' => 255, 'type' => 'varchar', 'null' => true),
'art' => array('constraint' => 255, 'type' => 'varchar', 'null' => true),
'leafCount' => array('constraint' => 11, 'type' => 'int', 'null' => true),
'addedAt' => array('constraint' => 11, 'type' => 'int', 'null' => true),
@ -304,12 +306,32 @@ class Controller_Rest_Install extends Controller_Rest
'id' => array('constraint' => 36, 'type' => 'varchar'),
'file_id' => array('constraint' => 11, 'type' => 'int'),
'user_id' => array('constraint' => 36, 'type' => 'varchar'),
'watching_time' => array('constraint' => 11, 'type' => 'int'),
'ended' => array('constraint' => 1, 'type' => 'int', 'default' => 0),
'disable' => array('constraint' => 1, 'type' => 'int', 'default' => 0)
),
array('id'), false, 'InnoDB', 'utf8_unicode_ci'
);
$logs .= 'User Watching table create!'."\r\n";
$logs .= 'Creation table user settings'."\r\n";
/**
* CREATE TABLE USER'S WATCHING
*/
DBUtil::create_table(
'user_settings',
array(
'id' => array('constraint' => 36, 'type' => 'varchar'),
'language' => array('constraint' => 36, 'type' => 'varchar'),
'refresh' => array('constraint' => 11, 'type' => 'int'),
'trailer' => array('constraint' => 11, 'type' => 'int', 'default' => 0),
'subtitle' => array('constraint' => 11, 'type' => 'int'),
'quality' => array('constraint' => 11, 'type' => 'int', 'default' => -1)
),
array('id'), false, 'InnoDB', 'utf8_unicode_ci'
);
$logs .= 'User Watching table create!'."\r\n";
$logs .= 'Create Foreign key'."\r\n";
/**
* FOREIGN KEY
@ -434,6 +456,16 @@ class Controller_Rest_Install extends Controller_Rest
'on_update' => 'NO ACTION',
'on_delete' => 'NO ACTION',
));
DBUtil::add_foreign_key('user', array(
'constraint' => 'constraintUserUser',
'key' => 'parent_id',
'reference' => array(
'table' => 'user',
'column' => 'id',
),
'on_update' => 'NO ACTION',
'on_delete' => 'NO ACTION',
));
$logs .= 'Foreign key create!'."\r\n";

@ -30,7 +30,7 @@ class Controller_Rest_Settings extends Controller_Rest
if(!$result)
throw new FuelException('Can not connect to your server!');
$server = $server_id === null ? Model_Server::forge() : Model_Server::find_by_pk($server_id);
$server = ($server_id === '' ? Model_Server::forge() : Model_Server::find_by_pk($server_id));
$server->set([
'user_id' => Session::get('user')->id,
'url' => $url,
@ -66,6 +66,34 @@ class Controller_Rest_Settings extends Controller_Rest
}
}
public function put_library()
{
try {
$library = Input::put('library_id');
$library = Model_Library::find_one_by(function($query) use($library) {
$query
->join('server', 'LEFT')
->on('server.id', '=','library.server_id' )
->where('server.user_id', Session::get('user')->id)
->and_where('library.id', $library)
->and_where('library.disable', 1)
->and_where('server.disable', 0)
;
});
if(!$library)
throw new FuelException('No disable library found!');
$library->set(['disable' => 0]);
$library->save();
return $this->response(array('error' => false));
} catch (FuelException $e) {
return $this->response(array('error' => true, 'message' => $e->getMessage() ?: 'Wrong parameters'), 400);
}
}
public function delete_library()
{
try {

@ -1,6 +1,8 @@
<?php
use Fuel\Core\FuelException;
class Model_Library extends Model_Overwrite
{
protected static $_table_name = 'library';
@ -49,23 +51,22 @@ class Model_Library extends Model_Overwrite
* List all libraries and register it in database
* @param $server
* @return bool | array
* @throws Exception
* @throws HttpNotFoundException
* @throws \FuelException
* @throws FuelException
*/
public static function BrowseLibraries($server)
{
try {
$libraries_id_array = [];
$curl = Request::forge('http://' . $server->url . ($server->port? ':' . $server->port : '') . '/library/sections?X-Plex-Token=' . $server->token, 'curl');
$curl = Request::forge('http://' . $server->url . ($server->port ? ':' . $server->port : '') . '/library/sections?X-Plex-Token=' . $server->token, 'curl');
$curl->execute();
if($curl->response()->status !== 200)
if ($curl->response()->status !== 200)
return false;
$list_libraries = Format::forge($curl->response()->body, 'xml')->to_array();
if(!isset($list_libraries['Directory']))
if (!isset($list_libraries['Directory']))
return false;
$list_libraries = $list_libraries['Directory'];
@ -75,7 +76,7 @@ class Model_Library extends Model_Overwrite
$new_library = Model_Library::find_by_pk($library['@attributes']['uuid']) ?: Model_Library::forge();
if(isset($new_library->disable) && $new_library->disable)
if ((isset($new_library->disable) && $new_library->disable) || ($library['@attributes']['type'] !== 'show' && $library['@attributes']['type'] !== 'movie'))
continue;
$libraries_id_array[] = ['id' => $library['@attributes']['uuid'], 'name' => $library['@attributes']['title']];
@ -95,21 +96,21 @@ class Model_Library extends Model_Overwrite
//self::getSectionsContent($server, $new_library);
if(isset($list_libraries['@attributes']))
if (isset($list_libraries['@attributes']))
break;
}
return $libraries_id_array;
} catch (Exception $exception) {
throw new FuelException($exception->getMessage(),$exception->getCode());
}
}
/**
* @param $server
* @param $library
* @return bool
* @throws Exception
* @throws FuelException
* @throws HttpNotFoundException
* @throws \FuelException
*/
public static function getSectionsContent($server, $library)
{

@ -157,6 +157,10 @@ class Model_Movie extends Model_Overwrite
}
}
/**
* @return array|mixed
* @throws FuelException
*/
public function getMetaData()
{
try {
@ -183,8 +187,26 @@ class Model_Movie extends Model_Overwrite
//ROLES
$this->metadata['Role'] = isset($array['Video']['Role']) ? $array['Video']['Role'] : null;
$this->metadata['Stream'] = [];
$this->metadata['Stream']['Video'] = [];
$this->metadata['Stream']['Audio'] = [];
$this->metadata['Stream']['SubTitle'] = [];
if(isset($array['Video']['Media']['Part']['Stream'])) {
foreach ($array['Video']['Media']['Part']['Stream'] as $stream) {
if($stream['@attributes']['streamType'] === '1')
$this->metadata['Stream']['Video'][] = $stream['@attributes'];
else if($stream['@attributes']['streamType'] === '2')
$this->metadata['Stream']['Audio'][] = $stream['@attributes'];
else if($stream['@attributes']['streamType'] === '3')
$this->metadata['Stream']['SubTitle'][] = $stream['@attributes'];
}
}
Cache::set($this->id . '.metadata', $this->metadata);
return $this->metadata;
} catch (Exception $exception) {
throw new FuelException($exception->getMessage(),$exception->getCode());
}
}
@ -208,7 +230,7 @@ class Model_Movie extends Model_Overwrite
return ($hours > 0 ? $hours . ' h ' : '') . $minutes . ' min';
}
public function getDuractionMovie()
public function getDurationMovie()
{
$init = $this->duration;
@ -225,7 +247,7 @@ class Model_Movie extends Model_Overwrite
if (!$this->_server)
$this->getServer();
$curl = Request::forge('http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : '') . '/video/:/transcode/universal/start?identifier=[PlexShare]&path=http%3A%2F%2F127.0.0.1%3A32400' . urlencode($this->plex_key) . '&mediaIndex=0&partIndex=0&protocol=hls&offset=0&fastSeek=1&directStream=0&directPlay=1&videoQuality=100&maxVideoBitrate=2294&subtitleSize=100&audioBoost=100&X-Plex-Platform=Chrome&X-Plex-Token=' . $this->_server->token, 'curl');
$curl = Request::forge('http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : '') . '/video/:/transcode/universal/start.m3u8?identifier=[PlexShare]&path=http%3A%2F%2F127.0.0.1%3A32400' . urlencode($this->plex_key) . '&mediaIndex=0&partIndex=0&protocol=hls&offset=0&fastSeek=1&directStream=0&directPlay=1&videoQuality=100&maxVideoBitrate=2294&subtitleSize=100&audioBoost=100&X-Plex-Platform=Chrome&X-Plex-Token=' . $this->_server->token, 'curl');
//$curl = Request::forge('http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : '') . '/video/:/transcode/universal/start?identifier=[PlexShare]&path=http%3A%2F%2F127.0.0.1%3A32400' . urlencode($this->plex_key) . '&mediaIndex=0&partIndex=0&protocol=hls&offset=0&fastSeek=1&directStream=0&directPlay=1&videoQuality=100&videoResolution=576x320&maxVideoBitrate=2294&subtitleSize=100&audioBoost=100&X-Plex-Platform=Chrome&X-Plex-Token=' . $this->_server->token, 'curl');
$curl->execute();
@ -245,8 +267,8 @@ class Model_Movie extends Model_Overwrite
$this->_session = $split[1];
return 'http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : '') . '/video/:/transcode/universal/session/' . $this->_session . '/base/index.m3u8';
}catch (Exception $exception) {
throw new FuelException('TOKEN MAYBE OUTDATED',$exception->getCode());
} catch (Exception $exception) {
throw new FuelException('Cannot connect to the server.<br/>The token must be outdated!',$exception->getCode());
}
}
@ -298,9 +320,9 @@ class Model_Movie extends Model_Overwrite
'summary' => $XMLmovie['@attributes']['summary'],
'rating' => isset($XMLmovie['@attributes']['rating']) ? $XMLmovie['@attributes']['rating'] : null,
'year' => isset($XMLmovie['@attributes']['year']) ? $XMLmovie['@attributes']['year'] : null,
'thumb' => $XMLmovie['@attributes']['thumb'],
'thumb' => isset($XMLmovie['@attributes']['thumb']) ? $XMLmovie['@attributes']['thumb'] : null,
'art' => isset($XMLmovie['@attributes']['art']) ? $XMLmovie['@attributes']['art'] : null,
'duration' => $XMLmovie['@attributes']['duration'],
'duration' => isset($XMLmovie['@attributes']['duration']) ? $XMLmovie['@attributes']['duration'] : null,
'originallyAvailableAt' => isset($XMLmovie['@attributes']['originallyAvailableAt']) ? $XMLmovie['@attributes']['originallyAvailableAt'] : null,
'addedAt' => $XMLmovie['@attributes']['addedAt'],
'updatedAt' => $XMLmovie['@attributes']['updatedAt']

@ -1,5 +1,7 @@
<?php
use Fuel\Core\FuelException;
class Model_Season extends Model_Overwrite
{
protected static $_table_name = 'season';
@ -102,32 +104,29 @@ class Model_Season extends Model_Overwrite
* @param $server
* @param $seasons
* @param $tvshow
* @return bool
* @throws Exception
* @return array
* @throws FuelException
* @throws HttpNotFoundException
* @throws \FuelException
*/
public static function BrowseSeason($server, $seasons, $tvshow)
{
try {
$season_id_array = [];
foreach ($seasons as $XMLseason) {
$XMLseason = !isset($seasons['@attributes']) ? $XMLseason : $seasons;
// Not browsing array ALL EPISODES
if($seasons[0] === $XMLseason)
if (isset($seasons[0]) && $seasons[0] === $XMLseason)
continue;
$tvshow_id = $tvshow->id;
$season = Model_Season::find(function ($query) use ($XMLseason, $tvshow_id){
$season = Model_Season::find(function ($query) use ($XMLseason, $tvshow_id) {
/** @var Database_Query_Builder_Select $query */
return $query
->select('*')
->where('plex_key', $XMLseason['@attributes']['key'])
->and_where('tv_show_id', $tvshow_id)
;
->and_where('tv_show_id', $tvshow_id);
})[0] ?: Model_Season::forge();
$season->set([
@ -135,26 +134,36 @@ class Model_Season extends Model_Overwrite
'plex_key' => $XMLseason['@attributes']['key'],
'number' => $XMLseason['@attributes']['index'],
'title' => $XMLseason['@attributes']['title'],
'thumb' => $XMLseason['@attributes']['thumb'],
'thumb' => isset($XMLseason['@attributes']['thumb']) ? $XMLseason['@attributes']['thumb'] : null,
'art' => isset($XMLseason['@attributes']['art']) ? $XMLseason['@attributes']['art'] : null,
'leafCount' => $XMLseason['@attributes']['leafCount'],
'leafCount' => isset($XMLseason['@attributes']['leafCount']) ? $XMLseason['@attributes']['leafCount'] : null,
'addedAt' => $XMLseason['@attributes']['addedAt'],
'updatedAt' => $XMLseason['@attributes']['updatedAt']
'updatedAt' => isset($XMLseason['@attributes']['updatedAt']) ? $XMLseason['@attributes']['updatedAt'] : null
]);
$season->save();
$season_id_array[] = ['id' => $season->id, 'name' => $season->title];
if(isset($seasons['@attributes']))
if (isset($seasons['@attributes']))
break;
}
return $season_id_array;
} catch (Exception $exception) {
throw new FuelException($exception->getMessage(),$exception->getCode());
}
}
/**
* @param $server
* @param $season
* @return array|bool
* @throws FuelException
*/
public static function getMovies($server, $season)
{
try {
$curl = Request::forge('http://' . $server->url . ($server->port ? ':' . $server->port : '') . $season->plex_key . '?X-Plex-Token=' . $server->token, 'curl');
$curl->execute();
@ -163,8 +172,11 @@ class Model_Season extends Model_Overwrite
$movies = Format::forge($curl->response()->body, 'xml')->to_array();
if(isset($movies['Video']))
if (isset($movies['Video']))
return ['movies' => Model_Movie::BrowseMovies($server, $movies['Video'], null, $season)];
} catch (Exception $exception) {
throw new FuelException($exception->getMessage(),$exception->getCode());
}
}
public function getEpisodes()

@ -53,10 +53,11 @@ class Model_Server extends Model_Overwrite
*/
public static function BrowseServeur($_servers = null)
{
$servers = $_servers ?: Model_Server::find();
$servers = $_servers ?: Model_Server::find_all();
foreach ($servers as $server) {
try{
if($server->disable)
continue;
@ -66,7 +67,7 @@ class Model_Server extends Model_Overwrite
$dataServer = Format::forge($curl->response()->body, 'xml')->to_array();
if (!isset($dataServer['@attributes'])) {
$server->set('online', 0);
$server->set(['online' => 0]);
$server->save();
}
@ -75,16 +76,19 @@ class Model_Server extends Model_Overwrite
$server->set(['lastcheck' => time()]);
($server->name !== $dataServer['friendlyName']) ? $server->set(['name' => $dataServer['friendlyName']]) : null;
($server->name !== $dataServer['platform']) ? $server->set(['plateforme' => $dataServer['platform']]) : null;
($server->name !== $dataServer['platformVersion']) ? $server->set(['platformVersion' => $dataServer['platformVersion']]) : null;
($server->name !== $dataServer['updatedAt']) ? $server->set(['updatedAt' => $dataServer['updatedAt']]) : null;
($server->name !== $dataServer['version']) ? $server->set(['version' => $dataServer['version']]) : null;
($server->plateforme !== $dataServer['platform']) ? $server->set(['plateforme' => $dataServer['platform']]) : null;
($server->platformVersion !== $dataServer['platformVersion']) ? $server->set(['platformVersion' => $dataServer['platformVersion']]) : null;
($server->updatedAt !== $dataServer['updatedAt']) ? $server->set(['updatedAt' => $dataServer['updatedAt']]) : null;
($server->version !== $dataServer['version']) ? $server->set(['version' => $dataServer['version']]) : null;
$server->set(['online' => 1]);
$server->save();
//Model_Library::BrowseLibraries($server);
}catch (Exception $exception) {
$server->set(['online' => 0]);
$server->save();
throw new FuelException($exception->getMessage(),$exception->getCode());
}
}
}

@ -1,6 +1,7 @@
<?php
use Fuel\Core\CacheNotFoundException;
use Fuel\Core\FuelException;
class Model_Tvshow extends Model_Overwrite
{
@ -132,12 +133,11 @@ class Model_Tvshow extends Model_Overwrite
* @param $library
* @return bool | array
* @throws Exception
* @throws HttpNotFoundException
* @throws \FuelException
* @throws FuelException
*/
public static function BrowseTvShow($server, $subsections, $library)
{
try {
$tvshows_id_array = [];
foreach ($subsections as $subsection) {
@ -145,13 +145,12 @@ class Model_Tvshow extends Model_Overwrite
$library_id = $library->id;
$tvshow = Model_Tvshow::find(function ($query) use ($subsection, $library_id){
$tvshow = Model_Tvshow::find(function ($query) use ($subsection, $library_id) {
/** @var Database_Query_Builder_Select $query */
return $query
->select('*')
->where('plex_key', $subsection['@attributes']['key'])
->and_where('library_id', $library_id)
;
->and_where('library_id', $library_id);
})[0] ?: Model_Tvshow::forge();
$tvshow->set([
@ -168,9 +167,9 @@ class Model_Tvshow extends Model_Overwrite
'banner' => isset($subsection['@attributes']['banner']) ? $subsection['@attributes']['banner'] : null,
'theme' => isset($subsection['@attributes']['theme']) ? $subsection['@attributes']['theme'] : null,
'originallyAvailableAt' => isset($subsection['@attributes']['originallyAvailableAt']) ? $subsection['@attributes']['originallyAvailableAt'] : null,
'leafCount' => $subsection['@attributes']['leafCount'],
'leafCount' => isset($subsection['@attributes']['leafCount']) ? $subsection['@attributes']['leafCount'] : null,
'addedAt' => $subsection['@attributes']['addedAt'],
'updatedAt' => $subsection['@attributes']['updatedAt']
'updatedAt' => isset($subsection['@attributes']['updatedAt']) ? $subsection['@attributes']['updatedAt'] : null
]);
$tvshow->save();
@ -179,15 +178,25 @@ class Model_Tvshow extends Model_Overwrite
//self::getTvShowSeasons($server, $tvshow);
if(isset($subsections['@attributes']))
if (isset($subsections['@attributes']))
break;
}
return $tvshows_id_array;
} catch (Exception $exception) {
throw new FuelException($exception->getMessage(),$exception->getCode());
}
}
/**
* @param $server
* @param $tvshow
* @return array|bool
* @throws FuelException
*/
public static function getTvShowSeasons($server, $tvshow)
{
try {
$curl = Request::forge('http://' . $server->url . ($server->port ? ':' . $server->port : '') . $tvshow->plex_key . '?X-Plex-Token=' . $server->token, 'curl');
$curl->execute();
@ -196,14 +205,24 @@ class Model_Tvshow extends Model_Overwrite
$seasons = Format::forge($curl->response()->body, 'xml')->to_array();
if(isset($seasons['Directory']))
if (isset($seasons['Directory']))
return Model_Season::BrowseSeason($server, $seasons['Directory'], $tvshow);
} catch (Exception $exception) {
throw new FuelException($exception->getMessage(),$exception->getCode());
}
}
public function getSeasons()
{
if(!$this->_seasons)
$this->_seasons = Model_Season::find_by('tv_show_id', $this->id);
if(!$this->_seasons) {
$id = $this->id;
$this->_seasons = Model_Season::find_by(function ($query) use ($id) {
$query
->where('tv_show_id', $id)
->order_by('number', 'ASC')
;
});
}
return $this->_seasons;
}

@ -38,10 +38,11 @@ class Model_User extends Model_Overwrite
{
$result = self::find_one_by(function ($query) use ($login,$password){
return $query
->where('user.password', $password)
->where('password', $password)
->and_where('parent_id', null)
->and_where_open()
->where('user.email', $login)
->or_where('user.username', $login)
->where('email', $login)
->or_where('username', $login)
->and_where_close()
;
});
@ -51,4 +52,22 @@ class Model_User extends Model_Overwrite
else
return false;
}
public function getLastLogin()
{
$dateString = date('Y/m/d H:i:s', time());
$now = new DateTime($dateString);
$dateString = date('Y-m-d H:i:s', $this->lastlogin);
$time = new DateTime($dateString);
$diff = date_diff($now, $time);
$days = $diff->days . 'd ';
$hours = $diff->h . 'h ';
$minutes = $diff->i . 'min ';
$seconds = $diff->s . 's';
return $days.$hours.$minutes.$seconds;
}
}

@ -43,7 +43,7 @@ return array(
*/
// 'index_file' => false,
// 'profiling' => false,
'profiling' => true,
/**
* Default location for the file cache
@ -188,7 +188,7 @@ return array(
/**
* Cookie settings
*/
// 'cookie' => array(
'cookie' => array(
// Number of seconds before the cookie expires
// 'expiration' => 0,
// Restrict the path that the cookie is available to
@ -196,10 +196,10 @@ return array(
// Restrict the domain that the cookie is available to
// 'domain' => null,
// Only transmit cookies over secure connections
// 'secure' => false,
// 'secure' => true,
// Only transmit cookies over HTTP, disabling Javascript access
// 'http_only' => false,
// ),
// 'http_only' => true,
),
/**
* Validation settings

@ -44,7 +44,7 @@ return array(
'cookie_path' => '/',
// cookie http_only flag (optional, default = use the cookie class default)
'cookie_http_only' => true,
'cookie_http_only' => null,
// whether or not to encrypt the session cookie (optional, default is true)
'encrypt_cookie' => true,
@ -85,19 +85,19 @@ return array(
// special configuration settings for cookie based sessions
'cookie' => array(
'cookie_name' => 'plexshare_ccn', // name of the session cookie for cookie based sessions
'cookie_name' => 'plexshare_cid', // name of the session cookie for cookie based sessions
),
// specific configuration settings for file based sessions
'file' => array(
'cookie_name' => 'plexshare_fcn', // name of the session cookie for file based sessions
'cookie_name' => 'plexshare_fid', // name of the session cookie for file based sessions
'path' => '/tmp', // path where the session files should be stored
'gc_probability' => 5, // probability % (between 0 and 100) for garbage collection
),
// specific configuration settings for memcached based sessions
'memcached' => array(
'cookie_name' => 'plexshare_mcn', // name of the session cookie for memcached based sessions
'cookie_name' => 'plexshare_mid', // name of the session cookie for memcached based sessions
'servers' => array( // array of servers and portnumbers that run the memcached service
'default' => array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
),
@ -105,7 +105,7 @@ return array(
// specific configuration settings for database based sessions
'db' => array(
'cookie_name' => 'plexshare_dcn', // name of the session cookie for database based sessions
'cookie_name' => 'plexshare_did', // name of the session cookie for database based sessions
'database' => null, // name of the database name (as configured in config/db.php)
'table' => 'sessions', // name of the sessions table
'gc_probability' => 5, // probability % (between 0 and 100) for garbage collection
@ -113,7 +113,7 @@ return array(
// specific configuration settings for redis based sessions
'redis' => array(
'cookie_name' => 'plexshare_rcn', // name of the session cookie for redis based sessions
'cookie_name' => 'plexshare_rid', // name of the session cookie for redis based sessions
'database' => 'default', // name of the redis database to use (as configured in config/db.php)
),
);

@ -0,0 +1,133 @@
<?php
namespace Fuel\Tasks;
use Exception;
use Fuel\Core\FuelException;
use Model_Library;
use Model_Season;
use Model_Server;
use Model_Tvshow;
use function time;
use Fuel\Core\Request;
use function var_dump;
class Server
{
public function run($message = 'Hello!')
{
echo $message;
}
public function ping()
{
$servers = Model_Server::find();
foreach ($servers as $server) {
try {
$curl = Request::forge('http://' . $server->url . ($server->port ? ':' . $server->port : '') . '?X-Plex-Token=' . $server->token, 'curl');
$curl->execute();
if ($curl->response()->status !== 200)
throw new FuelException('No session found!');
$server->set([
'lastcheck' => time(),
'online' => 1
]);
$server->save();
} catch (Exception $exception) {
$server->set([
'lastcheck' => time(),
'online' => 0
]);
$server->save();
}
}
}
public function browseServers()
{
$time = ini_get('max_execution_time');
$servers = Model_Server::find_all();
if($time > 0 && $time < ($servers * 5 * 60)) {
ini_set('max_execution_time', 5 * $servers);
}
foreach ($servers as $server) {
try {
Model_Server::BrowseServeur([$server]);
} catch (Exception $exception) {
echo 'Server: ' . $server->name . ' ERROR: ' . $exception->getMessage() . "\n\r";
}
try {
$this->browseLibraries($server);
} catch (Exception $exception) {
}
}
}
private function browseLibraries($server)
{
Model_Library::BrowseLibraries($server);
$this->browseSubContent($server);
}
private function browseSubContent($server)
{
$libraries = Model_Library::find_by('server_id',$server->id);
foreach ($libraries as $library) {
Model_Library::getSectionsContent($server, $library);
}
$this->browseSeasons($server);
}
private function browseSeasons($server)
{
$server_id = $server->id;
$tv_shows = Model_Tvshow::find(function ($query) use ($server_id) {
$query
->select('tvshow.*')
->join('library')
->on('tvshow.library_id', '=', 'library.id')
->where('library.server_id', $server_id)
;
});
foreach ($tv_shows as $tv_show) {
Model_Tvshow::getTvShowSeasons($server,$tv_show);
}
$this->browseMovies($server);
}
private function browseMovies($server)
{
$server_id = $server->id;
$seasons = Model_Season::find(function ($query) use ($server_id) {
$query
->select('season.*')
->join('tvshow')
->on('season.tv_show_id', '=', 'tvshow.id')
->join('library')
->on('tvshow.library_id', '=', 'library.id')
->where('library.server_id', $server_id)
;
});
foreach ($seasons as $season) {
Model_Season::getMovies($server,$season);
}
}
}

@ -0,0 +1,51 @@
<head>
<title>PlexShare :: Administration</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="apple-mobile-web-app-capable" content="yes">
<?php
echo \Asset::css(['normalize.css', 'plex.css', 'settings.css']);
echo \Asset::js('jquery.min.js');
?>
<link rel="shortcut icon"
href="//assets.plex.tv/deploys/desktop/env-eb2798cc3c7d9533df5b563963d5c394/3.34.1-b51c37a/favicon.ico">
</head>
<body>
<div id="plex" class="application">
<?php echo \View::forge('layout/nav_bar_header', ['user' => $user]); ?>
<div class="background-container">
<div data-reactroot="" class="FullPage-container-17Y0c">
<div>
<div>
<div style="background-image: url('//assets.plex.tv/deploys/desktop/env-eb2798cc3c7d9533df5b563963d5c394/3.41.1-304f788/common/img/backgrounds/preset-dark.64cc1c942221cd2c153244bd8ecfb67a.png'); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;"
class=""></div>
</div>
<div style="position: absolute; width: 100%; height: 100%; background: rgba(0, 0, 0, 0) url('//assets.plex.tv/deploys/desktop/env-eb2798cc3c7d9533df5b563963d5c394/3.41.1-304f788/common/img/backgrounds/noise.8b05ce45d0df59343e206bc9ae78d85d.png') repeat scroll 0% 0%; z-index: 2;"></div>
</div></div>
</div>
<div id="content" class="scroll-container dark-scrollbar">
<div class="container">
<ul class="nav nav-header pull-right">
<li class="web-nav-item"><a class="web-btn btn-gray" href="/admin">General</a></li>
<li class="server-nav-item "><a class="server-btn btn-gray" href="/admin/servers">All Servers<span class="badge">0</span></a></li>
<li class="users-nav-item "><a class="users-btn btn-gray" href="/admin/libraries">All Libraries<span class="badge">0</span></a></li>
<li class="devices-nav-item "><a class="devices-btn btn-gray" href="/admin/users">Users</a></li>
</ul>
<h2>Administration</h2>
<?php echo $body; ?>
</div>
</div>
<div>
</div>
</div>
<?php
echo \Asset::js(isset($js_bottom) ? $js_bottom : null);
echo \Asset::js(['bootstrap.min.js']);
?>
<script>
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip({ container: 'body'});
});
</script>
</body>
</html>

@ -0,0 +1,83 @@
<div class="settings-container">
<div class="web-settings-container show-advanced">
<div class="filter-bar"></div>
<div class="row">
<div class="col-sm-4 col-md-3">
<ul class="settings-nav nav nav-cards">
<li><a class="card btn-gray selected" href="#general-web-group">General</a></li>
<li><a class="card btn-gray" href="#quality-web-group">Sub Account</a></li>
<li><a class="card btn-gray" href="#player-web-group">Player</a></li>
</ul>
</div>
<div class="col-sm-8 col-md-9">
<form id="web-settings-form">
<div id="general-web-group" class="settings-group active">
<h4 class="version-title"> Version 0.1A </h4>
<div class="form-group">
<label for="language">Language</label>
<select id="language">
<option value="en" selected=""> English</option>
<option value="fr"> Français</option>
</select>
<p class="help-block">
Aidez-nous à traduire cette application dans votre langue <a href="https://transifex.com/plex-1/plex-web" target="_blank">ici</a>.
</p>
</div>
<div class="form-group">
<label class="control-label" for="input_FriendlyName_c">
Second refresh
</label>
<input id="input_FriendlyName_c" class="form-control" name="refresh" value="" placeholder="ex: 800" type="text">
<p class="help-block">Number in second, you want to check new content on server.</p>
</div>
</div>
<div id="player-web-group" class="settings-group"><h4 class="settings-header-first ">Audio &amp;
sous-titres</h4>
<div class="form-group advanced-setting"><label for="audioBoost">Augmenter le volume du son
multi-canal</label> <select id="audioBoost" data-type="int">
<option value="100" selected="">Aucun</option>
<option value="150">Petite</option>
<option value="200">Grande</option>
<option value="250">Énorme</option>
</select>
<p class="help-block">Augmente le volume si le son est converti de multi-canal à
stéréo.</p></div>
<div class="form-group"><label for="subtitleSize">Taille des sous-titres</label> <select
id="subtitleSize" data-type="int">
<option value="50">Minuscule</option>
<option value="75">Petite</option>
<option value="100" selected="">Normale</option>
<option value="125">Grande</option>
<option value="200">Énorme</option>
</select></div>
<div class="form-group advanced-setting"><label for="subtitlesBurnLevel">Incruster les
sous-titres</label> <select id="subtitlesBurnLevel">
<option value="auto" selected="">Automatique</option>
<option value="avoid">Seulement le format des images</option>
<option value="always">Toujours</option>
</select>
<p class="help-block">Détermine si le serveur doit incruster les sous-titres lors de
l'encodage, en fonction du format des sous-titres. Eviter l'incrustation des
sous-titres améliore les performances du serveur, mais n'est possible qu'avec le
lecteur HTML5.</p></div>
<h4 class="settings-header">Bonus</h4>
<div class="form-group"><label for="extrasPrefixCount">Bandes annonces de Cinema avant le
film</label> <select id="extrasPrefixCount" data-type="int">
<option value="0" selected="">Aucun</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select></div>
</div>
<div class="form-footer">
<button type="submit" class="submit-btn btn btn-lg btn-primary btn-loading disabled">
<div class="loading loading-sm"></div>
<span class="btn-label">Enregistrer les modifications</span></button>
<span class="form-message"></span></div>
</form>
</div>
</div>
</div>
</div>

@ -0,0 +1,172 @@
<div class="settings-container">
<div class="filter-bar">
<div class="filter-bar-right">
<button class="toggle-advanced-btn btn btn-sm btn-default refresh">Refresh Libraries &nbsp;<i class="glyphicon refresh"></i></button>
</div>
<span id="primary-server-dropdown" class="dropdown">
<a class="dropdown-toggle" href="#primary-server-dropdown" data-toggle="dropdown">
<span class="dropdown-friendly-name">HF-Server</span> <i class="caret-icon"></i>
</a>
<ul class="dropdown-menu">
<li>
<a data-id="df1de861fbaba243c18ed9275fd42e3248d19336" href="#">
<span class="dropdown-truncated-label">Chewbaka</span>
</a>
</li>
<li>
<a data-id="11f086036e179128e7b077495e238d1c922d605c" href="#">
<span class="dropdown-truncated-label">HF-Server</span>
<i class="dropdown-selected-icon glyphicon ok-2"></i>
</a>
</li>
</ul>
</span>
</div>
<div class="devices-container row">
<div class="device-list-container col-sm-12 col-md-12">
<ul class="list card-tile-list">
<?php if($libraries) : ?>
<?php foreach ($libraries as $library) : ?>
<li class="card-tile-list-item card-3-col-item">
<div class="card card-device <?php echo $library->disable ? 'disabled' : ''; ?>">
<div class="card-actions">
<a href="/settings/libraries/premissions/<?php echo $library->id; ?>">
<button class="permissions-library-btn card-action-btn" data-library-id="<?php echo $library->id; ?>"
data-toggle="tooltip" data-original-title="Permissions">
<i class="glyphicon unlock"></i>
</button>
</a>
<button class="refresh-library-btn card-action-btn btn-info" data-library-id="<?php echo $library->id; ?>"
data-toggle="tooltip" data-original-title="Refresh">
<i class="glyphicon refresh"></i>
</button>
<?php if($library->disable) : ?>
<button class="enable-library-btn card-action-btn btn-success" data-library-id="<?php echo $library->id; ?>"
data-toggle="tooltip" data-original-title="Enable">
<i class="glyphicon ok-2"></i>
</button>
<?php else: ?>
<button class="disable-library-btn card-action-btn btn-danger" data-library-id="<?php echo $library->id; ?>"
data-toggle="tooltip" data-original-title="Disable">
<i class="glyphicon ban"></i>
</button>
<?php endif; ?>
<button class="remove-library-btn card-action-btn btn-danger" data-library-id="<?php echo $library->id; ?>"
data-toggle="tooltip" data-original-title="Delete">
<i class="glyphicon remove-2"></i>
</button>
</div>
<h4 class="name">
<?php echo $library->name; ?>
<span class="glyphicon <?php echo $library->disable ? 'ban text-danger' : 'ok-2 text-success'; ?>" data-toggle="tooltip" data-original-title="<?php echo $library->disable ? 'Disabled' : 'Enabled'; ?>"></span>
</h4>
<div class="card-details">
<div class="pull-right">
<div class="last-seen text-muted"><i class="plex-icon-watch-later-560"></i> <?php echo $library->getLastUpdate(); ?></div>
<span class="sync-info hidden">
<span class="glyphicon circle-arrow-down sync-icon"></span>
<span class="sync-count">123</span> / <span class="sync-size">456</span>
</span>
</div>
<span class="version text-muted"><?php echo $library->type; ?></span>
<div class="device-info-container">
<div class="product"><?php echo $library->getServer()->name; ?></div>
<div class="device text-muted"></div>
<div class="platform-info text-muted">
<span class="platform">Linux</span>
<span class="platform-version">Debian 8</span>
</div>
</div>
</div>
</div>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$('.filter-bar .add').on('click', function () {
$.ajax({
method: 'get',
url: '/rest/settings/add_server.json'
}).done(function (data) {
$('body').append(data);
setTimeout(function(){
$('.media-server-modal').removeClass('out').addClass('in');
},100);
});
});
$(document).on('click', '.media-server-modal button.close', function () {
$('.media-server-modal').removeClass('in').addClass('out').delay(500).queue(function(){ $(this).remove()});
});
$(document).on('click', '#add-plex button', function () {
var url = $('#add-plex #url').val();
var port = $('#add-plex #port').val();
var token = $('#add-plex #token').val();
$.ajax({
method: 'post',
url: '/rest/settings/server.json',
data: {url: url, port: port, token: token}
}).done(function (data) {
show_alert('success', 'Server save succesfully!');
$('.media-server-modal button.close').click();
}).fail(function (data) {
data = JSON.parse(data.responseText);
show_alert('error', data.message);
setTimeout(function(){location.reload()}, 200);
});
});
// LIBRARY BUTTON ACTION
$('button.refresh-library-btn').on('click', function () {
var library_id = $(this).data('library-id');
ajax += 1;
checkAjax();
$.ajax({
method: 'get',
url: '/rest/browse/library.json',
data: {library_id: library_id}
}).done(function (library) {
var server = {};
server.id = library.server_id;
server.name = library.server_name;
updateLibrary(server, library);
ajax -= 1;
alert.toggleClass('transition-out');
alert_status.html('Start browsing your library');
});
});
$('button.disable-library-btn').on('click', function () {
var button = this;
var library_id = $(this).data('library-id');
$.ajax({
method: 'delete',
url: '/rest/settings/library.json',
data: {library_id: library_id}
}).done(function (data) {
show_alert('success', 'Library disable succesfully!');
$(button).closest('.card.card-device').addClass('disabled');
}).fail(function (data) {
data = JSON.parse(data.responseText);
show_alert('error', data.message);
});
});
// REFRESH ALL LIBRARIES
$('.filter-bar .refresh').on('click', function () {
ajax += 1;
checkAjax();
$.ajax({
method: 'get',
url: '/rest/browse/my_servers.json'
}).done(function (data) {
updateServers(data);
ajax -= 1;
alert.toggleClass('transition-out');
alert_status.html('Browse all your server is GOOD!');
});
});
});
</script>

@ -0,0 +1,164 @@
<div class="settings-container">
<div class="filter-bar">
<button class="toggle-advanced-btn btn btn-sm Button-primary-2LQVw pull-left add"
data-placement="top" data-toggle="tooltip" data-original-title="Add server"><i class="glyphicon circle-plus"></i></button>
<button class="toggle-advanced-btn btn btn-sm btn-default pull-right refresh">Refresh Servers &nbsp;<i class="glyphicon refresh"></i></button>
</div>
<div class="devices-container row">
<div class="device-list-container col-sm-12 col-md-12">
<ul class="list card-tile-list">
<?php if($servers) : ?>
<?php foreach ($servers as $server) : ?>
<li class="card-tile-list-item card-2-col-item">
<div class="card card-device">
<img class="card-poster device-icon" src="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTEwIDExMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGZpbGw9IiNlNWEwMGQiIGQ9Im0wIDBoMTEwdjExMGgtMTEweiIvPjxwYXRoIGQ9Im0zMCA2MGMxNi41NjkgMCAzMC0xMy40MzEgMzAtMzAgMC0xNi41NjktMTMuNDMxLTMwLTMwLTMwLTE2LjU2OSAwLTMwIDEzLjQzMS0zMCAzMCAwIDE2LjU2OSAxMy40MzEgMzAgMzAgMzBtLS41NzEtNDguNzJsMTIuMTQ5IDE4Ljc0OS0xMi4xNSAxOC43NWgtNS41MDQtNS41MDR2LS4wMDRsMTIuMTQ3LTE4Ljc0Ni0xMi4xNDctMTguNzQ2di0uMDAyaDExLjAxIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNSAyNSkiIGZpbGw9IiMxZjFmMWYiLz48L2c+PC9zdmc+">
<div class="card-actions">
<button class="refresh-server-btn card-action-btn btn-info" data-server-id="<?php echo $server->id; ?>"
data-placement="top" data-toggle="tooltip" data-original-title="Refresh">
<i class="glyphicon refresh"></i>
</button>
<button class="edit-server-btn card-action-btn" data-server-id="<?php echo $server->id; ?>"
data-placement="top" data-toggle="tooltip" data-original-title="Edit">
<i class="glyphicon pencil"></i>
</button>
<button class="disable-server-btn card-action-btn btn-danger" data-server-id="<?php echo $server->id; ?>"
data-placement="top" data-toggle="tooltip" data-original-title="Disable">
<i class="glyphicon ban"></i>
</button>
<button class="remove-server-btn card-action-btn btn-danger" data-server-id="<?php echo $server->id; ?>"
data-placement="top" data-toggle="tooltip" data-original-title="Delete">
<i class="glyphicon remove-2"></i>
</button>
</div>
<h4 class="name"><?php echo $server->name; ?> <span data-placement="top" data-toggle="tooltip" data-original-title="<?php echo $server->online ? 'online' : 'offline' ; ?>" class="glyphicon <?php echo $server->online ? 'server text-success' : 'server-ban text-danger' ; ?>"></span></h4>
<div class="card-details">
<div class="pull-right">
<div class="last-seen text-muted"><i class="plex-icon-watch-later-560"></i> <?php echo $server->getLastCheck(); ?></div>
<span class="sync-info hidden">
<span class="glyphicon circle-arrow-down sync-icon"></span>
<span class="sync-count">123</span> / <span class="sync-size">456</span>
</span>
</div>
<span class="version text-muted"><?php echo $server->version; ?></span>
<div class="device-info-container">
<div class="product">Plex Media Server</div>
<div class="device text-muted"></div>
<div class="platform-info text-muted">
<span class="platform"><?php echo $server->plateforme; ?></span>
<span class="platform-version"><?php echo $server->platformVersion; ?></span>
</div>
</div>
</div>
</div>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$('.filter-bar .add').on('click', function () {
$.ajax({
method: 'get',
url: '/rest/settings/modal_server.json'
}).done(function (data) {
$('body').append(data);
setTimeout(function(){
$('.media-server-modal').removeClass('out').addClass('in');
},100);
});
});
$(document).on('click', '.media-server-modal button.close', function () {
$('.media-server-modal').removeClass('in').addClass('out').delay(500).queue(function(){ $(this).remove()});
});
// ADD OR EDIT SERVER
$(document).on('click', '#add-plex button', function () {
var server_id = $('#add-plex #server_id').val();
var url = $('#add-plex #url').val();
var port = $('#add-plex #port').val();
var token = $('#add-plex #token').val();
$.ajax({
method: 'post',
url: '/rest/settings/server.json',
data: {server_id: server_id, url: url, port: port, token: token}
}).done(function (data) {
show_alert('success', 'Server save succesfully!');
$('.media-server-modal button.close').click();
}).fail(function (data) {
data = JSON.parse(data.responseText);
show_alert('error', data.message);
setTimeout(function(){location.reload()}, 200);
});
});
// SERVER BUTTON ACTION
$('button.refresh-server-btn').on('click', function () {
var server_id = $(this).data('server-id');
ajax += 1;
checkAjax();
$.ajax({
method: 'get',
url: '/rest/browse/server.json',
data: {server_id: server_id}
}).done(function (data) {
updateServers(data);
ajax -= 1;
alert.toggleClass('transition-out');
alert_status.html('Browse all your server is GOOD!');
});
});
$('button.edit-server-btn').on('click', function () {
var server_id = $(this).data('server-id');
$.ajax({
method: 'get',
url: '/rest/settings/modal_server.json'
}).done(function (modal) {
$.ajax({
method: 'get',
url: '/rest/browse/server.json',
data: {server_id: server_id}
}).done(function (server) {
$('body').append(modal);
setTimeout(function(){
$('#add-plex #server_id').val(server[0].id);
$('#add-plex #url').val(server[0].url);
$('#add-plex #port').val(server[0].port);
$('#add-plex #token').val(server[0].token);
$('.media-server-modal').removeClass('out').addClass('in');
},100);
});
});
});
$('button.disable-server-btn').on('click', function () {
var button = this;
var server_id = $(this).data('server-id');
$.ajax({
method: 'delete',
url: '/rest/settings/server.json',
data: {server_id: server_id}
}).done(function (data) {
show_alert('success', 'Server disable succesfully!');
$(button).closest('li').get(0).remove();
}).fail(function (data) {
data = JSON.parse(data.responseText);
show_alert('error', data.message);
});
});
// REFRESH ALL SERVER
$('.filter-bar .refresh').on('click', function () {
ajax += 1;
checkAjax();
$.ajax({
method: 'get',
url: '/rest/browse/my_servers.json'
}).done(function (data) {
updateServers(data);
ajax -= 1;
alert.toggleClass('transition-out');
alert_status.html('Browse all your server is GOOD!');
});
});
});
</script>

@ -0,0 +1,125 @@
<div class="settings-container">
<div class="filter-bar">
</div>
<div class="devices-container row">
<div class="device-list-container col-sm-12 col-md-12">
<ul class="list card-tile-list">
<?php if($users) : ?>
<?php foreach ($users as $user) : ?>
<li class="card-tile-list-item card-3-col-item">
<div class="card card-device <?php echo $user->disable ? 'disabled' : ''; ?>">
<div class="card-actions">
<a href="/settings/users/premissions/<?php echo $user->id; ?>">
<button class="permissions-user-btn card-action-btn" data-library-id="<?php echo $user->id; ?>"
data-toggle="tooltip" data-original-title="Permissions">
<i class="glyphicon unlock"></i>
</button>
</a>
<?php if($user->disable) : ?>
<button class="enable-user-btn card-action-btn btn-success" data-library-id="<?php echo $user->id; ?>"
data-toggle="tooltip" data-original-title="Enable">
<i class="glyphicon ok-2"></i>
</button>
<?php else: ?>
<button class="disable-user-btn card-action-btn btn-danger" data-library-id="<?php echo $user->id; ?>"
data-toggle="tooltip" data-original-title="Disable">
<i class="glyphicon ban"></i>
</button>
<?php endif; ?>
<button class="remove-user-btn card-action-btn btn-danger" data-library-id="<?php echo $user->id; ?>"
data-toggle="tooltip" data-original-title="Delete">
<i class="glyphicon remove-2"></i>
</button>
</div>
<h4 class="name">
<?php echo $user->username; ?>
<span class="glyphicon <?php echo $user->disable ? 'ban text-danger' : 'ok-2 text-success'; ?>" data-toggle="tooltip" data-original-title="<?php echo $user->disable ? 'Disabled' : 'Enabled'; ?>"></span>
</h4>
<div class="card-details">
<div class="pull-right">
<div class="last-seen text-muted" data-toggle="tooltip" data-original-title="Last login">
<i class="plex-icon-watch-later-560"></i> <?php echo $user->getLastLogin(); ?>
</div>
</div>
<span class="version text-muted"><?php echo $user->email; ?></span>
<div class="device-info-container">
<div class="product"><?php echo $user->admin ? 'Admin' : 'User'; ?></div>
</div>
</div>
</div>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$('.filter-bar .add').on('click', function () {
$.ajax({
method: 'get',
url: '/rest/settings/add_server.json'
}).done(function (data) {
$('body').append(data);
setTimeout(function(){
$('.media-server-modal').removeClass('out').addClass('in');
},100);
});
});
$(document).on('click', '.media-server-modal button.close', function () {
$('.media-server-modal').removeClass('in').addClass('out').delay(500).queue(function(){ $(this).remove()});
});
$(document).on('click', '#add-plex button', function () {
var url = $('#add-plex #url').val();
var port = $('#add-plex #port').val();
var token = $('#add-plex #token').val();
$.ajax({
method: 'post',
url: '/rest/settings/server.json',
data: {url: url, port: port, token: token}
}).done(function (data) {
show_alert('success', 'Server save succesfully!');
$('.media-server-modal button.close').click();
}).fail(function (data) {
data = JSON.parse(data.responseText);
show_alert('error', data.message);
setTimeout(function(){location.reload()}, 200);
});
});
// LIBRARY BUTTON ACTION
$('button.refresh-library-btn').on('click', function () {
var library_id = $(this).data('library-id');
ajax += 1;
checkAjax();
$.ajax({
method: 'get',
url: '/rest/browse/library.json',
data: {library_id: library_id}
}).done(function (library) {
var server = {};
server.id = library.server_id;
server.name = library.server_name;
updateLibrary(server, library);
ajax -= 1;
alert.toggleClass('transition-out');
alert_status.html('Start browsing your library');
});
});
$('button.disable-library-btn').on('click', function () {
var button = this;
var library_id = $(this).data('library-id');
$.ajax({
method: 'delete',
url: '/rest/settings/library.json',
data: {library_id: library_id}
}).done(function (data) {
show_alert('success', 'Library disable succesfully!');
$(button).closest('.card.card-device').addClass('disabled');
}).fail(function (data) {
data = JSON.parse(data.responseText);
show_alert('error', data.message);
});
});
});
</script>

@ -15,14 +15,15 @@
<div class="PageHeaderRight-pageHeaderRight-2CT0g">
<div class="pageHeaderToolbar-toolbarContainer-2N-IJ Measure-container-2XznZ">
<div class="pageHeaderToolbar-toolbar-1lW-M">
<button id="id-239" data-original-title="Lire" data-toggle="tooltip" role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO "
type="button"><i class="plex-icon-toolbar-play-560"
aria-hidden="true"></i></button>
<button id="id-238" data-original-title="Plus..." aria-haspopup="true" data-toggle="tooltip" role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO "
type="button"><i class="plex-icon-toolbar-more-560"
aria-hidden="true"></i></button>
<button id="id-16" data-original-title="Lire" data-toggle="tooltip" data-placement="bottom" role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
type="button"><i class="plex-icon-toolbar-play-560" aria-hidden="true"></i>
</button>
<button id="id-15" data-original-title="Plus..." aria-haspopup="true" data-placement="bottom" data-toggle="tooltip"
role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
type="button"><i class="plex-icon-toolbar-more-560" aria-hidden="true"></i>
</button>
</div>
<div class="Measure-scrollContainer-3vb4J">
<div class="Measure-expandContent-1JQfL"></div>
@ -213,7 +214,7 @@
<button aria-haspopup="true" role="button"
class="CollapsibleText-readMore-1bRJm DisclosureArrowButton-disclosureArrowButton-3tbYZ DisclosureArrowButton-medium-3-Y37 Link-link-2XYrU Link-default-32xSO"
type="button">Show more
<div class="CollapsibleText-readMoreArrow-34BdB DisclosureArrowButton-disclosureArrow-34Wg3 DisclosureArrow-disclosureArrow-1sBFv DisclosureArrowButton-down-bd2wx DisclosureArrowButton-medium-3-Y37 DisclosureArrow-down-1U7WW DisclosureArrow-up-rjGpc DisclosureArrow-default-3_FCW DisclosureArrow-medium-3VjTd "></div>
<div class="CollapsibleText-readMoreArrow-34BdB DisclosureArrow-disclosureArrow-1sBFv DisclosureArrowButton-down-bd2wx DisclosureArrowButton-medium-3-Y37 DisclosureArrow-down-1U7WW DisclosureArrow-up-rjGpc DisclosureArrow-default-3_FCW DisclosureArrow-medium-3VjTd "></div>
</button>
</div>
</div>
@ -238,6 +239,18 @@
</div>
<script type="text/javascript">
$(window).on('load', function() {
/** READ MORE **/
$(document).on('click', '.CollapsibleText-readMore-1bRJm', function (event) {
var summary = $(document).find('.CollapsibleText-contentTransition-15VYv');
if(summary.css('max-height') === '78px') {
$(this).find('div').removeClass('DisclosureArrow-down-1U7WW').addClass('DisclosureArrow-up-1U7WW');
summary.css('max-height', '10000px');
} else {
$(this).find('div').removeClass('DisclosureArrow-up-1U7WW').addClass('DisclosureArrow-down-1U7WW');
summary.css('max-height', '78px');
}
});
$(document).on('click', '.MetadataPosterCardOverlay-playButton-1fjhk.PlayButton-playButton-3WX8X', function (event) {
event.stopPropagation();
var movie_id = $(this).data('id');

@ -1,3 +1,13 @@
<div class="PageHeader-pageHeader-18RSw">
<div class="PageHeaderLeft-pageHeaderLeft-2TxSo"><span>Découvrir<span
class="PageHeaderSeparator-pageHeaderSeparator-221fi DashSeparator-separator-2a3yn">—</span></span>
<button aria-haspopup="true" data-qa-id="directoriesMenuButton" id="id-1976" role="button"
class="PageHeaderBreadcrumbButton-button-1uaPj DisclosureArrowButton-disclosureArrowButton-3tbYZ DisclosureArrowButton-medium-3-Y37 DisclosureArrowButton-isSelected-oswRN Link-link-2XYrU Link-default-32xSO Link-isSelected-3GpAs"
type="button">Toutes les bibliothèques
<div class="DisclosureArrowButton-disclosureArrow-34Wg3 DisclosureArrow-disclosureArrow-1sBFv DisclosureArrowButton-down-bd2wx DisclosureArrowButton-medium-3-Y37 DisclosureArrow-down-1U7WW DisclosureArrow-up-rjGpc DisclosureArrow-default-3_FCW DisclosureArrow-medium-3VjTd DisclosureArrow-isSelected-VMAVr"></div>
</button>
</div>
</div>
<div class="PageContent-pageContent-16mK6 Scroller-scroller-d5-b- Scroller-vertical-1bgGS ">
<div class="DashboardPage-dashboardPageContent-2rN8X PageContent-innerPageContent-3ktLT">
<div style="opacity: 1; pointer-events: auto;">
@ -23,9 +33,10 @@
</div>
<div style="height: 275px; overflow: hidden;">
<div class="Measure-container-2XznZ">
<div id="tv_show_list" class="VirtualListScroller-scroller-37EU_ Scroller-scroller-d5-b- Scroller-horizontal-1k8ET ">
<div id="tv_show_list"
class="VirtualListScroller-scroller-37EU_ Scroller-scroller-d5-b- Scroller-horizontal-1k8ET ">
<div class=" " style="width: 4540px; height: 275px;">
<?php if($episodes) : ?>
<?php if ($episodes) : ?>
<?php
$translate = -150;
foreach ($episodes as $episode) :
@ -36,7 +47,8 @@
<div class="MetadataPosterCard-card-3bztR "
style="width: 127px; height: 191px;">
<div class="MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG ">
<div class="PosterCardImg-imageContainer-1Ar4M" data-movie-id="<?php echo $episode->id; ?>">
<div class="PosterCardImg-imageContainer-1Ar4M"
data-movie-id="<?php echo $episode->id; ?>">
<div style="background-image: url(); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;"
class=""></div>
</div>
@ -45,7 +57,7 @@
<div class="MetadataPosterCardOverlay-unwatchedTagContainer-1lcEn">
<div class="MetadataPosterCardOverlay-unwatchedBadge-Qn1fv MetadataPosterCardOverlay-badge-1FU-p"><?php echo $episode->count > 1 ? $episode->count : ''; ?></div>
</div>
<?php if($episode->count > 1) : ?>
<?php if ($episode->count > 1) : ?>
<a href="/season/<?php echo $episode->getSeason()->id; ?>"
<?php else: ?>
<a href="/episode/<?php echo $episode->id; ?>"
@ -91,7 +103,7 @@
class=" MetadataPosterTitle-title-3tU5F Link-link-2XYrU Link-default-32xSO">
<?php echo $episode->getTvShow()->title; ?>
</a>
<?php if(1 == $episode->count) : ?>
<?php if (1 == $episode->count) : ?>
<a title="<?php echo $episode->title; ?>"
href="/episode/<?php echo $episode->id; ?>"
role="link"
@ -107,7 +119,7 @@
<?php echo 1 == $episode->count ? 'S' : 'Saison'; ?>
<?php echo $episode->getSeason()->number; ?>
</a>
<?php if(1 == $episode->count) : ?>
<?php if (1 == $episode->count) : ?>
<span class="DashSeparator-separator-2a3yn">·</span>
<a title="<?php echo $episode->title; ?>"
href="/episode/<?php echo $episode->id; ?>"
@ -152,9 +164,10 @@
</div>
<div style="height: 255px; overflow: hidden;">
<div class="Measure-container-2XznZ">
<div id="movies_list" class="VirtualListScroller-scroller-37EU_ Scroller-scroller-d5-b- Scroller-horizontal-1k8ET ">
<div id="movies_list"
class="VirtualListScroller-scroller-37EU_ Scroller-scroller-d5-b- Scroller-horizontal-1k8ET ">
<div class=" " style="width: 4540px; height: 255px;">
<?php if($movies) : ?>
<?php if ($movies) : ?>
<?php
$translate = -150;
foreach ($movies as $movie) :
@ -165,7 +178,8 @@
<div class="MetadataPosterCard-card-3bztR "
style="width: 127px; height: 191px;">
<div class="MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG ">
<div class="PosterCardImg-imageContainer-1Ar4M" data-movie-id="<?php echo $movie->id; ?>">
<div class="PosterCardImg-imageContainer-1Ar4M"
data-movie-id="<?php echo $movie->id; ?>">
<div style="background-image: url(); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;"
class=""></div>
</div>
@ -209,7 +223,8 @@
</div>
</div>
<div class="MetadataPosterCell-titleContainer-24DI6">
<a title="<?php echo $movie->title; ?>" href="/movie/<?php echo $movie->id; ?>" role="link"
<a title="<?php echo $movie->title; ?>"
href="/movie/<?php echo $movie->id; ?>" role="link"
class="MetadataPosterTitle-title-3tU5F Link-link-2XYrU Link-default-32xSO"><?php echo $movie->title; ?>
</a>
<span class="MetadataPosterTitle-title-3tU5F MetadataPosterTitle-isSecondary-2VUxY"><?php echo $movie->year; ?></span>
@ -232,11 +247,11 @@
</div>
</div>
<script type="text/javascript">
$(window).on('load', function() {
$(window).on('load', function () {
/** LAUNCH PLAYER **/
$(document).on('click', '.MetadataPosterCardOverlay-playButton-1fjhk.PlayButton-playButton-3WX8X', function (event) {
var movie_id = $(this).data('id');
if(movie_id === '')
if (movie_id === '')
return;
event.stopPropagation();
@ -244,54 +259,54 @@ $(window).on('load', function() {
$.ajax({
url: '/rest/movie/stream',
method: 'GET',
data: { movie_id : movie_id },
data: {movie_id: movie_id},
dataType: 'html'
}).done(function(view) {
}).done(function (view) {
launchPlayer(view);
}).fail(function(data) {
}).fail(function (data) {
console.error(data);
});
});
/** LOADING PICTURE **/
$('.PosterCardImg-imageContainer-1Ar4M[data-movie-id]').each(function (index, element) {
var movie_id = $(element).data('movie-id');
$('[data-movie-id="' + movie_id + '"] > div').css('background-image', 'url("/cover/movie?movie_id='+ movie_id +'&width='+ 158 +'&height='+ 233 +'")');
$('[data-movie-id="' + movie_id + '"] > div').css('background-image', 'url("/cover/movie?movie_id=' + movie_id + '&width=' + 158 + '&height=' + 233 + '")');
});
/** SCROLL LIST TV SHOWS AND MOVIES **/
$('.HubCell-hubActions-28w1- button').on('click', function(){
$('.HubCell-hubActions-28w1- button').on('click', function () {
var parent = $(this).closest('div[data-qa-id]');
var select = $(parent).data('qa-id');
var previous = $(parent).find('button[data-hubcell-action="previous"]');
var next = $(parent).find('button[data-hubcell-action="next"]');
if($(this).data('hubcell-action') === 'previous') {
if ($(this).data('hubcell-action') === 'previous') {
$('#' + select + '_list').animate({scrollLeft: $('#' + select + '_list').scrollLeft() - 152 * 2}, 500);
setTimeout(function(){
if($('#' + select + '_list').scrollLeft() <= (150 * 19)) {
setTimeout(function () {
if ($('#' + select + '_list').scrollLeft() <= (150 * 19)) {
$(next).removeClass('isDisabled');
}
if($('#' + select + '_list').scrollLeft() === 0) {
if ($('#' + select + '_list').scrollLeft() === 0) {
$(previous).addClass('isDisabled');
}
}, 500);
}
if($(this).data('hubcell-action') === 'next') {
if ($(this).data('hubcell-action') === 'next') {
$('#' + select + '_list').animate({scrollLeft: $('#' + select + '_list').scrollLeft() + 152 * 2}, 500);
setTimeout(function(){
if($('#' + select + '_list').scrollLeft() > 0) {
setTimeout(function () {
if ($('#' + select + '_list').scrollLeft() > 0) {
$(previous).removeClass('isDisabled');
}
if($('#' + select + '_list').scrollLeft() >= (150 * 19)) {
if ($('#' + select + '_list').scrollLeft() >= (150 * 19)) {
$(next).addClass('isDisabled');
}
if($('#' + select + '_list').scrollLeft() === 0) {
if ($('#' + select + '_list').scrollLeft() === 0) {
$(next).addClass('isDisabled');
}
}, 500);
}
});
});
});
</script>

@ -15,7 +15,7 @@
<div id="content" class="scroll-container dark-scrollbar">
<div>
<div data-reactroot="" class="FullPage-container-3qanw">
<?php echo \View::forge('layout/nav_bar_vertical', ['libraries' => $libraries, 'server' => $server]); ?>
<?php echo \View::forge('layout/nav_bar_vertical', ['MenuLibraries' => $MenuLibraries, 'MenuServer' => $MenuServer]); ?>
<div class="Page-page-aq7i_ Scroller-scroller-d5-b- Scroller-none-1LyUO ">
<?php echo $body; ?>
</div>
@ -34,8 +34,8 @@
<div class="ServerMenu-serverMenuScroller-1nSX6 Menu-menuScroller-E0NwY Scroller-vertical-1bgGS Scroller-scroller-d5-b- Scroller-auto-3t4gM"
style="max-height: 300px;">
<div>
<?php foreach (Model_Server::find_all() as $_server) : ?>
<?php if($_server->id === $server->id) : ?>
<?php foreach (Model_Server::find(function ($query){$query->where('online',1)->and_where('disable',0);}) as $_server) : ?>
<?php if($_server->id === $MenuServer->id) : ?>
<a role="menuitem" href="#"
<?php else: ?>
<a role="menuitem" href="/home/<?php echo $_server->id; ?>"
@ -47,7 +47,7 @@
<div class="ServerMenuItem-serverMenuDetails-1-Rfq"></div>
</div>
<div class="ServerMenuItem-serverMenuIconContainer-2WtBG">
<?php if($_server->id === $server->id) : ?>
<?php if($_server->id === $MenuServer->id) : ?>
<i class="plex-icon-selected-560 ServerMenuItem-serverMenuIcon-2zKCW ServerMenuItem-selectedIcon-dhK05"
aria-hidden="false" aria-label="Sélectionné(e)"></i>
<?php endif; ?>
@ -63,16 +63,12 @@
</div>
</div>
<div id="divVideo" style="display: none">
<div id="movie_id" style="height: 100%"></div>
<div id="movie_stream" style="height: 100%"></div>
<div id="video_controls" class="AudioVideoPlayerView-container-kWiFs"></div>
</div>
<?php
echo \Asset::js(isset($js_bottom) ? $js_bottom : null);
echo \Asset::js(['bootstrap.min.js']);
?>
<script>
<script type="text/javascript">
$(function() {
$('[data-toggle="tooltip"]').tooltip({ container: 'body'});
$('[data-toggle="tooltip"]').tooltip({ container: 'body', template: '<div class="tooltip Tooltip-tooltipPortal-1IUlb"><div class="tooltip-arrow"></div><div class="tooltip-inner Tooltip-tooltip-2AL-W"></div></div>'});
$(document).on('click', '#id-3026', function (event) {
event.stopPropagation();
$(this).find('.DisclosureArrow-disclosureArrow-1sBFv').toggleClass('DisclosureArrow-up-1U7WW DisclosureArrow-down-1U7WW');
@ -85,4 +81,8 @@ echo \Asset::js(['bootstrap.min.js']);
});
});
</script>
<?php
echo \Asset::js(['bootstrap.min.js']);
echo \Asset::js(isset($js_bottom) ? $js_bottom : null);
?>
</body>

@ -1,5 +1,5 @@
<head>
<title>Plex</title>
<title>PlexShare 1.0 by Chewbaka</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="apple-mobile-web-app-capable" content="yes">

@ -4,8 +4,8 @@
<?php echo \View::forge('layout/body', [
'body' => isset($body) ? $body : null,
'user' => isset($user) ? $user : null,
'libraries' => isset($libraries) ? $libraries : null,
'server' => isset($server) ? $server : null,
'MenuLibraries' => isset($MenuLibraries) ? $MenuLibraries : null,
'MenuServer' => isset($MenuServer) ? $MenuServer : null,
'js_bottom' => isset($js_bottom) ? $js_bottom : null,
]); ?>
</html>

@ -19,8 +19,9 @@
</a>
</li>
<li>
<a class="settings-btn" href="/settings" title="" data-toggle="tooltip" data-placement="bottom" data-original-title="Settings">
<a class="settings-btn dropdown-poster-container" href="/settings" title="" data-toggle="tooltip" data-placement="bottom" data-original-title="Settings">
<i class="glyphicon settings"></i>
<span class="total-badge badge" style="position: absolute;top: 34px;left: 5px">0</span>
</a>
</li>
<li id="nav-dropdown" class="nav-dropdown dropdown">
@ -30,15 +31,15 @@
style="background-image: url(&quot;blob:https://app.plex.tv/3ebfa0a2-486e-45d0-8213-ec862f30e792&quot;);"></div>
<i class="caret-icon"></i>
</div>
<span class="total-badge badge hidden">0</span>
<span class="total-badge badge">0</span>
</a>
<ul class="dropdown-menu signed-in full-user">
<li class="signed-in-item dropdown-header username-header"><?php echo $user->username; ?></li>
<li class="signed-in-item"><a href="#!/account">Account</a></li>
<li class="signed-in-item"><a class="users-btn" href="#">Users <span class="invites-badge badge hidden">0</span></a></li>
<li class="divider"></li>
<?php if($user->admin) : ?>
<li class="signed-in-item full-user-item"><a class="admin-user-btn" href="#">Admin</a></li>
<li class="signed-in-item full-user-item"><a class="admin-user-btn" href="/admin">Admin <span class="badge">0</span></a></li>
<li class="signed-in-item"><a class="users-btn" href="/admin/users">Users <span class="media-count-badge badge">0</span></a></li>
<li class="divider"></li>
<li class="signed-in-item switch-user-item"><a class="switch-user-btn" href="#">Switch User...</a></li>
<?php endif; ?>

@ -5,7 +5,7 @@
<div class="SidebarMenuButton-sidebarMenuButtonContainer-3vW-e">
<span class="SidebarMenuButton-sidebarMenuTitle-2rcM8">
<span class="SidebarMenuButton-sidebarMenuPrimaryTitleContainer-15y7y">
<span class="SidebarMenuButton-sidebarMenuPrimaryTitle-3-46F"><?php echo isset($server) ? $server->name : null; ?></span>
<span class="SidebarMenuButton-sidebarMenuPrimaryTitle-3-46F"><?php echo isset($MenuServer) ? $MenuServer->name : null; ?></span>
<div class="DisclosureArrow-disclosureArrow-1sBFv DisclosureArrow-down-1U7WW DisclosureArrow-up-rjGpc DisclosureArrow-default-3_FCW DisclosureArrow-medium-3VjTd DisclosureArrow-isSelected-VMAVr"></div>
</span>
<span class="SidebarMenuButton-sidebarMenuSecondaryTitle-1oZlq"></span>
@ -39,8 +39,8 @@
role="header">
<div class="SidebarServerLibraries-librariesTitle-3iqmv">Libraries</div>
</div>
<?php if (isset($libraries)) : ?>
<?php foreach ($libraries as $library) : ?>
<?php if (isset($MenuLibraries)) : ?>
<?php foreach ($MenuLibraries as $library) : ?>
<div class="SidebarLibraryItem-libraryListItem-2cmmj SidebarListItem-sidebarListItem-3ijGg">
<a data-qa-id="sidebarLibraryItem--11"
href="/library/<?php echo $library->id; ?>"

@ -5,13 +5,21 @@
<div class="PageHeaderRight-pageHeaderRight-2CT0g">
<div class="pageHeaderToolbar-toolbarContainer-2N-IJ Measure-container-2XznZ">
<div class="pageHeaderToolbar-toolbar-1lW-M">
<button id="id-16" data-original-title="Lire" data-toggle="tooltip" role="button"
<button id="id-16" title="Lire" data-toggle="tooltip" data-placement="bottom" role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
type="button"><i class="plex-icon-toolbar-play-560" aria-hidden="true"></i></button>
<button id="id-15" data-original-title="Plus..." aria-haspopup="true" data-toggle="tooltip"
type="button"><i class="plex-icon-toolbar-play-560" aria-hidden="true"></i>
</button>
<button id="id-362" title="Visionner la bande annonce." data-placement="bottom" data-toggle="tooltip" role="button" class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO" type="button">
<i class="plex-icon-toolbar-play-trailer-560" aria-hidden="true"></i>
</button>
<button id="id-21" title="Marquer comme vu" data-placement="bottom" data-toggle="tooltip" role="button" class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO" type="button">
<i class="plex-icon-toolbar-played-toggle-560" aria-hidden="true"></i>
</button>
<button id="id-15" title="Plus..." aria-haspopup="true" data-placement="bottom" data-toggle="tooltip"
role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
type="button"><i class="plex-icon-toolbar-more-560" aria-hidden="true"></i></button>
type="button"><i class="plex-icon-toolbar-more-560" aria-hidden="true"></i>
</button>
</div>
<div class="Measure-scrollContainer-3vb4J">
<div class="Measure-expandContent-1JQfL"></div>
@ -21,7 +29,7 @@
</div>
</div>
<div class="PrePlayPageHeader-divider-WQRk8 PageHeaderDivider-pageHeaderDivider-DvwUq"></div>
<button id="id-14" data-original-title="Montrer les affiches" data-toggle="tooltip" role="button"
<button id="id-14" title="Montrer les affiches" data-placement="bottom" data-toggle="tooltip" role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO" type="button">
<i class="plex-icon-toolbar-artwork-560" aria-hidden="true"></i></button>
</div>
@ -31,15 +39,14 @@
<div class="PageContent-innerPageContent-3ktLT">
<div>
<div style="position: fixed; top: 180px;">
<div class="MetadataPosterCard-cardContainer-2gRcQ"
data-qa-id="metadataPosterCard--/library/metadata/28283">
<div class="MetadataPosterCard-cardContainer-2gRcQ">
<div class="MetadataPosterCard-card-3bztR " style="width: 260px; height: 390px;">
<div class="PrePlayPosterCard-face-3rQEj MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG ">
<div class="PosterCardImg-imageContainer-1Ar4M" data-movie-id="<?php echo $movie->id; ?>">
<div style="background-image: url(); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;"
class=""></div>
</div>
<div class=" MetadataPosterCardOverlay-overlay-1uMpL ">
<div class=" MetadataPosterCardOverlay-overlay-1uMpL">
<div class="MetadataPosterCardOverlay-background-2EwyB"></div>
<div class="MetadataPosterCardOverlay-unwatchedTagContainer-1lcEn"
data-qa-id="metadataPosterUnwatchedBadge">
@ -57,15 +64,30 @@
</div>
</div>
</div>
<?php if($movie->getMetaData()['Media']['@attributes']['videoResolution'] >= '720') : ?>
<div class="col-sm-4 text-center" style="font-size: 35px;"><i class="glyphicon video-hd"></i></div>
<?php else: ?>
<div class="col-sm-4 text-center" style="font-size: 35px;"><i class="glyphicon video-sd"></i></div>
<?php endif; ?>
<?php if($movie->getMetaData()['Stream']['Audio'][0]['codec'] === 'ac3') : ?>
<div class="col-sm-4 text-center" title="Dolby Digital" data-placement="bottom" data-toggle="tooltip" style="font-size: 35px;"><i class="glyphicon sound-dolby"></i></div>
<?php endif; ?>
<?php if(preg_match('/7\.1(\([a-z]*\))?/',$movie->getMetaData()['Stream']['Audio'][0]['audioChannelLayout'])) : ?>
<div class="col-sm-4 text-center" style="font-size: 35px;"><i class="glyphicon sound-7-1"></i></div>
<?php elseif (preg_match('/5\.1(\([a-z]*\))?/',$movie->getMetaData()['Stream']['Audio'][0]['audioChannelLayout'])) : ?>
<div class="col-sm-4 text-center" style="font-size: 35px;"><i class="glyphicon sound-5-1"></i></div>
<?php elseif (preg_match('/stereo/',$movie->getMetaData()['Stream']['Audio'][0]['audioChannelLayout'])) : ?>
<div class="col-sm-4 text-center" title="Stereo" data-placement="bottom" data-toggle="tooltip" style="font-size: 35px;"><i class="glyphicon sound-stereo"></i></div>
<?php endif; ?>
</div>
<div class="PrePlayMetadataContent-content-2ww3j" style="padding-left: 320px;">
<div>
<div class="PrePlayMetadataInnerContent-innerContent-1BPzw">
<div class="PrePlayPrimaryTitle-primaryTitle-1r9P9">
<div class="PrePlayLeftTitle-leftTitle-Ev1KG"><a title="<?php echo $movie->title; ?>"
href="#"
role="link"
class=" Link-link-2XYrU Link-default-32xSO"><?php echo $movie->title; ?></a>
<div class="PrePlayLeftTitle-leftTitle-Ev1KG">
<a title="<?php echo $movie->title; ?>" href="#" role="link" class=" Link-link-2XYrU Link-default-32xSO"><?php echo $movie->title; ?></a>
</div>
</div>
<div class="PrePlaySecondaryTitle-secondaryTitle-YJRGC PrePlayPrimaryTitle-primaryTitle-1r9P9"
@ -81,13 +103,15 @@
</span>
</div>
<div class="PrePlayRatingRightTitle-ratingRightTitle-1d4Yy PrePlayRightTitle-rightTitle-VxiwU">
<span
class="PrePlayRatingRightTitle-criticRating-2J_tn"><div
class="CriticRating-container-2t5Lw"><div
class="CriticRating-rating-1Ntfn"><div
class="CriticRating-other-uJc1K CriticRating-ratingImage-1bHp5"
title="Note"></div><?php echo $movie->rating * 10; ?>%
</div></div></span></div>
<span class="PrePlayRatingRightTitle-criticRating-2J_tn">
<div class="CriticRating-container-2t5Lw">
<div class="CriticRating-rating-1Ntfn">
<div class="CriticRating-imdb-16xaH CriticRating-ratingImage-1bHp5" title="Note"></div>
<?php echo $movie->rating; ?>
</div>
</div>
</span>
</div>
</div>
<div class="PrePlayTertiaryTitle-tertiaryTitle-1Rc92">
<div class="PrePlayLeftTitle-leftTitle-Ev1KG">
@ -99,6 +123,7 @@
</div>
<div class="PrePlayRightTitle-rightTitle-VxiwU">
<span>
<?php if(isset($movie->metadata['Genre'])) :?>
<?php foreach ($movie->metadata['Genre'] as $genre) : ?>
<?php $genre = isset($movie->metadata['Genre']['@attributes']) ? $movie->metadata['Genre'] : $genre; ?>
<span>
@ -111,6 +136,7 @@
break;
} ?>
<?php endforeach; ?>
<?php endif; ?>
</span>
</div>
</div>
@ -143,6 +169,7 @@
<div class="PrePlayDetailsGroupItem-label-2Ee43">Writed by</div>
<div class="PrePlayDetailsGroupItem-content-1aRNU">
<span>
<?php if(isset($movie->metadata['Writer'])) :?>
<?php foreach ($movie->metadata['Writer'] as $writer) : ?>
<?php $writer = isset($movie->metadata['Writer']['@attributes']) ? $movie->metadata['Writer'] : $writer; ?>
<span>
@ -155,6 +182,7 @@
break;
} ?>
<?php endforeach; ?>
<?php endif; ?>
</span>
</div>
</div>
@ -177,9 +205,9 @@
<div class="PrePlayDetailsGroupItem-label-2Ee43">Vidéo</div>
<div class="PrePlayDetailsGroupItem-content-1aRNU">
<span data-qa-id="videoStream">
SD
<?php echo $movie->getMetaData()['Media']['@attributes']['videoResolution']; ?>p
<span class="DashSeparator-separator-2a3yn"></span>
MPEG4
<?php echo $movie->getMetaData()['Stream']['Video'][0]['codec']; ?>
</span>
</div>
</div>
@ -187,15 +215,25 @@
<div class="PrePlayDetailsGroupItem-label-2Ee43">Audio</div>
<div class="PrePlayDetailsGroupItem-content-1aRNU">
<span>
Inconnu
<?php echo $movie->getMetaData()['Stream']['Audio'][0]['language']; ?>
<span class="DashSeparator-separator-2a3yn"></span>
MP3 Stéréo
<?php echo isset($movie->getMetaData()['Stream']['Audio'][0]['displayTitle']) ? $movie->getMetaData()['Stream']['Audio'][0]['displayTitle'] : isset($movie->getMetaData()['Stream']['Audio'][0]['title']) ? $movie->getMetaData()['Stream']['Audio'][0]['title'] : $movie->getMetaData()['Stream']['Audio'][0]['language']; ?>
</span>
</div>
</div>
<div class="PrePlayDetailsGroupItem-groupItem-3Tut9">
<div class="PrePlayDetailsGroupItem-label-2Ee43">Sous-titres</div>
<div class="PrePlayDetailsGroupItem-content-1aRNU"><span>Aucun</span></div>
<div class="PrePlayDetailsGroupItem-content-1aRNU">
<span>
<?php if(count($movie->getMetaData()['Stream']['SubTitle']) > 0): ?>
<?php echo isset($movie->getMetaData()['Stream']['SubTitle'][0]['language']) ? $movie->getMetaData()['Stream']['SubTitle'][0]['language'] : ''; ?>
<span class="DashSeparator-separator-2a3yn"></span>
<?php echo isset($movie->getMetaData()['Stream']['SubTitle'][0]['displayTitle']) ? $movie->getMetaData()['Stream']['SubTitle'][0]['displayTitle'] : $movie->getMetaData()['Stream']['SubTitle'][0]['title']; ?>
<?php else: ?>
Aucun
<?php endif;?>
</span>
</div>
</div>
</div>
<div class="PrePlaySummary-summary-1NL8g">
@ -213,8 +251,73 @@
<button aria-haspopup="true" role="button"
class="CollapsibleText-readMore-1bRJm DisclosureArrowButton-disclosureArrowButton-3tbYZ DisclosureArrowButton-medium-3-Y37 Link-link-2XYrU Link-default-32xSO"
type="button">Show more
<div class="CollapsibleText-readMoreArrow-34BdB DisclosureArrowButton-disclosureArrow-34Wg3 DisclosureArrow-disclosureArrow-1sBFv DisclosureArrowButton-down-bd2wx DisclosureArrowButton-medium-3-Y37 DisclosureArrow-down-1U7WW DisclosureArrow-up-rjGpc DisclosureArrow-default-3_FCW DisclosureArrow-medium-3VjTd "></div>
<div class="CollapsibleText-readMoreArrow-34BdB DisclosureArrow-disclosureArrow-1sBFv DisclosureArrowButton-down-bd2wx DisclosureArrowButton-medium-3-Y37 DisclosureArrow-down-1U7WW DisclosureArrow-up-rjGpc DisclosureArrow-default-3_FCW DisclosureArrow-medium-3VjTd "></div>
</button>
</div>
</div>
<div class="PrePlayMetadataListInnerContent-innerContent-2CsIz">
<div class="PrePlayMetadataInnerContent-innerContent-1BPzw">
<div class="PrePlayCastList-castList-3dQB5">
<div class="HubCell-hubCell-3Ys17" style="visibility: visible;" data-qa-id="hub--cast">
<div class="HubCellHeader-hubCellHeader-2pvYN">
<div class="HubCellTitle-hubCellTitle-2abIn" data-qa-id="hubCellTitle">ACTEURS</div>
<div class="HubCell-hubActions-28w1-">
<button data-qa-id="hubPreviousButton" role="button" class="HubCell-hubScrollButton-2Y7ri Link-link-2XYrU Link-default-32xSO isDisabled " type="button" disabled="">
<i class="plex-icon-hub-prev-560" aria-hidden="false" aria-label="Page précédente"></i>
</button>
<button data-qa-id="hubNextButton" role="button" class="HubCell-hubScrollButton-2Y7ri Link-link-2XYrU Link-default-32xSO" type="button">
<i class="plex-icon-hub-next-560" aria-hidden="false" aria-label="Page suivante"></i>
</button>
</div>
</div>
<div style="height: 183px; overflow: hidden;">
<div class="Measure-container-3yONE">
<div class="HubCell-hubScroller-2qgkr VirtualListScroller-scroller-37EU_ Scroller-horizontal-cOKsq Scroller-scroller-3GqQc Scroller-horizontal-cOKsq ">
<?php $translate = -143; ?>
<div class=" " style="width: 5012px; height: 183px;">
<?php if(isset($movie->getMetadata()['Role'])) : ?>
<?php foreach ($movie->getMetadata()['Role'] as $role) : ?>
<?php $translate += 148; ?>
<div data-qa-id="cellItem" style="position: absolute; width: 118px; height: 168px; transform: translate3d(<?php echo $translate; ?>px, 10px, 0px);">
<a href="#" role="link" class="PrePlayCastCell-cardLink-Tndv5 Link-link-2XYrU Link-default-32xSO">
<div class="TagPosterCard-card-RVD0D MetadataPosterCardFace-poster-L2P6r TagPosterCard-isPerson-1ez1h" style="width: 118px; height: 118px;">
<?php if (isset($role['@attributes']['thumb'])) : ?>
<div class="PosterCardImg-imageContainer-1Ar4M">
<div style="background-image: url('<?php echo $role['@attributes']['thumb']; ?>'); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;" class=""></div>
</div>
<?php else : ?>
<div style="font-size: 30px; line-height: 118px;" class="Anagram-anagram-2KZ_Z">
<?php
$actor = explode(' ',$role['@attributes']['tag']);
echo substr($actor[0],0,1).substr($actor[1],0,1);
?>
</div>
<?php endif; ?>
</div>
</a>
<div class="PrePlayCastCell-titleContainer-PAy29">
<a data-qa-id="castTitle" title="<?php echo $role['@attributes']['tag']; ?>" href="#" role="link" class=" MetadataPosterTitle-singleLineTitle-24_DN MetadataPosterTitle-title-3tU5F Link-link-2XYrU Link-default-32xSO">
<?php echo $role['@attributes']['tag']; ?>
</a>
<span class=" MetadataPosterTitle-singleLineTitle-24_DN MetadataPosterTitle-title-3tU5F MetadataPosterTitle-isSecondary-2VUxY " title="Johnny English">
<?php echo $role['@attributes']['role']; ?>
</span>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<div class="Measure-scrollContainer-1c6dy">
<div class="Measure-expandContent-zsLw6"></div>
</div>
<div class="Measure-scrollContainer-1c6dy">
<div class="Measure-shrinkContent-303GS Measure-expandContent-zsLw6"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -238,6 +341,18 @@
</div>
<script type="text/javascript">
$(window).on('load', function() {
/** READ MORE **/
$(document).on('click', '.CollapsibleText-readMore-1bRJm', function (event) {
var summary = $(document).find('.CollapsibleText-contentTransition-15VYv');
if(summary.css('max-height') === '78px') {
$(this).find('div').removeClass('DisclosureArrow-down-1U7WW').addClass('DisclosureArrow-up-1U7WW');
summary.css('max-height', '10000px');
} else {
$(this).find('div').removeClass('DisclosureArrow-up-1U7WW').addClass('DisclosureArrow-down-1U7WW');
summary.css('max-height', '78px');
}
});
/** LAUNCH PLAYER **/
$(document).on('click', '.MetadataPosterCardOverlay-playButton-1fjhk.PlayButton-playButton-3WX8X', function (event) {
event.stopPropagation();

@ -1,5 +1,5 @@
<head>
<title>Plex</title>
<title>PlexShare :: Settings</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="apple-mobile-web-app-capable" content="yes">
@ -14,7 +14,7 @@
<div id="plex" class="application">
<?php echo \View::forge('layout/nav_bar_header', ['user' => $user]); ?>
<div class="background-container">
<div data-reactroot="" class="FullPage-container-17Y0c">
<div class="FullPage-container-17Y0c">
<div>
<div>
<div style="background-image: url('//assets.plex.tv/deploys/desktop/env-eb2798cc3c7d9533df5b563963d5c394/3.41.1-304f788/common/img/backgrounds/preset-dark.64cc1c942221cd2c153244bd8ecfb67a.png'); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;"
@ -29,11 +29,6 @@
<li class="web-nav-item"><a class="web-btn btn-gray" href="/settings">General</a></li>
<li class="server-nav-item "><a class="server-btn btn-gray" href="/settings/servers">My Servers<span class="badge">0</span></a></li>
<li class="users-nav-item "><a class="users-btn btn-gray" href="/settings/libraries">My Libraries<span class="badge">0</span></a></li>
<?php if($user->admin) : ?>
<li class="server-nav-item "><a class="server-btn btn-gray" href="/admin/servers">All Servers<span class="badge">0</span></a></li>
<li class="users-nav-item "><a class="users-btn btn-gray" href="/admin/libraries">All Libraries<span class="badge">0</span></a></li>
<li class="devices-nav-item "><a class="devices-btn btn-gray" href="/admin/users">Users</a></li>
<?php endif; ?>
</ul>
<h2>Settings</h2>
<?php echo $body; ?>
@ -42,14 +37,14 @@
<div>
</div>
</div>
<?php
echo \Asset::js(isset($js_bottom) ? $js_bottom : null);
echo \Asset::js(['bootstrap.min.js']);
?>
<script>
$(document).ready(function () {
$(window).on('load', function() {
$('[data-toggle="tooltip"]').tooltip({ container: 'body'});
});
</script>
<?php
echo \Asset::js(['bootstrap.min.js']);
echo \Asset::js(isset($js_bottom) ? $js_bottom : null);
?>
</body>
</html>

@ -5,7 +5,7 @@
<div class="col-sm-4 col-md-3">
<ul class="settings-nav nav nav-cards">
<li><a class="card btn-gray selected" href="#general-web-group">General</a></li>
<li><a class="card btn-gray" href="#quality-web-group">Sub Account</a></li>
<li><a class="card btn-gray" href="#subaccount-web-group">Sub Account</a></li>
<li><a class="card btn-gray" href="#player-web-group">Player</a></li>
</ul>
</div>
@ -16,64 +16,92 @@
<div class="form-group">
<label for="language">Language</label>
<select id="language">
<option value="en" selected=""> English</option>
<option value="fr"> Français</option>
<option value="english" selected=""> English</option>
<option value="french"> Français</option>
</select>
<p class="help-block">
Aidez-nous à traduire cette application dans votre langue <a href="https://transifex.com/plex-1/plex-web" target="_blank">ici</a>.
Aidez-nous à traduire cette application dans votre langue <a
href="https://transifex.com/plex-1/plex-web" target="_blank">ici</a>.
</p>
</div>
<div class="form-group">
<label class="control-label" for="input_FriendlyName_c">
Second refresh
</label>
<input id="input_FriendlyName_c" class="form-control" name="refresh" value="" placeholder="ex: 800" type="text">
<input id="input_FriendlyName_c" class="form-control" name="refresh" value=""
placeholder="ex: 800" type="text">
<p class="help-block">Number in second, you want to check new content on server.</p>
</div>
</div>
<div id="player-web-group" class="settings-group"><h4 class="settings-header-first ">Audio &amp;
sous-titres</h4>
<div class="form-group advanced-setting"><label for="audioBoost">Augmenter le volume du son
multi-canal</label> <select id="audioBoost" data-type="int">
<option value="100" selected="">Aucun</option>
<option value="150">Petite</option>
<option value="200">Grande</option>
<option value="250">Énorme</option>
<div id="subaccount-web-group" class="settings-group">
<h4 class="settings-header-first">Sub Account</h4>
<h6><button class="btn btn-primary"><i class="glyphicon circle-plus"></i> Add sub account</button></h6>
<div class="device-list-container col-sm-12">
<ul class="list card-tile-list">
<li class="card-tile-list-item card-2-col-item">
<div class="card card-device">
<div class="card-actions">
<button class="remove-device-btn card-action-btn" title="Permissions" data-toggle="tooltip" data-placement="top">
<i class="glyphicon unlock"></i>
</button>
<button class="remove-device-btn card-action-btn btn-danger" title="Delete" data-toggle="tooltip" data-placement="top">
<i class="glyphicon remove-2"></i>
</button>
</div>
<h4 class="name">Chewbaka</h4>
<div class="card-details">
<div class="version text-muted">Last use: an hour ago</div>
</div>
</div>
</li>
</ul>
</div>
</div>
<div id="player-web-group" class="settings-group">
<h4 class="settings-header-first">Streaming</h4>
<div class="form-group">
<label for="remoteQuality">Video Quality</label>
<select id="remoteQuality" data-type="int">
<option value="-1">Maximale</option>
<option value="20000"> 20 Mbps, 1080p</option>
<option value="12000"> 12 Mbps, 1080p</option>
<option value="10000"> 10 Mbps, 1080p</option>
<option value="8000"> 8 Mbps, 1080p</option>
<option value="4000"> 4 Mbps, 720p</option>
<option value="3000"> 3 Mbps, 720p</option>
<option value="2000" selected=""> 2 Mbps, 720p</option>
<option value="1500"> 1.5 Mbps, 480p</option>
<option value="700"> 0.7 Mbps</option>
<option value="300"> 0.3 Mbps</option>
<option value="200"> 0.2 Mbps</option>
</select>
<p class="help-block">Augmente le volume si le son est converti de multi-canal à
stéréo.</p></div>
<div class="form-group"><label for="subtitleSize">Taille des sous-titres</label> <select
id="subtitleSize" data-type="int">
<option value="50">Minuscule</option>
<option value="75">Petite</option>
<option value="100" selected="">Normale</option>
<option value="125">Grande</option>
<option value="200">Énorme</option>
</select></div>
<div class="form-group advanced-setting"><label for="subtitlesBurnLevel">Incruster les
sous-titres</label> <select id="subtitlesBurnLevel">
<option value="auto" selected="">Automatique</option>
<option value="avoid">Seulement le format des images</option>
<option value="always">Toujours</option>
<p class="help-block">Set the default quality for streaming video over the internet. If
quality is set too high, videos will start slowly and pause frequently.</p></div>
<div class="form-group">
<label for="subtitleSize">Subtitle Size</label>
<select id="subtitleSize" data-type="int">
<option value="50">Tiny</option>
<option value="75">Small</option>
<option value="100" selected="">Normal</option>
<option value="125">Large</option>
<option value="200">Huge</option>
</select>
<p class="help-block">Détermine si le serveur doit incruster les sous-titres lors de
l'encodage, en fonction du format des sous-titres. Eviter l'incrustation des
sous-titres améliore les performances du serveur, mais n'est possible qu'avec le
lecteur HTML5.</p></div>
</div>
<h4 class="settings-header">Bonus</h4>
<div class="form-group"><label for="extrasPrefixCount">Bandes annonces de Cinema avant le
film</label> <select id="extrasPrefixCount" data-type="int">
<option value="0" selected="">Aucun</option>
<div class="form-group">
<label for="extrasPrefixCount">Cinema Trailers to Play Before Movies</label>
<select id="extrasPrefixCount" data-type="int">
<option value="0" selected="">None</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select></div>
</select>
</div>
</div>
<div class="form-footer">
<button type="submit" class="submit-btn btn btn-lg btn-primary btn-loading disabled">
<div class="loading loading-sm"></div>
<button type="submit" class="submit-btn btn btn-lg btn-primary disabled">
<span class="btn-label">Enregistrer les modifications</span></button>
<span class="form-message"></span></div>
</form>
@ -81,3 +109,25 @@
</div>
</div>
</div>
<script type="text/javascript">
$(window).on('load', function () {
if(window.location.hash !== '') {
var href = window.location.hash;
$('.settings-nav li .card').removeClass('selected');
$('.settings-nav li .card[href="' + href + '"]').addClass('selected');
$('#web-settings-form .settings-group').removeClass('active');
$(href).addClass('active');
}
$(document).on('click', '.settings-nav li .card', function (event) {
$('.settings-nav li .card').removeClass('selected');
$(this).addClass('selected');
var href = $(this).attr('href');
$('#web-settings-form .settings-group').removeClass('active');
$(href).addClass('active');
});
});
</script>

@ -89,38 +89,7 @@
</div>
</div>
<script type="text/javascript">
$(function() {
$('.filter-bar .add').on('click', function () {
$.ajax({
method: 'get',
url: '/rest/settings/add_server.json'
}).done(function (data) {
$('body').append(data);
setTimeout(function(){
$('.media-server-modal').removeClass('out').addClass('in');
},100);
});
});
$(document).on('click', '.media-server-modal button.close', function () {
$('.media-server-modal').removeClass('in').addClass('out').delay(500).queue(function(){ $(this).remove()});
});
$(document).on('click', '#add-plex button', function () {
var url = $('#add-plex #url').val();
var port = $('#add-plex #port').val();
var token = $('#add-plex #token').val();
$.ajax({
method: 'post',
url: '/rest/settings/server.json',
data: {url: url, port: port, token: token}
}).done(function (data) {
show_alert('success', 'Server save succesfully!');
$('.media-server-modal button.close').click();
}).fail(function (data) {
data = JSON.parse(data.responseText);
show_alert('error', data.message);
setTimeout(function(){location.reload()}, 200);
});
});
$(window).on('load', function() {
// LIBRARY BUTTON ACTION
$('button.refresh-library-btn').on('click', function () {
var library_id = $(this).data('library-id');
@ -155,6 +124,21 @@
show_alert('error', data.message);
});
});
$('button.enable-library-btn').on('click', function () {
var button = this;
var library_id = $(this).data('library-id');
$.ajax({
method: 'put',
url: '/rest/settings/library.json',
data: {library_id: library_id}
}).done(function (data) {
show_alert('success', 'Library enable succesfully!');
$(button).closest('.card.card-device').removeClass('disabled');
}).fail(function (data) {
data = JSON.parse(data.responseText);
show_alert('error', data.message);
});
});
// REFRESH ALL LIBRARIES
$('.filter-bar .refresh').on('click', function () {

@ -60,7 +60,7 @@
</div>
</div>
<script type="text/javascript">
$(function() {
$(window).on('load', function() {
$('.filter-bar .add').on('click', function () {
$.ajax({
method: 'get',

@ -1,4 +1,5 @@
<input id="data_movie" type="hidden" data-src="<?php echo $movie->getStreamUrl(); ?>"/>
<input id="data_movie_id" type="hidden" data-movie-id="<?php echo $movie->id; ?>"/>
<button aria-label="Lire" role="playCenter" type="button"
class="PlayPauseOverlay-playButton-25OfW PlayButton-playButton-3WX8X Link-link-2XYrU Link-default-32xSO"
style="z-index: 0">
@ -28,7 +29,7 @@
</div>
</div>
<!-- Quality choice -->
<div class="AudioVideoPlaybackSettings-container-2pTAj AudioVideoStripeContainer-container-MI02O" style="display: none; bottom: 86px;">
<div class="AudioVideoPlaybackSettings-container-2pTAj AudioVideoStripeContainer-container-MI02O" style="transform: translateY(246px)">
<div class="AudioVideoPlaybackSettings-title-2MRYF">Configuration de la lecture</div>
<div class="AudioVideoPlaybackSettings-menusContainer-2bvbj" data-qa-id="playbackSettingsContainer">
<div class="AudioVideoSettingsRow-row-2CrSz ">
@ -64,8 +65,7 @@
style="bottom: -86px; height: 86px; z-index: 0">
<div class="AudioVideoBottomBar-controlsContainer-2c743">
<div>
<di v
class="AudioVideoBottomBar-seekBar-2ai3z SeekBar-seekBar-2UK3i Slider-slider-2oLVT Slider-hasAutoHideThumb-tpdhC">
<div class="AudioVideoBottomBar-seekBar-2ai3z SeekBar-seekBar-2UK3i Slider-slider-2oLVT Slider-hasAutoHideThumb-tpdhC">
<div class="SeekBar-seekBarTrack-3Gu5R Slider-track-28JOS">
<div class="SeekBar-seekBarBuffer-3bUz9 Slider-secondaryFill-31_05 Slider-fill-35GFq "
style="transform: scaleX(0);"></div>
@ -107,7 +107,7 @@
</div>
<?php else : ?>
<div class="AudioVideoPlayerControlsMetadata-titlesContainer-1oLik">
<a title="<?php echo $movie->title; ?>" href="#" role="link"
<a title="<?php echo $movie->title; ?>" href="/movie/<?php echo $movie->id; ?>" role="link"
class=" MetadataPosterTitle-singleLineTitle-24_DN MetadataPosterTitle-title-3tU5F Link-link-2XYrU Link-default-32xSO">
<?php echo $movie->title; ?>
</a>
@ -122,7 +122,7 @@
<button data-qa-id="mediaDuration" role="button"
class="DurationRemaining-container-1F4w8 Link-link-2XYrU Link-default-32xSO"
type="button"><span class="media-time">00:00</span> / <span
class="media-duration"><?php echo $movie->getDuractionMovie(); ?></span></button>
class="media-duration"><?php echo $movie->getDurationMovie(); ?></span></button>
</div>
</div>
<div class="AudioVideoPlayerControls-buttonGroupCenter-Vok98 AudioVideoPlayerControls-buttonGroup-ShnOa">

@ -8,10 +8,6 @@
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
type="button"><i class="plex-icon-toolbar-play-560"
aria-hidden="true"></i></button>
<button id="id-568" aria-label="Visionner la bande annonce." role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
type="button"><i class="plex-icon-toolbar-play-trailer-560"
aria-hidden="true"></i></button>
<button id="id-639" aria-label="Ordre aléatoire." data-qa-id="toolbarShuffle" role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
type="button"><i class="plex-icon-toolbar-shuffle-560"
@ -122,7 +118,7 @@
</div>
</div>
<div class="PrePlaySummary-summary-1NL8g">
<div class="false" style="overflow: hidden; max-height: 78px;">
<div class="CollapsibleText-contentTransition-15VYv" style="overflow: hidden; max-height: 78px;">
<div class="Measure-container-2XznZ"><?php echo $tvshow->summary; ?>
<div class="Measure-scrollContainer-3vb4J">
<div class="Measure-expandContent-1JQfL"></div>
@ -134,8 +130,8 @@
</div>
<button aria-haspopup="true" role="button"
class="CollapsibleText-readMore-1bRJm DisclosureArrowButton-disclosureArrowButton-3tbYZ DisclosureArrowButton-medium-3-Y37 Link-link-2XYrU Link-default-32xSO"
type="button">Voir plus
<div class="CollapsibleText-readMoreArrow-34BdB DisclosureArrowButton-disclosureArrow-34Wg3 DisclosureArrow-disclosureArrow-1sBFv DisclosureArrowButton-down-bd2wx DisclosureArrowButton-medium-3-Y37 DisclosureArrow-down-1U7WW DisclosureArrow-up-rjGpc DisclosureArrow-default-3_FCW DisclosureArrow-medium-3VjTd "></div>
type="button">Read more
<div class="CollapsibleText-readMoreArrow-34BdB DisclosureArrow-disclosureArrow-1sBFv DisclosureArrowButton-down-bd2wx DisclosureArrowButton-medium-3-Y37 DisclosureArrow-down-1U7WW DisclosureArrow-up-rjGpc DisclosureArrow-default-3_FCW DisclosureArrow-medium-3VjTd "></div>
</button>
</div>
</div>
@ -153,11 +149,10 @@
<div class="HubCellTitle-hubCellTitle-2abIn" data-qa-id="hubCellTitle">SAISONS</div>
</div>
<div>
<div class=" " style="width: 1226px; height: 248px;">
<?php $translate = -132; ?>
<div class=" " style="width: 100%;">
<?php foreach ($tvshow->getSeasons() as $season) : ?>
<div class=" virtualized-cell-3KPHx"
style="position: absolute; width: 122px; height: 233px; transform: translate3d(<?php echo $translate += 152; ?>px, 10px, 0px);">
style="position: relative; width: 137px; height: 206px; display: inline-block; margin-left: 28px; margin-top: 10px">
<div class="MetadataPosterCard-cardContainer-2gRcQ"
data-qa-id="metadataPosterCard--/library/metadata/28083">
<div class="MetadataPosterCard-card-3bztR "
@ -215,6 +210,71 @@
</div>
</div>
</div>
<div class="PrePlayMetadataListInnerContent-innerContent-2CsIz">
<div class="PrePlayMetadataInnerContent-innerContent-1BPzw">
<div class="PrePlayCastList-castList-3dQB5">
<div class="HubCell-hubCell-3Ys17" style="visibility: visible;" data-qa-id="hub--cast">
<div class="HubCellHeader-hubCellHeader-2pvYN">
<div class="HubCellTitle-hubCellTitle-2abIn" data-qa-id="hubCellTitle">ACTEURS</div>
<div class="HubCell-hubActions-28w1-">
<button data-qa-id="hubPreviousButton" role="button" class="HubCell-hubScrollButton-2Y7ri Link-link-2XYrU Link-default-32xSO isDisabled " type="button" disabled="">
<i class="plex-icon-hub-prev-560" aria-hidden="false" aria-label="Page précédente"></i>
</button>
<button data-qa-id="hubNextButton" role="button" class="HubCell-hubScrollButton-2Y7ri Link-link-2XYrU Link-default-32xSO" type="button">
<i class="plex-icon-hub-next-560" aria-hidden="false" aria-label="Page suivante"></i>
</button>
</div>
</div>
<div style="height: 183px; overflow: hidden;">
<div class="Measure-container-3yONE">
<div class="HubCell-hubScroller-2qgkr VirtualListScroller-scroller-37EU_ Scroller-horizontal-cOKsq Scroller-scroller-3GqQc Scroller-horizontal-cOKsq ">
<?php $translate = -143; ?>
<div class=" " style="width: 5012px; height: 183px;">
<?php if(isset($tvshow->getMetadata()['Role'])) : ?>
<?php foreach ($tvshow->getMetadata()['Role'] as $role) : ?>
<?php $translate += 148; ?>
<div data-qa-id="cellItem" style="position: absolute; width: 118px; height: 168px; transform: translate3d(<?php echo $translate; ?>px, 10px, 0px);">
<a href="#" role="link" class="PrePlayCastCell-cardLink-Tndv5 Link-link-2XYrU Link-default-32xSO">
<div class="TagPosterCard-card-RVD0D MetadataPosterCardFace-poster-L2P6r TagPosterCard-isPerson-1ez1h" style="width: 118px; height: 118px;">
<?php if (isset($role['@attributes']['thumb'])) : ?>
<div class="PosterCardImg-imageContainer-1Ar4M">
<div style="background-image: url('<?php echo $role['@attributes']['thumb']; ?>'); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;" class=""></div>
</div>
<?php else : ?>
<div style="font-size: 30px; line-height: 118px;" class="Anagram-anagram-2KZ_Z">
<?php
$actor = explode(' ',$role['@attributes']['tag']);
echo substr($actor[0],0,1).substr($actor[1],0,1);
?>
</div>
<?php endif; ?>
</div>
</a>
<div class="PrePlayCastCell-titleContainer-PAy29">
<a data-qa-id="castTitle" title="<?php echo $role['@attributes']['tag']; ?>" href="#" role="link" class=" MetadataPosterTitle-singleLineTitle-24_DN MetadataPosterTitle-title-3tU5F Link-link-2XYrU Link-default-32xSO">
<?php echo $role['@attributes']['tag']; ?>
</a>
<span class=" MetadataPosterTitle-singleLineTitle-24_DN MetadataPosterTitle-title-3tU5F MetadataPosterTitle-isSecondary-2VUxY " title="Johnny English">
<?php echo $role['@attributes']['role']; ?>
</span>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<div class="Measure-scrollContainer-1c6dy">
<div class="Measure-expandContent-zsLw6"></div>
</div>
<div class="Measure-scrollContainer-1c6dy">
<div class="Measure-shrinkContent-303GS Measure-expandContent-zsLw6"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -229,6 +289,18 @@
</div>
<script type="text/javascript">
$(window).on('load', function() {
/** READ MORE **/
$(document).on('click', '.CollapsibleText-readMore-1bRJm', function (event) {
var summary = $(document).find('.CollapsibleText-contentTransition-15VYv');
if(summary.css('max-height') === '78px') {
$(this).find('div').removeClass('DisclosureArrow-down-1U7WW').addClass('DisclosureArrow-up-1U7WW');
summary.css('max-height', '10000px');
} else {
$(this).find('div').removeClass('DisclosureArrow-up-1U7WW').addClass('DisclosureArrow-down-1U7WW');
summary.css('max-height', '78px');
}
});
$('.PosterCardImg-imageContainer-1Ar4M[data-tvshow-id]').each(function (index, element) {
var tvshow_id = $(element).data('tvshow-id');
$('[data-tvshow-id="' + tvshow_id + '"] > div').css('background-image', 'url("/cover/tvshow?tvshow_id=' + tvshow_id + '&width=' + 325 + '&height=' + 488 + '")');

File diff suppressed because one or more lines are too long

@ -12,7 +12,9 @@ function toHHMMSS(num) {
if(hours > 0){times += hours+':'}
return times + minutes + ':' + seconds;
}
var player = null;
function launchPlayer(view) {
var lastTimeMouseMoved = null;
var timeout = null;
@ -31,7 +33,7 @@ function launchPlayer(view) {
player = new Clappr.Player({
source: movie_src,
parentId: '#movie_id',
parentId: '#movie_stream',
width: '100%',
height: '100%',
mediacontrol: false,
@ -42,7 +44,7 @@ function launchPlayer(view) {
},
events: {
onReady: function () {
$('#movie_id').find('.media-control, .player-poster').remove();
$('#movie_stream').find('.media-control, .player-poster').remove();
},
onPause: function () {
$('button[data-qa-id="resumeButton"] i').toggleClass('plex-icon-player-play-560 plex-icon-player-pause-560');
@ -55,6 +57,10 @@ function launchPlayer(view) {
$('.media-time').html(toHHMMSS(timeplay));
$('.SeekBar-seekBarFill-1Lcu0').css('transform', 'scaleX('+ percent +')');
if(parseInt(percent * 100) > 1) {
ajaxPlayingMovies($('#data_movie_id').data('movie-id'));
}
}
}
});
@ -65,6 +71,7 @@ function launchPlayer(view) {
});
/** EVENT PLAYER TO GET CURRENT TIME **/
/** BUFFER BAR PROGRESS **/
player.core.getCurrentContainer().on(Clappr.Events.CONTAINER_PROGRESS, function(progress) {
var buffer = progress.current / progress.total;
$('.SeekBar-seekBarBuffer-3bUz9').css('transform', 'scaleX('+ buffer +')');
@ -78,7 +85,6 @@ function launchPlayer(view) {
});
/** RESUME **/
$(document).on('click', 'button[data-qa-id="resumeButton"]', function () {
console.log(player.isPlaying());
if(!player.isPlaying())
$('button[role="playCenter"]').click();
else
@ -99,27 +105,38 @@ function launchPlayer(view) {
else
fullScreen();
});
/** SETTINGS AUDIO VIDEO AND SUBTITLES **/
$(document).on('click', '.AudioVideoPlayerControls-buttonGroupRight-17650 .AudioVideoPlayerControls-auxButtons-2YhIh > button', function (event) {
var video_audio_control = $('.AudioVideoPlaybackSettings-container-2pTAj.AudioVideoStripeContainer-container-MI02O');
if(video_audio_control.css('transform') === 'matrix(1, 0, 0, 1, 0, 246)')
video_audio_control.css('transform', 'translateY(0px)');
else
video_audio_control.css('transform', 'translateY(246px)');
});
/** HOVER PLAYER, BUTTON CENTER AND NAVBAR SHOW NAVBAR **/
$(document).on('mouseover', '#movie_id , button[role="playCenter"], .AudioVideoFullPlayer-topBar-2XUGM, .AudioVideoFullPlayer-bottomBar-2yixi', function (event) {
$(document).on('mouseover', '#movie_stream , button[role="playCenter"], .AudioVideoFullPlayer-topBar-2XUGM, .AudioVideoFullPlayer-bottomBar-2yixi, .AudioVideoPlaybackSettings-container-2pTAj.AudioVideoStripeContainer-container-MI02O', function (event) {
clearTimeout(timeout);
$('.AudioVideoFullPlayer-topBar-2XUGM').css('transform', 'translateY(60px)');
$('.AudioVideoFullPlayer-bottomBar-2yixi').css('transform', 'translateY(-86px)');
});
/** BUTTON CENTER AND NAVBAR HIDE NAVBAR **/
$(document).on('mouseout', 'button[role="playCenter"], .AudioVideoFullPlayer-topBar-2XUGM, .AudioVideoFullPlayer-bottomBar-2yixi', function (event) {
$(document).on('mouseleave', '#movie_stream, #video_controls', function (event) {
$('.AudioVideoFullPlayer-topBar-2XUGM').css('transform', '');
$('.AudioVideoFullPlayer-bottomBar-2yixi').css('transform', '');
$('.AudioVideoPlaybackSettings-container-2pTAj.AudioVideoStripeContainer-container-MI02O').css('transform', 'translateY(246px)');
});
/** MOUSE MOVE ON PLAYER KEEP VISIBLE NAVBAR **/
$(document).on('mousemove', '#movie_id, button[role="playCenter"]', function () {
$('button[role="playCenter"], #movie_id').css('cursor', 'pointer');
$(document).on('mousemove', '#movie_stream, button[role="playCenter"]', function () {
$('button[role="playCenter"], #movie_stream').css('cursor', 'pointer');
$('button[role="playCenter"], .AudioVideoFullPlayer-topBar-2XUGM, .AudioVideoFullPlayer-bottomBar-2yixi').mouseover();
lastTimeMouseMoved = new Date().getTime();
timeout = setInterval(function() {
var currentTime = new Date().getTime();
if ((currentTime - lastTimeMouseMoved) > 1000) {
$('button[role="playCenter"], #movie_id').css('cursor', 'none');
$('button[role="playCenter"], .AudioVideoFullPlayer-topBar-2XUGM, .AudioVideoFullPlayer-bottomBar-2yixi').mouseout();
$('button[role="playCenter"], #movie_stream').css('cursor', 'none');
$('#movie_stream, #video_controls').mouseleave();
clearTimeout(timeout);
}
}, 1000);
@ -189,6 +206,7 @@ function initSliders () {
var slider1 = new Slider($('.Slider-thumbTrack-21hGV .Slider-thumb-2QGiU').get(0));
slider1.clickElementBefore = $('.SeekBar-seekBarTrack-3Gu5R').get(0);
slider1.init();
var slider2 = new Slider($('.VolumeSlider-slider-1QXdT .Slider-thumb-2QGiU').get(0));
slider2.clickElementBefore = $('.VolumeSlider-fill-3XkYy').get(0);
slider2.clickElementAfter = $('.VolumeSlider-track-2WJDz').get(0);
@ -373,7 +391,4 @@ Slider.prototype.handleClick = function (event) {
this.valueNow = parseInt(((this.valueMax - this.valueMin) * diffX) / this.railWidth);
this.moveSliderTo(this.valueNow);
/*event.preventDefault();
event.stopPropagation();*/
};

@ -13,8 +13,13 @@ function updateServers(servers) {
url: '/rest/browse/server.json',
data: {server_id: server.id}
}).done(function (data) {
if(data.error === true)
show_alert('error', data.message);
else
{
updateLibraries(server);
ajax -= 1;
}
});
}, (index + 1) * 1000);
});

Loading…
Cancel
Save