add icon before cover, tooltip

pull/9/head
Chewbaka69 6 years ago
parent 4f2ddc8f22
commit d271b963ef

@ -8,6 +8,7 @@ use Fuel\Core\Cache;
use Fuel\Core\CacheNotFoundException; use Fuel\Core\CacheNotFoundException;
use Fuel\Core\Database_Query_Builder_Select; use Fuel\Core\Database_Query_Builder_Select;
use Fuel\Core\FuelException; use Fuel\Core\FuelException;
use Fuel\Core\RequestStatusException;
class Model_Movie extends Model_Overwrite class Model_Movie extends Model_Overwrite
{ {
@ -48,7 +49,7 @@ class Model_Movie extends Model_Overwrite
public function getSeason() public function getSeason()
{ {
if(!$this->_season) if(!$this->_season && $this->season_id !== null)
$this->_season = Model_Season::find_by_pk($this->season_id); $this->_season = Model_Season::find_by_pk($this->season_id);
return $this->_season; return $this->_season;
@ -58,7 +59,9 @@ class Model_Movie extends Model_Overwrite
{ {
if(!$this->_tv_show) { if(!$this->_tv_show) {
$season = $this->getSeason(); $season = $this->getSeason();
$this->_tv_show = Model_Tvshow::find_by_pk($season->tv_show_id);
if($season !== null)
$this->_tv_show = Model_Tvshow::find_by_pk($season->tv_show_id);
} }
return $this->_tv_show; return $this->_tv_show;
@ -107,6 +110,7 @@ class Model_Movie extends Model_Overwrite
if ($thumb) if ($thumb)
return $thumb; return $thumb;
} catch (CacheNotFoundException $e) { } catch (CacheNotFoundException $e) {
if($this->type === 'episode') if($this->type === 'episode')
$this->getPicture($this->_season->thumb,$path_cache, $width, $height); $this->getPicture($this->_season->thumb,$path_cache, $width, $height);
else if($this->type === 'movie') else if($this->type === 'movie')
@ -124,10 +128,10 @@ class Model_Movie extends Model_Overwrite
$curl = null; $curl = null;
if(!$width && !$height) if (!$width && !$height)
$curl = Request::forge('http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : '') . $path . '?X-Plex-Token=' . $this->_server->token, 'curl'); $curl = Request::forge('http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : '') . $path . '?X-Plex-Token=' . $this->_server->token, 'curl');
else else
$curl = Request::forge('http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : '') . '/photo/:/transcode?width='.$width.'&height='.$height.'&minSize=1&url='.$path.'&X-Plex-Token='.$this->_server->token, 'curl'); $curl = Request::forge('http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : '') . '/photo/:/transcode?width=' . $width . '&height=' . $height . '&minSize=1&url=' . $path . '&X-Plex-Token=' . $this->_server->token, 'curl');
$curl->execute(); $curl->execute();
@ -255,7 +259,8 @@ class Model_Movie extends Model_Overwrite
$language = isset($user_settings->language) ? $user_settings->language : false; $language = isset($user_settings->language) ? $user_settings->language : false;
$request = 'http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : ''); $request = 'http://' . $this->_server->url . ($this->_server->port ? ':' . $this->_server->port : '');
$request .= '/video/:/transcode/universal/start.m3u8'; //$request .= '/video/:/transcode/universal/decision?hasMDE=1'; // DASH
$request .= '/video/:/transcode/universal/start.m3u8'; // HLS
$request .= '?identifier=[PlexShare]'; $request .= '?identifier=[PlexShare]';
$request .= '&path=http%3A%2F%2F127.0.0.1%3A32400' . urlencode($this->plex_key); $request .= '&path=http%3A%2F%2F127.0.0.1%3A32400' . urlencode($this->plex_key);
$request .= '&mediaIndex=0'; $request .= '&mediaIndex=0';

@ -47,6 +47,7 @@
<div class="MetadataPosterCard-card-3bztR " <div class="MetadataPosterCard-card-3bztR "
style="width: 127px; height: 191px;"> style="width: 127px; height: 191px;">
<div class="MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG "> <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: 191px;"></i>
<div class="PosterCardImg-imageContainer-1Ar4M" <div class="PosterCardImg-imageContainer-1Ar4M"
data-movie-id="<?php echo $episode->id; ?>"> 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;" <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;"
@ -178,6 +179,7 @@
<div class="MetadataPosterCard-card-3bztR " <div class="MetadataPosterCard-card-3bztR "
style="width: 127px; height: 191px;"> style="width: 127px; height: 191px;">
<div class="MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG "> <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: 191px;"></i>
<div class="PosterCardImg-imageContainer-1Ar4M" <div class="PosterCardImg-imageContainer-1Ar4M"
data-movie-id="<?php echo $movie->id; ?>"> 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;" <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;"

@ -57,6 +57,7 @@
data-qa-id="metadataPosterCard--/library/metadata/1"> data-qa-id="metadataPosterCard--/library/metadata/1">
<div class="MetadataPosterCard-card-3bztR " style="width: 126px; height: 189px;"> <div class="MetadataPosterCard-card-3bztR " style="width: 126px; height: 189px;">
<div class="MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG "> <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: 189px;"></i>
<div class="PosterCardImg-imageContainer-1Ar4M" <div class="PosterCardImg-imageContainer-1Ar4M"
<?php if(get_class($movie) === Model_Movie::class) : ?> <?php if(get_class($movie) === Model_Movie::class) : ?>
data-movie-id="<?php echo $movie->id; ?>" data-movie-id="<?php echo $movie->id; ?>"
@ -247,12 +248,18 @@
}); });
/** LOAD IMAGES **/ /** LOAD IMAGES **/
$('.PosterCardImg-imageContainer-1Ar4M[data-movie-id]').each(function (index, element) { $('.PosterCardImg-imageContainer-1Ar4M[data-movie-id]').each(function (index, element) {
var movie_id = $(element).data('movie-id'); /** IF USING CLOUDFLARE TOO MANY REQUEST **/
$('[data-movie-id="' + movie_id + '"] > div').css('background-image', 'url("/cover/movie?movie_id='+ movie_id +'&width='+ 160 +'&height='+ 236 +'")'); setTimeout(function() {
var movie_id = $(element).data('movie-id');
$('[data-movie-id="' + movie_id + '"] > div').css('background-image', 'url("/cover/movie?movie_id=' + movie_id + '&width=' + 160 + '&height=' + 236 + '")');
}, 10 * index);
}); });
$('.PosterCardImg-imageContainer-1Ar4M[data-tvshow-id]').each(function (index, element) { $('.PosterCardImg-imageContainer-1Ar4M[data-tvshow-id]').each(function (index, element) {
var tvshow_id = $(element).data('tvshow-id'); /** IF USING CLOUDFLARE TOO MANY REQUEST **/
$('[data-tvshow-id="' + tvshow_id + '"] > div').css('background-image', 'url("/cover/tvshow?tvshow_id='+ tvshow_id +'&width='+ 160 +'&height='+ 236 +'")'); setTimeout(function() {
var tvshow_id = $(element).data('tvshow-id');
$('[data-tvshow-id="' + tvshow_id + '"] > div').css('background-image', 'url("/cover/tvshow?tvshow_id='+ tvshow_id +'&width='+ 160 +'&height='+ 236 +'")');
}, 10 * index);
}); });
}); });
</script> </script>

@ -5,7 +5,7 @@
<div class="PageHeaderRight-pageHeaderRight-2CT0g"> <div class="PageHeaderRight-pageHeaderRight-2CT0g">
<div class="pageHeaderToolbar-toolbarContainer-2N-IJ Measure-container-2XznZ"> <div class="pageHeaderToolbar-toolbarContainer-2N-IJ Measure-container-2XznZ">
<div class="pageHeaderToolbar-toolbar-1lW-M"> <div class="pageHeaderToolbar-toolbar-1lW-M">
<button id="id-16" title="Play" data-toggle="tooltip" data-placement="bottom" role="button" <button id="id-16" title="Play" data-toggle="tooltip" data-placement="bottom" data-id="<?php echo $movie->id; ?>" role="button"
class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO" class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
type="button"><i class="plex-icon-toolbar-play-560" aria-hidden="true"></i> type="button"><i class="plex-icon-toolbar-play-560" aria-hidden="true"></i>
</button> </button>
@ -73,21 +73,21 @@
</button> </button>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if((int)$movie->getMetaData()['Media']['@attributes']['videoResolution'] >= 720) : ?> <?php if(isset($movie->getMetaData()['Media']['@attributes']) && (int)$movie->getMetaData()['Media']['@attributes']['videoResolution'] >= 720) : ?>
<div class="col-sm-4 text-center" style="font-size: 35px;"><i class="glyphicon video-hd"></i></div> <div class="col-sm-4 text-center" style="font-size: 35px;"><i class="glyphicon video-hd"></i></div>
<?php else: ?> <?php else: ?>
<div class="col-sm-4 text-center" style="font-size: 35px;"><i class="glyphicon video-sd"></i></div> <div class="col-sm-4 text-center" style="font-size: 35px;"><i class="glyphicon video-sd"></i></div>
<?php endif; ?> <?php endif; ?>
<?php if($movie->getMetaData()['Stream']['Audio'][0]['codec'] === 'ac3') : ?> <?php if(isset($movie->getMetaData()['Stream']['Audio'][0]) && $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> <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 endif; ?>
<?php if(preg_match('/7\.1(\([a-z]*\))?/',$movie->getMetaData()['Stream']['Audio'][0]['audioChannelLayout'])) : ?> <?php if(isset($movie->getMetaData()['Stream']['Audio'][0]) && 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> <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'])) : ?> <?php elseif (isset($movie->getMetaData()['Stream']['Audio'][0]) && 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> <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'])) : ?> <?php elseif (isset($movie->getMetaData()['Stream']['Audio'][0]) && 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> <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; ?> <?php endif; ?>
</div> </div>
@ -213,21 +213,25 @@
<div class="PrePlayDetailsGroupItem-groupItem-3Tut9"> <div class="PrePlayDetailsGroupItem-groupItem-3Tut9">
<div class="PrePlayDetailsGroupItem-label-2Ee43">Vidéo</div> <div class="PrePlayDetailsGroupItem-label-2Ee43">Vidéo</div>
<div class="PrePlayDetailsGroupItem-content-1aRNU"> <div class="PrePlayDetailsGroupItem-content-1aRNU">
<?php if (isset($movie->getMetaData()['Media']['@attributes'])) : ?>
<span data-qa-id="videoStream"> <span data-qa-id="videoStream">
<?php echo $movie->getMetaData()['Media']['@attributes']['videoResolution']; ?>p <?php echo $movie->getMetaData()['Media']['@attributes']['videoResolution']; ?>p
<span class="DashSeparator-separator-2a3yn"></span> <span class="DashSeparator-separator-2a3yn"></span>
<?php echo $movie->getMetaData()['Stream']['Video'][0]['codec']; ?> <?php echo $movie->getMetaData()['Stream']['Video'][0]['codec']; ?>
</span> </span>
<?php endif; ?>
</div> </div>
</div> </div>
<div class="PrePlayDetailsGroupItem-groupItem-3Tut9"> <div class="PrePlayDetailsGroupItem-groupItem-3Tut9">
<div class="PrePlayDetailsGroupItem-label-2Ee43">Audio</div> <div class="PrePlayDetailsGroupItem-label-2Ee43">Audio</div>
<div class="PrePlayDetailsGroupItem-content-1aRNU"> <div class="PrePlayDetailsGroupItem-content-1aRNU">
<?php if (isset($movie->getMetaData()['Stream']['Audio'][0])) : ?>
<span> <span>
<?php echo isset($movie->getMetaData()['Stream']['Audio'][0]['language']) ? $movie->getMetaData()['Stream']['Audio'][0]['language'] : ''; ?> <?php echo isset($movie->getMetaData()['Stream']['Audio'][0]['language']) ? $movie->getMetaData()['Stream']['Audio'][0]['language'] : ''; ?>
<span class="DashSeparator-separator-2a3yn"></span> <span class="DashSeparator-separator-2a3yn"></span>
<?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']); ?> <?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> </span>
<?php endif; ?>
</div> </div>
</div> </div>
<div class="PrePlayDetailsGroupItem-groupItem-3Tut9"> <div class="PrePlayDetailsGroupItem-groupItem-3Tut9">
@ -363,7 +367,7 @@
} }
}); });
/** LAUNCH PLAYER **/ /** LAUNCH PLAYER **/
$(document).on('click', '.MetadataPosterCardOverlay-playButton-1fjhk.PlayButton-playButton-3WX8X', function (event) { $(document).on('click', '#id-16, .MetadataPosterCardOverlay-playButton-1fjhk.PlayButton-playButton-3WX8X', function (event) {
event.stopPropagation(); event.stopPropagation();
var movie_id = $(this).data('id'); var movie_id = $(this).data('id');
$.ajax({ $.ajax({

@ -57,6 +57,7 @@
data-qa-id="metadataPosterCard--/library/metadata/1"> data-qa-id="metadataPosterCard--/library/metadata/1">
<div class="MetadataPosterCard-card-3bztR " style="width: 126px; height: 189px;"> <div class="MetadataPosterCard-card-3bztR " style="width: 126px; height: 189px;">
<div class="MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG "> <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: 30px; line-height: 189px;"></i>
<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;" <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> class=""></div>
@ -330,8 +331,11 @@
}); });
/** LOAD IMAGES **/ /** LOAD IMAGES **/
$('.PosterCardImg-imageContainer-1Ar4M[data-movie-id]').each(function (index, element) { $('.PosterCardImg-imageContainer-1Ar4M[data-movie-id]').each(function (index, element) {
var movie_id = $(element).data('movie-id'); /** IF USING CLOUDFLARE TOO MANY REQUEST **/
$('[data-movie-id="' + movie_id + '"] > div').css('background-image', 'url("/cover/movie?movie_id='+ movie_id +'&width='+ 160 +'&height='+ 236 +'")'); setTimeout(function(){
var movie_id = $(element).data('movie-id');
$('[data-movie-id="' + movie_id + '"] > div').css('background-image', 'url("/cover/movie?movie_id='+ movie_id +'&width='+ 160 +'&height='+ 236 +'")');
}, 10 * index);
}); });
}); });
</script> </script>
Loading…
Cancel
Save