Просмотр исходного кода

Added more hompeage options for plex and added album art fallback for plex

causefx 8 лет назад
Родитель
Сommit
d9ffa95410
4 измененных файлов с 63 добавлено и 6 удалено
  1. 6 0
      config/configDefaults.php
  2. 4 2
      functions.php
  3. 4 4
      homepage.php
  4. 49 0
      settings.php

+ 6 - 0
config/configDefaults.php

@@ -9,11 +9,17 @@ return array(
 	"plexRecentTV" => "false",
 	"plexRecentMusic" => "false",
 	"plexPlayingNow" => "false",
+	"plexRecentMovieAuth" => "false",
+	"plexRecentTVAuth" => "false",
+	"plexRecentMusicAuth" => "false",
+	"plexPlayingNowAuth" => "false",
  	"plexShowNames" => false,
 	"plexHomeAuth" => false,
 	"plexSearch" => false,
+	"plexSearchAuth" => false,
 	"plexRecentItems" => "20",
 	"plexPlaylists" => "false",
+	"plexPlaylistsAuth" => "false",
 	"plexTabName" => "",
 	"embyURL" => "",
 	"embyToken" => "",

+ 4 - 2
functions.php

@@ -699,6 +699,7 @@ function resolveEmbyItem($address, $token, $item, $nowPlaying = false, $showName
 function resolvePlexItem($server, $token, $item, $nowPlaying = false, $showNames = false, $role = false, $playlist = false) {
     // Static Height
     $height = 444;
+	$widthOverride = 100;
 	$playlist = ($playlist) ? " playlist-$playlist" : "";
 
     switch ($item['type']) {
@@ -817,7 +818,8 @@ function resolvePlexItem($server, $token, $item, $nowPlaying = false, $showNames
             }else {
                 $height = 281;
                 $width = 500;
-                $thumb = $item['art'];
+				$thumb = ($item['art']) ? $item['art'] :  $item['parentThumb'];
+				$widthOverride = ($item['art']) ? 100 :  56;
                 $key = $item['ratingKey'] . "-np";
                 $elapsed = $item['viewOffset'];
                 $duration = ($item['duration']) ? $item['duration'] : $item->Media['duration'];
@@ -895,7 +897,7 @@ function resolvePlexItem($server, $token, $item, $nowPlaying = false, $showNames
 	$openTab = (PLEXTABNAME) ? "true" : "false";
     // Assemble Item And Cache Into Array
     if($nowPlaying){
-        return '<div class="col-sm-6 col-md-3"><div class="thumbnail ultra-widget"><div style="display: none;" np="'.$id.'" class="overlay content-box small-box gray-bg">'.$streamInfo.'</div><span class="w-refresh w-p-icon gray" link="'.$id.'"><span class="fa-stack fa-lg" style="font-size: .5em"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-info-circle fa-stack-1x fa-inverse"></i></span></span><a class="openTab" extraTitle="'.$title.'" extraType="'.$item['type'].'" openTab="'.$openTab.'" href="'.$address.'" target="_blank"><img style="width: 100%; display:inherit;" src="'.$image_url.'" alt="'.$item['Name'].'"></a><div class="progress progress-bar-sm zero-m"><div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$watched.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$watched.'%"></div><div class="progress-bar palette-Grey-500 bg" style="width: '.$transcoded.'%"></div></div><div class="caption"><i style="float:left" class="fa fa-'.$state.'"></i>'.$topTitle.''.$bottomTitle.'</div></div></div>';
+        return '<div class="col-sm-6 col-md-3"><div class="thumbnail ultra-widget"><div style="display: none;" np="'.$id.'" class="overlay content-box small-box gray-bg">'.$streamInfo.'</div><span class="w-refresh w-p-icon gray" link="'.$id.'"><span class="fa-stack fa-lg" style="font-size: .5em"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-info-circle fa-stack-1x fa-inverse"></i></span></span><a class="openTab" extraTitle="'.$title.'" extraType="'.$item['type'].'" openTab="'.$openTab.'" href="'.$address.'" target="_blank"><img style="width: '.$widthOverride.'%; display:block;" src="'.$image_url.'" alt="'.$item['Name'].'"></a><div class="progress progress-bar-sm zero-m"><div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$watched.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$watched.'%"></div><div class="progress-bar palette-Grey-500 bg" style="width: '.$transcoded.'%"></div></div><div class="caption"><i style="float:left" class="fa fa-'.$state.'"></i>'.$topTitle.''.$bottomTitle.'</div></div></div>';
     }else{
         return '<div class="item-'.$item['type'].$playlist.'"><a class="openTab" extraTitle="'.$title.'" extraType="'.$item['type'].'" openTab="'.$openTab.'" href="'.$address.'" target="_blank"><img alt="'.$item['Name'].'" class="'.$image.'" data-lazy="'.$image_url.'"></a><small style="margin-right: 13px" class="elip">'.$title.'</small></div>';
     }

+ 4 - 4
homepage.php

@@ -197,7 +197,7 @@ foreach(loadAppearance() as $key => $value) {
                 <br/>
 
                 <?php if (qualifyUser(HOMEPAGENOTICEAUTH) && HOMEPAGENOTICETITLE && HOMEPAGENOTICETYPE && HOMEPAGENOTICEMESSAGE && HOMEPAGENOTICELAYOUT) { echo buildHomepageNotice(HOMEPAGENOTICELAYOUT, HOMEPAGENOTICETYPE, HOMEPAGENOTICETITLE, HOMEPAGENOTICEMESSAGE); } ?>
-                <?php if((PLEXSEARCH == "true" && qualifyUser(PLEXHOMEAUTH))) { ?>
+                <?php if((qualifyUser(PLEXSEARCHAUTH) && PLEXSEARCH == "true" && qualifyUser(PLEXHOMEAUTH))) { ?>
                 <div id="searchPlexRow" class="row">
                     <div class="col-lg-12">
                         <div class="content-box box-shadow big-box todo-list">
@@ -417,12 +417,12 @@ foreach(loadAppearance() as $key => $value) {
                 <?php } ?>
 				<?php if (qualifyUser(PLEXHOMEAUTH) && PLEXTOKEN) { ?>
                 <div id="plexRowNowPlaying" class="row">
-                    <?php if(PLEXPLAYINGNOW == "true"){ echo getPlexStreams(12, PLEXSHOWNAMES, $USER->role); } ?>
+                    <?php if(qualifyUser(PLEXPLAYINGNOWAUTH) && PLEXPLAYINGNOW == "true"){ echo getPlexStreams(12, PLEXSHOWNAMES, $USER->role); } ?>
                 </div>
                 <div id="plexRow" class="row">
                     <div class="col-lg-12">
                     <?php
-                    if(PLEXRECENTMOVIE == "true" || PLEXRECENTTV == "true" || PLEXRECENTMUSIC == "true"){
+                    if(qualifyUser(PLEXRECENTMOVIEAUTH) && PLEXRECENTMOVIE == "true" || qualifyUser(PLEXRECENTTVAUTH) && PLEXRECENTTV == "true" || qualifyUser(PLEXRECENTMUSICAUTH) &&  PLEXRECENTMUSIC == "true"){
                         $plexArray = array("movie" => PLEXRECENTMOVIE, "season" => PLEXRECENTTV, "album" => PLEXRECENTMUSIC);
                         echo getPlexRecent($plexArray);
                     }
@@ -431,7 +431,7 @@ foreach(loadAppearance() as $key => $value) {
                 </div>
                 <div id="plexPlaylists" class="row">
                     <div class="col-lg-12">
-                    <?php if(PLEXPLAYLISTS == "true"){ echo getPlexPlaylists($plexArray); } ?>
+                    <?php if(qualifyUser(PLEXPLAYLISTSAUTH) && PLEXPLAYLISTS == "true"){ echo getPlexPlaylists($plexArray); } ?>
                     </div>
                 </div>
                 <?php } ?>

+ 49 - 0
settings.php

@@ -946,36 +946,85 @@ echo buildSettings(
 							'name' => 'plexSearch',
 							'value' => PLEXSEARCH,
 						),
+						array(
+							'type' => $userSelectType,
+							'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+							'name' => 'plexHomeAuth',
+							'value' => PLEXSEARCHAUTH,
+							'options' => $userTypes,
+						),
+					),
+					array(
 						array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'RECENT_MOVIES',
 							'name' => 'plexRecentMovie',
 							'value' => PLEXRECENTMOVIE,
+						),array(
+							'type' => $userSelectType,
+							'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+							'name' => 'plexRecentMovieAuth',
+							'value' => PLEXRECENTMOVIEAUTH,
+							'options' => $userTypes,
 						),
+					),
+					array(
 						array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'RECENT_TV',
 							'name' => 'plexRecentTV',
 							'value' => PLEXRECENTTV,
+						),array(
+							'type' => $userSelectType,
+							'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+							'name' => 'plexRecentTVAuth',
+							'value' => PLEXRECENTTVAUTH,
+							'options' => $userTypes,
 						),
+					),
+					array(
 						array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'RECENT_MUSIC',
 							'name' => 'plexRecentMusic',
 							'value' => PLEXRECENTMUSIC,
+						),array(
+							'type' => $userSelectType,
+							'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+							'name' => 'plexRecentMusicAuth',
+							'value' => PLEXRECENTMUSICAUTH,
+							'options' => $userTypes,
 						),
+					),
+					array(
                         array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'PLAYLISTS',
 							'name' => 'plexPlaylists',
 							'value' => PLEXPLAYLISTS,
+						),array(
+							'type' => $userSelectType,
+							'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+							'name' => 'plexPlaylistsAuth',
+							'value' => PLEXPLAYLISTSAUTH,
+							'options' => $userTypes,
 						),
+					),
+					array(
 						array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'PLAYING_NOW',
 							'name' => 'plexPlayingNow',
 							'value' => PLEXPLAYINGNOW,
+						),array(
+							'type' => $userSelectType,
+							'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+							'name' => 'plexPlayingNowAuth',
+							'value' => PLEXPLAYINGNOWAUTH,
+							'options' => $userTypes,
 						),
+					),
+					array(
       					array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'SHOW_NAMES',