|
|
@@ -80,7 +80,7 @@ trait PlexHomepageItem
|
|
|
];
|
|
|
return array_merge($homepageInformation, $homepageSettings);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function testConnectionPlex()
|
|
|
{
|
|
|
if (!empty($this->config['plexURL']) && !empty($this->config['plexToken'])) {
|
|
|
@@ -105,7 +105,7 @@ trait PlexHomepageItem
|
|
|
return 'URL and/or Token not setup';
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function plexHomepagePermissions($key = null)
|
|
|
{
|
|
|
$permissions = [
|
|
|
@@ -185,7 +185,7 @@ trait PlexHomepageItem
|
|
|
];
|
|
|
return $this->homepageCheckKeyPermissions($key, $permissions);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function homepageOrderplexnowplaying()
|
|
|
{
|
|
|
if ($this->homepageItemPermissions($this->plexHomepagePermissions('streams'))) {
|
|
|
@@ -201,7 +201,7 @@ trait PlexHomepageItem
|
|
|
';
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function homepageOrderplexrecent()
|
|
|
{
|
|
|
if ($this->homepageItemPermissions($this->plexHomepagePermissions('recent'))) {
|
|
|
@@ -217,7 +217,7 @@ trait PlexHomepageItem
|
|
|
';
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function homepageOrderplexplaylist()
|
|
|
{
|
|
|
if ($this->homepageItemPermissions($this->plexHomepagePermissions('playlists'))) {
|
|
|
@@ -233,7 +233,7 @@ trait PlexHomepageItem
|
|
|
';
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function getPlexHomepageStreams()
|
|
|
{
|
|
|
if (!$this->homepageItemPermissions($this->plexHomepagePermissions('streams'), true)) {
|
|
|
@@ -272,7 +272,7 @@ trait PlexHomepageItem
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function getPlexHomepageRecent()
|
|
|
{
|
|
|
if (!$this->homepageItemPermissions($this->plexHomepagePermissions('recent'), true)) {
|
|
|
@@ -320,7 +320,7 @@ trait PlexHomepageItem
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function getPlexHomepagePlaylists()
|
|
|
{
|
|
|
if (!$this->homepageItemPermissions($this->plexHomepagePermissions('playlists'), true)) {
|
|
|
@@ -366,7 +366,7 @@ trait PlexHomepageItem
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function getPlexHomepageMetadata($array)
|
|
|
{
|
|
|
if (!$this->homepageItemPermissions($this->plexHomepagePermissions('metadata'), true)) {
|
|
|
@@ -408,7 +408,7 @@ trait PlexHomepageItem
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function getPlexHomepageSearch($query)
|
|
|
{
|
|
|
if (!$this->homepageItemPermissions($this->plexHomepagePermissions('search'), true)) {
|
|
|
@@ -448,7 +448,7 @@ trait PlexHomepageItem
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function resolvePlexItem($item)
|
|
|
{
|
|
|
// Static Height & Width
|
|
|
@@ -488,18 +488,19 @@ trait PlexHomepageItem
|
|
|
$plexItem['metadataKey'] = (string)$item['parentRatingKey'];
|
|
|
break;
|
|
|
case 'episode':
|
|
|
+ $useImage = (isset($item['live']) ? 'plugins/images/cache/livetv.png' : null);
|
|
|
$plexItem['type'] = 'tv';
|
|
|
$plexItem['title'] = (string)$item['grandparentTitle'];
|
|
|
$plexItem['secondaryTitle'] = (string)$item['parentTitle'] . ' - Episode ' . (string)$item['index'];
|
|
|
$plexItem['summary'] = (string)$item['title'];
|
|
|
- $plexItem['ratingKey'] = (string)$item['parentRatingKey'];
|
|
|
+ $plexItem['ratingKey'] = (string)($item['parentRatingKey'] ?? $item['ratingKey']);
|
|
|
$plexItem['thumb'] = ($item['parentThumb'] ? (string)$item['parentThumb'] : (string)$item['grandparentThumb']);
|
|
|
$plexItem['key'] = (string)$item['ratingKey'] . "-list";
|
|
|
$plexItem['nowPlayingThumb'] = (string)$item['grandparentArt'];
|
|
|
$plexItem['nowPlayingKey'] = (string)$item['grandparentRatingKey'] . "-np";
|
|
|
$plexItem['nowPlayingTitle'] = (string)$item['grandparentTitle'] . ' - ' . (string)$item['title'];
|
|
|
$plexItem['nowPlayingBottom'] = 'S' . (string)$item['parentIndex'] . ' · E' . (string)$item['index'];
|
|
|
- $plexItem['metadataKey'] = (string)$item['grandparentRatingKey'];
|
|
|
+ $plexItem['metadataKey'] = (string)($item['grandparentRatingKey'] ?? $item['parentRatingKey'] ?? $item['ratingKey']);
|
|
|
break;
|
|
|
case 'clip':
|
|
|
$useImage = (isset($item['live']) ? "plugins/images/cache/livetv.png" : null);
|
|
|
@@ -531,6 +532,7 @@ trait PlexHomepageItem
|
|
|
$plexItem['metadataKey'] = isset($item['grandparentRatingKey']) ? (string)$item['grandparentRatingKey'] : (string)$item['parentRatingKey'];
|
|
|
break;
|
|
|
default:
|
|
|
+ $useImage = (isset($item['live']) ? 'plugins/images/cache/livetv.png' : null);
|
|
|
$plexItem['type'] = 'movie';
|
|
|
$plexItem['title'] = (string)$item['title'];
|
|
|
$plexItem['secondaryTitle'] = (string)$item['year'];
|
|
|
@@ -641,7 +643,7 @@ trait PlexHomepageItem
|
|
|
}
|
|
|
return $plexItem;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function getTautulliFriendlyNames($bypass = null)
|
|
|
{
|
|
|
$names = [];
|
|
|
@@ -666,7 +668,7 @@ trait PlexHomepageItem
|
|
|
$this->setAPIResponse('success', null, 200, $names);
|
|
|
return $names;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function setTautulliFriendlyNames()
|
|
|
{
|
|
|
if ($this->config['tautulliURL'] && $this->config['tautulliApikey'] && $this->config['homepageUseCustomStreamNames']) {
|
|
|
@@ -680,7 +682,7 @@ trait PlexHomepageItem
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private function formatPlexUserName($item)
|
|
|
{
|
|
|
$name = ($this->config['homepageShowStreamNames'] && $this->qualifyRequest($this->config['homepageShowStreamNamesAuth'])) ? (string)$item->User['title'] : "";
|
|
|
@@ -696,10 +698,10 @@ trait PlexHomepageItem
|
|
|
}
|
|
|
return $name;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function plexLibraryList($value = 'id')
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
if (!empty($this->config['plexToken']) && !empty($this->config['plexID'])) {
|
|
|
$url = 'https://plex.tv/api/servers/' . $this->config['plexID'];
|
|
|
try {
|