Explorar el Código

Fix #932
Added option to select cache image size for plex and emby items.

causefx hace 7 años
padre
commit
80ff0b666d

+ 2 - 1
api/config/default.php

@@ -177,5 +177,6 @@ return array(
 	'customJava' => '',
 	'customThemeJava' => '',
 	'minimalLoginScreen' => false,
-	'unsortedTabs' => 'top'
+	'unsortedTabs' => 'top',
+	'cacheImageSize' => '2'
 );

+ 30 - 8
api/functions/homepage-connect-functions.php

@@ -84,10 +84,10 @@ function resolveEmbyItem($itemDetails)
 		return false;
 	};
 	// Static Height & Width
-	$height = 300;
-	$width = 200;
-	$nowPlayingHeight = 675;
-	$nowPlayingWidth = 1200;
+	$height = getCacheImageSize('h');
+	$width = getCacheImageSize('w');
+	$nowPlayingHeight = getCacheImageSize('nph');
+	$nowPlayingWidth = getCacheImageSize('npw');
 	$actorHeight = 450;
 	$actorWidth = 300;
 	// Cache Directories
@@ -272,13 +272,35 @@ function resolveEmbyItem($itemDetails)
 	return $embyItem;
 }
 
+function getCacheImageSize($type)
+{
+	switch ($type) {
+		case 'height':
+		case 'h':
+			return 300 * $GLOBALS['cacheImageSize'];
+			break;
+		case 'width':
+		case 'w':
+			return 200 * $GLOBALS['cacheImageSize'];
+			break;
+		case 'nowPlayingHeight':
+		case 'nph':
+			return 675 * $GLOBALS['cacheImageSize'];
+			break;
+		case 'nowPlayingWidth':
+		case 'npw':
+			return 1200 * $GLOBALS['cacheImageSize'];
+			break;
+	}
+}
+
 function resolvePlexItem($item)
 {
 	// Static Height & Width
-	$height = 300;
-	$width = 200;
-	$nowPlayingHeight = 675;
-	$nowPlayingWidth = 1200;
+	$height = getCacheImageSize('h');
+	$width = getCacheImageSize('w');
+	$nowPlayingHeight = getCacheImageSize('nph');
+	$nowPlayingWidth = getCacheImageSize('npw');
 	// Cache Directories
 	$cacheDirectory = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR;
 	$cacheDirectoryWeb = 'plugins/images/cache/';

+ 44 - 0
api/functions/homepage-functions.php

@@ -626,6 +626,26 @@ function getHomepageList()
 						'label' => 'Plex Tab WAN URL',
 						'value' => $GLOBALS['plexTabURL'],
 						'placeholder' => 'http(s)://hostname:port'
+					),
+					array(
+						'type' => 'select',
+						'name' => 'cacheImageSize',
+						'label' => 'Image Cache Size',
+						'value' => $GLOBALS['cacheImageSize'],
+						'options' => array(
+							array(
+								'name' => 'Low',
+								'value' => '1'
+							),
+							array(
+								'name' => 'Mid',
+								'value' => '2'
+							),
+							array(
+								'name' => 'High',
+								'value' => '3'
+							)
+						)
 					)
 				),
 				'Test Connection' => array(
@@ -757,6 +777,30 @@ function getHomepageList()
 						'label' => 'Emby Tab WAN URL',
 						'value' => $GLOBALS['embyTabURL'],
 						'placeholder' => 'http(s)://hostname:port'
+					),
+					array(
+						'type' => 'select',
+						'name' => 'cacheImageSize',
+						'label' => 'Image Cache Size',
+						'value' => $GLOBALS['cacheImageSize'],
+						'options' => array(
+							array(
+								'name' => 'Low',
+								'value' => '.5'
+							),
+							array(
+								'name' => '1x',
+								'value' => '1'
+							),
+							array(
+								'name' => '2x',
+								'value' => '2'
+							),
+							array(
+								'name' => '3x',
+								'value' => '3'
+							)
+						)
 					)
 				)
 			)