add current playing movie, update player, add permission download, update home list and its cache

pull/9/head
root 4 years ago
parent b8b98c2754
commit 3c031424ff

63
composer.lock generated

@ -8,28 +8,31 @@
"packages": [
{
"name": "composer/installers",
"version": "v1.7.0",
"version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "141b272484481432cda342727a427dc1e206bfa0"
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/141b272484481432cda342727a427dc1e206bfa0",
"reference": "141b272484481432cda342727a427dc1e206bfa0",
"url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0"
"composer-plugin-api": "^1.0 || ^2.0"
},
"replace": {
"roundcube/plugin-installer": "*",
"shama/baton": "*"
},
"require-dev": {
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "^4.8.36"
"composer/composer": "1.6.* || 2.0.*@dev",
"composer/semver": "1.0.* || 2.0.*@dev",
"phpunit/phpunit": "^4.8.36",
"sebastian/comparator": "^1.2.4",
"symfony/process": "^2.3"
},
"type": "composer-plugin",
"extra": {
@ -65,6 +68,7 @@
"Kanboard",
"Lan Management System",
"MODX Evo",
"MantisBT",
"Mautic",
"Maya",
"OXID",
@ -119,6 +123,7 @@
"shopware",
"silverstripe",
"sydes",
"sylius",
"symfony",
"typo3",
"wordpress",
@ -126,7 +131,7 @@
"zend",
"zikula"
],
"time": "2019-08-12T15:00:31+00:00"
"time": "2020-04-07T06:57:05+00:00"
},
{
"name": "fuel/auth",
@ -166,12 +171,12 @@
"source": {
"type": "git",
"url": "https://github.com/fuel/core.git",
"reference": "639d766486ed90bcb6fd1e737a9374ee7345daa9"
"reference": "f6bb6bb682805d12bd985a28153e7f7a1e1b1ea9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fuel/core/zipball/639d766486ed90bcb6fd1e737a9374ee7345daa9",
"reference": "639d766486ed90bcb6fd1e737a9374ee7345daa9",
"url": "https://api.github.com/repos/fuel/core/zipball/f6bb6bb682805d12bd985a28153e7f7a1e1b1ea9",
"reference": "f6bb6bb682805d12bd985a28153e7f7a1e1b1ea9",
"shasum": ""
},
"require": {
@ -194,7 +199,7 @@
],
"description": "FuelPHP 1.x Core",
"homepage": "https://github.com/fuel/core",
"time": "2019-08-29T21:10:06+00:00"
"time": "2019-10-25T14:09:36+00:00"
},
{
"name": "fuel/email",
@ -427,16 +432,16 @@
},
{
"name": "monolog/monolog",
"version": "1.24.0",
"version": "1.25.3",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266"
"reference": "fa82921994db851a8becaf3787a9e73c5976b6f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
"reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1",
"reference": "fa82921994db851a8becaf3787a9e73c5976b6f1",
"shasum": ""
},
"require": {
@ -501,7 +506,7 @@
"logging",
"psr-3"
],
"time": "2018-11-05T09:00:11+00:00"
"time": "2019-12-20T14:15:16+00:00"
},
{
"name": "paragonie/random_compat",
@ -550,16 +555,16 @@
},
{
"name": "paragonie/sodium_compat",
"version": "v1.10.1",
"version": "v1.13.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/sodium_compat.git",
"reference": "5115fa44886d1c2785d2f135ef4626db868eac4b"
"reference": "bbade402cbe84c69b718120911506a3aa2bae653"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/5115fa44886d1c2785d2f135ef4626db868eac4b",
"reference": "5115fa44886d1c2785d2f135ef4626db868eac4b",
"url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/bbade402cbe84c69b718120911506a3aa2bae653",
"reference": "bbade402cbe84c69b718120911506a3aa2bae653",
"shasum": ""
},
"require": {
@ -567,7 +572,7 @@
"php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8"
},
"require-dev": {
"phpunit/phpunit": "^3|^4|^5"
"phpunit/phpunit": "^3|^4|^5|^6|^7"
},
"suggest": {
"ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.",
@ -628,7 +633,7 @@
"secret-key cryptography",
"side-channel resistant"
],
"time": "2019-07-12T16:36:59+00:00"
"time": "2020-03-20T21:48:09+00:00"
},
{
"name": "phpseclib/phpseclib",
@ -720,16 +725,16 @@
},
{
"name": "psr/log",
"version": "1.1.0",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
"shasum": ""
},
"require": {
@ -738,7 +743,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.1.x-dev"
}
},
"autoload": {
@ -763,7 +768,7 @@
"psr",
"psr-3"
],
"time": "2018-11-20T15:27:04+00:00"
"time": "2020-03-23T09:12:05+00:00"
}
],
"packages-dev": [

@ -11,6 +11,8 @@ class Controller_Home extends Controller_Template
{
public $template = 'layout/index';
private $_user;
public function before()
{
parent::before();
@ -21,21 +23,19 @@ class Controller_Home extends Controller_Template
if(null === $user)
Response::redirect('/login');
$server = $sessionServer ? Model_Server::find_by_pk($sessionServer->id) : (Model_Server::find_one_by('user_id', $user->id) ?: Model_Server::find_one_by([
$this->_user = $user;
$server = $sessionServer ? Model_Server::find_by_pk($sessionServer->id) : Model_Server::find_one_by([
['online', '=', 1],
['disable', '=', 0],
], null, null)[0]
);
if(!$server)
Response::redirect('/login');
], null, null);
Lang::load('menu');
Lang::load('settings');
$this->template->title = 'Home';
$libraries = $server->getLibraries();
$libraries = $server? $server->getLibraries() : null;
$this->template->servers = Model_Server::find([
'where' => [
@ -69,12 +69,18 @@ class Controller_Home extends Controller_Template
Session::delete('server');
Session::set('server', $this->template->MenuServer);
$this->template->MenuLibraries = $this->template->MenuServer->getLibraries();
$this->template->MenuLibraries = $this->template->MenuServer ? $this->template->MenuServer->getLibraries() : null;
$watching_movies = Model_User_Watching::find_by([
['user_id', '=', $this->_user->id],
['isFinish', '=', 0]
]);
$episodes = $this->template->MenuServer->getThirtyLastedTvShows();
$episodes = $this->template->MenuServer ? $this->template->MenuServer->getThirtyLastedTvShows() : null;
$movies = $this->template->MenuServer->getThirtyLastedMovies();
$movies = $this->template->MenuServer ? $this->template->MenuServer->getThirtyLastedMovies() : null;
$body->set('watching_movies', $watching_movies);
$body->set('episodes', $episodes);
$body->set('movies', $movies);

@ -43,4 +43,35 @@ class Controller_Rest_Movie extends Controller_Rest
return $this->response($exception->getMessage(), 500);
}
}
public function post_watching()
{
try {
$user = Session::get('user');
$movie_id = Input::post('movie_id');
$totaltime = Input::post('totaltime');
$timeplay = Input::post('timeplay');
$isFinish = Input::post('isFinish');
$watching = Model_User_Watching::find_one_by([
['movie_id', '=', $movie_id],
['user_id', '=', $user->id]
]) ?: new Model_User_Watching();
$watching->set([
'user_id' => $user->id,
'movie_id' => $movie_id,
'ended_time' => $totaltime,
'watching_time' => $timeplay,
'isFinish' => ($isFinish === 'true' ? true : false)
]);
$watching->save();
return $this->response('OK', 200);
} catch (Exception $exception) {
return $this->response($exception->getMessage(), 500);
}
}
}

@ -13,5 +13,4 @@ class Model_Library_Permission extends Model_Overwrite
'value',
'disable'
);
}

@ -1,5 +1,7 @@
<?php
use Fuel\Core\Session;
class Model_Permission extends Model_Overwrite
{
/**
@ -24,12 +26,9 @@ class Model_Permission extends Model_Overwrite
* @param Model_Movie $movie
* @return bool
*/
public static function isGranted($permission, Model_Movie $movie)
public static function isGranted($permission, Model_Library $library = null, $data = null )
{
if ($movie === null)
return false;
$library = $movie->getLibrary();
$user = Session::get('user');
if ($library === null)
return false;
@ -37,7 +36,7 @@ class Model_Permission extends Model_Overwrite
$permission = Model_Permission::find_one_by('name', $permission);
if ($permission === null)
return true;
return false;
$library_permission = Model_Library_Permission::find_one_by([
['library_id', '=', $library->id],
@ -45,17 +44,30 @@ class Model_Permission extends Model_Overwrite
['disable', '=', 0]
]);
if ($library_permission === null)
return true;
if ($permission->name === 'RIGHT_WATCH_DISABLED')
return false;
if ($permission->name === 'RIGHT_WATCH_DISABLED') {
if($library_permission !== null && $library_permission->value === 1)
return false;
else if($library_permission !== null && $library_permission->value === 0)
return true;
else if($library_permission === null)
return true;
else
return false;
}
if ($permission->name === 'RIGHT_DOWNLOAD_DISABLED')
return false;
if ($permission->name === 'RIGHT_DOWNLOAD_DISABLED') {
if($library_permission !== null && $library_permission->value === 1)
return false;
else if($library_permission !== null && $library_permission->value === 0)
return true;
else if($library_permission === null)
return true;
else
return false;
}
if ($permission->name === 'RIGHT_MAX_DOWNLOAD') {
/** @TODO IF (NUMBER_DOWNLOAD <= MAX_DOWNLOAD)
/** @TODO IF (NUMBER_DOWNLOAD <= MAX_DOWNLOAD) // in last 24h
* RETURN TRUE
* ELSE
* RETURN FALSE
@ -64,7 +76,7 @@ class Model_Permission extends Model_Overwrite
}
if ($permission->name === 'RIGHT_MAX_WATCH') {
/** @TODO IF (NUMBER_WATCH <= MAX_WATCH)
/** @TODO IF (NUMBER_WATCH <= MAX_WATCH) // in last 24h
* RETURN TRUE
* ELSE
* RETURN FALSE
@ -82,12 +94,14 @@ class Model_Permission extends Model_Overwrite
}
if ($permission->name === 'RIGHT_MAX_CONCURRENT_STREAM') {
/** @TODO IF (VIDEO SETTINGS QUALITY <= MAX_QUALITY)
/** @TODO IF (CURRENT STREAMING <= MAX_CONCURRENT_STREAM)
* RETURN TRUE
* ELSE
* RETURN FALSE
*/
return true;
}
return false;
}
}

@ -153,14 +153,14 @@ class Model_Server extends Model_Overwrite
foreach ($datas as $tvshow) {
if($tvshow->type === 'season') {
$tvshows[] = Model_Season::find_one_by('plex_key', $tvshow->ratingKey) ?: new Model_Season();
$tvshows[] = Model_Season::find_one_by('plex_key', $tvshow->ratingKey) ?: Model_Season::forge(['plex_key' => $tvshow->ratingKey]);
} else if($tvshow->type === 'episode') {
$tvshows[] = Model_Movie::find_one_by('plex_key', $tvshow->key) ?: new Model_Movie();
$tvshows[] = Model_Movie::find_one_by('plex_key', $tvshow->key) ?: Model_Movie::forge(['plex_key' => $tvshow->key]);
}
}
Cache::set($this->id . '.getThirtyLastedTvShows', $tvshows, 6 * 60);
Cache::set($this->id . '.getThirtyLastedTvShows', $tvshows, 4 * 60);
return $tvshows;
@ -228,7 +228,8 @@ class Model_Server extends Model_Overwrite
$movies = [];
foreach ($datas as $movie) {
$movies[] = Model_Movie::find_one_by('plex_key', $movie->key) ?: new Model_Movie();
$tmp_movie = Model_Movie::find_one_by('plex_key', $movie->key);
$movies[] = $tmp_movie !== null ? $tmp_movie : Model_Movie::forge(['plex_key' => $movie->key]);
}
Cache::set($this->id . '.getThirtyLastedMovies', $movies, 6 * 60);

@ -15,4 +15,13 @@ class Model_User_Watching extends Model_Overwrite
'isFinish'
);
private $_movie = null;
public function getMovie()
{
if(!$this->_movie && $this->movie_id !== null)
$this->_movie = Model_Movie::find_by_pk($this->movie_id);
return $this->_movie;
}
}

@ -11,13 +11,114 @@
<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;">
<?php use Fuel\Core\Debug;
if ($watching_movies) : ?>
<div class="HubCell-hubCell-3Ys17" style="visibility: visible;" data-qa-id="hub--home.continue">
<div class="HubCellHeader-hubCellHeader-2pvYN HubCellHeader-hubCellHeader-2pvYN">
<div class="MetadataHubCellHeader-title-3ngFlY HubCellTitle-hubCellTitle-2abIn"
data-qa-id="hubCellTitle">CONTINUER À REGARDER<span
class="MetadataHubCellHeader-titleSeparator-2XLwHj DashSeparator-separator-2a3yn">—</span><span
class="MetadataHubCellHeader-sourceTitle-VjjOkx">Hack-Free</span></div>
</div>
<div style="height: 233px; overflow: hidden;">
<div class="Measure-container-2XznZ">
<div class="HubCell-hubScroller-2qgkrG VirtualListScroller-scroller-37EU_ Scroller-scroller-d5-b- Scroller-horizontal-1k8ET ">
<div class=" " style="width: auto; height: 233px;">
<?php
$translate = -292;
foreach ($watching_movies as $watching_movie) :
?>
<div style="position: absolute; width: 282px; height: 218px; transform: translate3d(<?php echo $translate += 294; ?>px, 10px, 0px); z-index: 0; transition: none 0s ease 0s;"
data-qa-id="cellItem">
<div class="MetadataPosterCard-cardContainer-2gRcQ">
<div class="MetadataPosterCard-card-3bztR" style="width: 282px; height: 159px;">
<div class="MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG">
<i class="plex-icon-shows-560 MetadataPosterCardIcon-placeholderIcon-2P76z" aria-hidden="true" style="font-size: 32px; line-height: 159px;"></i>
<div class="PosterCardImg-imageContainer-1Ar4M"
data-watching-movie-id="<?php echo $watching_movie->movie_id; ?>" data-art="true">
<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-background-2EwyB"></div>
<?php if ($watching_movie->getMovie()->type === 'movie') : ?>
<a href="/movie/<?php echo $watching_movie->movie_id; ?>"
<?php else: ?>
<a href="/episode/<?php echo $watching_movie->movie_id; ?>"
<?php endif; ?>
role="link"
class="MetadataPosterCardOverlay-link-1Swhl Link-link-2XYrU Link-default-32xSO">
</a>
<button data-id=""
tabindex="-1"
role="button"
class="MetadataPosterCardOverlay-playButton-1fjhk PlayButton-playButton-3WX8X MetadataPosterCardOverlay-button-M43H- Link-link-2XYrU Link-default-32xSO"
type="button">
<div class="MetadataPosterCardOverlay-playCircle-M67q6 PlayButton-playCircle-3Evfd MetadataPosterCardOverlay-centerCircle-1Mg-s">
<i class="plex-icon-play-560 PlayButton-playIcon-dt3sk"
aria-hidden="true"></i></div>
</button>
</div>
</div>
</div>
</div>
<div data-qa-id="metadataTitleContainer"
class="MetadataPosterCell-continueWatchingTitleContainer-3yCAY">
<div class="MetadataPosterCell-splitTitleContainer-RAVdFk">
<?php if($watching_movie->getMovie()->type === 'movie')
$title = $watching_movie->getMovie()->title;
else
$title = $watching_movie->getMovie()->getTvShow()->title
?>
<a title="<?php echo $title; ?>" href="#" role="link" class="MetadataPosterTitle-singleLineTitle-24_DNu MetadataPosterTitle-title-3tU5F MetadataPosterTitle-isSplitLeft-1zfWS Link-link-2XYrU Link-default-32xSO">
<?php echo $title; ?>
</a><span class="MetadataPosterTitle-singleLineTitle-24_DNu MetadataPosterTitle-title-3tU5F MetadataPosterTitle-isSecondary-2VUxY MetadataPosterTitle-isSplitRight-lf6Nx">
<?php echo (int)(($watching_movie->ended_time - $watching_movie->watching_time) / 60); ?> min restantes
</span>
</div>
<span class="MetadataPosterTitle-singleLineTitle-24_DNu MetadataPosterTitle-title-3tU5F MetadataPosterTitle-isSecondary-2VUxY">
<?php if ($watching_movie->getMovie()->type === 'movie') : ?>
<span>
<a title="<?php echo $watching_movie->getMovie()->year; ?>" href="#" role="link"
class="Link-link-2n0yJn Link-default-2XA2bN"><?php echo $watching_movie->getMovie()->year; ?></a>
</span>
<?php else: ?>
<span>
<a title="Saison 1" href="/season/<?php echo $watching_movie->getMovie()->getSeason()->id; ?>" role="link" class="Link-link-2XYrU Link-default-32xSO">
S<?php echo $watching_movie->getMovie()->getSeason()->number; ?>
</a>
<span class="DashSeparator-separator-4CyEFW">·</span>
<a title="<?php echo $watching_movie->getMovie()->title; ?>" href="/episode/<?php echo $watching_movie->getMovie()->id; ?>" role="link" class="Link-link-2XYrU Link-default-32xSO">
E<?php echo $watching_movie->getMovie()->number; ?>
</a>
</span>
<span class="DashSeparator-separator-4CyEFW"></span>
<a title="<?php echo $watching_movie->getMovie()->title; ?>" href="/episode/<?php echo $watching_movie->getMovie()->id; ?>" role="link" class="Link-link-2XYrU Link-default-32xSO">
<?php echo $watching_movie->getMovie()->title; ?>
</a>
<?php endif; ?>
</span>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="Measure-scrollContainer-1c6dyV">
<div class="Measure-expandContent-zsLw6n"></div>
</div>
<div class="Measure-scrollContainer-1c6dyV">
<div class="Measure-shrinkContent-303GSV Measure-expandContent-zsLw6n"></div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="HubCell-hubCell-3Ys17" data-qa-id="tv_show"
style="visibility: visible;">
<div class="HubCellHeader-hubCellHeader-2pvYN">
<div class="HubCellTitle-hubCellTitle-2abIn">
<a href="#" role="link" class="Link-link-2XYrU Link-default-32xSO"><?php use Fuel\Core\Debug;
echo strtoupper(__('recently.tv_shows')); ?></a>
<a href="#" role="link" class="Link-link-2XYrU Link-default-32xSO"><?php echo strtoupper(__('recently.tv_shows')); ?></a>
<span class="PrePlayStatusButton-statusButton-28XJ7 Button-button--JvPI Button-small-3Zwli"><?php echo $episodes !== null ? count($episodes) : 0; ?></span>
</div>
<div class="HubCell-hubActions-28w1- tv-shows-hubcell">
@ -37,11 +138,13 @@
<div class="Measure-container-2XznZ">
<div id="tv_show_list"
class="VirtualListScroller-scroller-37EU_ Scroller-scroller-d5-b- Scroller-horizontal-1k8ET ">
<div class=" " style="width: 4540px; height: 275px;">
<div class=" " style="width: auto; height: 275px;">
<?php if ($episodes) : ?>
<?php
$translate = -150;
foreach ($episodes as $episode) :
if(!isset($episode->id))
continue;
?>
<div class=" virtualized-cell-3KPHx "
style="position: absolute; width: 127px; height: 260px; transform: translate3d(<?php echo $translate += 152; ?>px, 10px, 0px);">
@ -161,6 +264,8 @@
<?php
$translate = -150;
foreach ($movies as $movie) :
if(!isset($movie->id))
continue;
?>
<div class=" virtualized-cell-3KPHx "
style="position: absolute; width: 127px; height: 240px; transform: translate3d(<?php echo $translate += 152; ?>px, 10px, 0px);">
@ -242,12 +347,15 @@
});
});
/** LOADING PICTURE **/
$('.PosterCardImg-imageContainer-1Ar4M[data-movie-id], .PosterCardImg-imageContainer-1Ar4M[data-season-id]').each(function (index, element) {
$('.PosterCardImg-imageContainer-1Ar4M[data-watching-movie-id], .PosterCardImg-imageContainer-1Ar4M[data-movie-id], .PosterCardImg-imageContainer-1Ar4M[data-season-id]').each(function (index, element) {
let watching_movie_id = $(element).data('watching-movie-id');
watching_movie_id ? $('[data-watching-movie-id="' + watching_movie_id + '"] > div').css('background-image', 'url("/cover/movie?movie_id=' + watching_movie_id + '&width=' + 375 + '&height=' + 211 + '&art=true")') : null;
let movie_id = $(element).data('movie-id');
movie_id ? $('[data-movie-id="' + movie_id + '"] > div').css('background-image', 'url("/cover/movie?movie_id=' + movie_id + '&width=' + 175 + '&height=' + 263 + '")') : null;
let season_id = $(element).data('season-id');
season_id ? $('[data-season-id="' + season_id + '"] > div').css('background-image', 'url("/cover/season?season_id='+ season_id +'&width='+ 175 +'&height='+ 263 +'")') : null;
season_id ? $('[data-season-id="' + season_id + '"] > div').css('background-image', 'url("/cover/season?season_id='+ season_id +'&width=' + 175 + '&height=' + 263 + '")') : null;
});
/** SCROLL LIST TV SHOWS AND MOVIES **/
$('.HubCell-hubActions-28w1- button').on('click', function () {
@ -255,31 +363,33 @@
var select = $(parent).data('qa-id');
var previous = $(parent).find('button[data-hubcell-action="previous"]');
var next = $(parent).find('button[data-hubcell-action="next"]');
var list = $('#' + select + '_list');
console.log(list.scrollLeft(), list.width());
if ($(this).data('hubcell-action') === 'previous') {
$('#' + select + '_list').animate({scrollLeft: $('#' + select + '_list').scrollLeft() - 152 * 2}, 200);
list.animate({scrollLeft: list.scrollLeft() - list.width()}, 200);
setTimeout(function () {
if ($('#' + select + '_list').scrollLeft() <= (150 * 19)) {
if (list.scrollLeft() <= (150 * 19)) {
$(next).removeClass('isDisabled');
}
if ($('#' + select + '_list').scrollLeft() === 0) {
if (list.scrollLeft() === 0) {
$(previous).addClass('isDisabled');
}
}, 100);
}
if ($(this).data('hubcell-action') === 'next') {
$('#' + select + '_list').animate({scrollLeft: $('#' + select + '_list').scrollLeft() + 152 * 2}, 300);
list.animate({scrollLeft: list.scrollLeft() + list.width()}, 300);
setTimeout(function () {
if ($('#' + select + '_list').scrollLeft() > 0) {
if (list.scrollLeft() > 0) {
$(previous).removeClass('isDisabled');
}
if ($('#' + select + '_list').scrollLeft() >= (150 * 19)) {
if (list.scrollLeft() >= (150 * 19)) {
$(next).addClass('isDisabled');
}
if ($('#' + select + '_list').scrollLeft() === 0) {
if (list.scrollLeft() === 0) {
$(next).addClass('isDisabled');
}
}, 100);

@ -25,10 +25,10 @@
<div>
</div>
</div>
<?php if($servers > 0) : ?>
<div class="Menu-menuPortal-2JtDz"
style="position: absolute; transform: translate3d(5px, 120px, 0px); top: 0px; left: 0px; will-change: transform; display: none"
x-placement="bottom-start">
<div data-reactroot="" id="id-1">
style="position: absolute; transform: translate3d(5px, 120px, 0px); top: 0px; left: 0px; will-change: transform; display: none" x-placement="bottom-start">
<div id="id-1">
<div role="menu"
class="ServerMenu-serverMenu-6KNnX MenuContainer-menu-3Gtlw MenuContainer-medium-2XOYJ">
<div class="ServerMenu-serverMenuScroller-1nSX6 Menu-menuScroller-E0NwY Scroller-vertical-1bgGS Scroller-scroller-d5-b- Scroller-auto-3t4gM"
@ -62,6 +62,7 @@
</div>
</div>
</div>
<?php endif; ?>
<div id="divVideo" style="display: none">
<div id="movie_stream" style="height: 100%"></div>
<div id="video_controls" class="AudioVideoPlayerView-container-kWiFs"></div>

@ -25,7 +25,7 @@
<a class="settings-btn dropdown-poster-container" href="/settings" data-toggle="tooltip"
data-placement="bottom" title="<?php echo __('settings'); ?>">
<i class="glyphicon settings"></i>
<span class="total-badge badge" style="position: absolute;top: 34px;left: 5px">0</span>
<span class="total-badge badge hidden" style="position: absolute;top: 34px;left: 5px">0</span>
</a>
</li>
<li id="nav-dropdown" class="nav-dropdown dropdown">
@ -34,7 +34,7 @@
<div class="media-poster img-circle loaded"></div>
<i class="caret-icon"></i>
</div>
<span class="total-badge badge">0</span>
<span class="total-badge badge hidden">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>

@ -5,9 +5,11 @@
<div class="PageHeaderRight-pageHeaderRight-2CT0g">
<div class="pageHeaderToolbar-toolbarContainer-2N-IJ Measure-container-2XznZ">
<div class="pageHeaderToolbar-toolbar-1lW-M">
<?php if(Model_Permission::isGranted('RIGHT_DOWNLOAD_DISABLED', $movie->getLibrary())) : ?>
<a title="<?php echo __('download'); ?>" href="<?php echo $movie->getDownloadLink() ?>" 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-sync-560" aria-hidden="true"></i>
</a>
<?php endif; ?>
</div>
</div>
<div class="PrePlayPageHeader-divider-WQRk8 PageHeaderDivider-pageHeaderDivider-DvwUq"></div>

@ -9,7 +9,7 @@
width: 100%;
height: 100%;
}
.PlayPauseOverlay-playButton-25OfW.PlayButton-playButton-3WX8X.Link-link-2n0yJ.Link-default-2XA2b {
.PlayPauseOverlay-playButton-25OfW.PlayButton-playButton-3WX8X.Link-link-2XYrU.Link-default-32xSO {
background-color: rgba(0,0,0,0);
border: none;
}

@ -13,6 +13,25 @@ function toHHMMSS(num) {
return times + minutes + ':' + seconds;
}
async function updateWatching(movie_id, totaltime, timeplay, isFinish = false){
$.ajax({
url: '/rest/movie/watching',
method: 'POST',
data: {
movie_id: movie_id,
totaltime: totaltime,
timeplay: timeplay,
isFinish: isFinish
},
dataType: 'json'
}).done(function (data) {
}).fail(function (data) {
console.error(data.responseText);
show_alert('error', data.responseText);
});
}
let player = null;
let sliderTrack = null;
let sliderSound = null;
@ -40,8 +59,12 @@ function launchPlayer(view) {
let width = window.innerWidth;
let height = window.innerHeight;
let lastUpdateTime = 0;
document.querySelector('#divVideo').style.backgroundImage = 'url("/cover/movie?movie_id=' + movie_id + '&width=' + width + '&height=' + height + '&art=true")';
document.querySelector('#divVideo').style.backgroundColor = '#000000';
document.querySelector('#divVideo').style.backgroundRepeat = 'no-repeat';
document.querySelector('#divVideo').style.backgroundSize = '100% 100%';
initSliders();
@ -90,6 +113,16 @@ function launchPlayer(view) {
} else {
removeNext();
}
let now = Date.now();
if(totaltime !== null && timeplay !== 0 && (lastUpdateTime === 0 || (lastUpdateTime + 10*1000) < now)) {
lastUpdateTime = now;
updateWatching(movie_id, totaltime, timeplay, (percent > 97));
}
},
onError: function (error) {
console.error(error);
}
}
});

@ -1,4 +1,4 @@
function show_alert(type, message) {
function show_alert(type, message, time = 1000) {
var div_container = document.createElement('div');
var button_close = document.createElement('button');
var i_remove = document.createElement('i');
@ -23,7 +23,7 @@ function show_alert(type, message) {
document.body.appendChild(div_container);
setTimeout(hide_alert, 1000);
setTimeout(hide_alert, time);
}
function hide_alert() {

Loading…
Cancel
Save