4
0
Эх сурвалжийг харах

work started on omby homepage

causefx 8 жил өмнө
parent
commit
0dc0a4470e

+ 9 - 1
api/config/default.php

@@ -21,6 +21,8 @@ return array(
     'plexTabURL' => '',
     'plexToken' => '',
     'plexTabName' => '',
+    'embyTabURL' => '',
+    'embyTabName' => '',
     'embyURL' => '',
     'embyToken' => '',
     'plexID' => '',
@@ -31,6 +33,8 @@ return array(
     'ssoTautulli' => false,
     'homepagePlexEnabled' => false,
     'homepagePlexAuth' => '1',
+    'homepageEmbyEnabled' => false,
+    'homepageEmbyAuth' => '1',
     'homepageOrdercustomhtml' => '1',
 	'homepageOrdernotice' => '2',
 	'homepageOrderplexsearch' => '3',
@@ -53,5 +57,9 @@ return array(
     'homepagePlexStreams' => false,
     'homepagePlexStreamsAuth' => '1',
     'homepagePlexRecent' => false,
-    'homepagePlexRecentAuth' => '1'
+    'homepagePlexRecentAuth' => '1',
+    'homepageEmbyStreams' => false,
+    'homepageEmbyStreamsAuth' => '1',
+    'homepageEmbyRecent' => false,
+    'homepageEmbyRecentAuth' => '1'
 );

+ 223 - 2
api/functions/homepage-connect-functions.php

@@ -27,6 +27,166 @@ function streamType($value){
         return "Direct Play";
     }
 }
+function resolveEmbyItem($itemDetails) {
+    // Grab Each item info from Emby (extra call)
+    $url = qualifyURL($GLOBALS['embyURL']);
+    $url = $url.'/Items?Ids='.$itemDetails['Id'].'&api_key='.$GLOBALS['embyToken'];
+    try{
+        $options = (localURL($url)) ? array('verify' => false ) : array();
+        $response = Requests::get($url, array(), $options);
+        if($response->success){
+            $item = json_decode($response->body,true)['Items'][0];
+        }
+    }catch( Requests_Exception $e ) {
+        return false;
+    };
+    // Static Height & Width
+    $height = 300;
+    $width = 200;
+    $nowPlayingHeight = 675;
+    $nowPlayingWidth = 1200;
+	$widthOverride = 100;
+    // Cache Directories
+    $cacheDirectory = dirname(__DIR__,2).DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR;
+    $cacheDirectoryWeb = 'plugins/images/cache/';
+    // Types
+    switch ($itemDetails['Type']) {
+    	case 'Series':
+        case 'Episode':
+            $embyItem['type'] = 'tv';
+            $embyItem['title'] = $item['Name'];
+            $embyItem['summary'] = '';
+            $embyItem['ratingKey'] = $item['Id'];
+            $embyItem['thumb'] = $item['ImageTags']['Primary'];
+            $embyItem['key'] = $item['Id'] . "-list";
+            $embyItem['nowPlayingThumb'] = $item['ImageTags']['Thumb'];
+            $embyItem['nowPlayingKey'] = $item['Id'] . "-np";
+            $embyItem['metadataKey'] = $item['Id'];
+            break;
+        case 'TvChannel':
+            //$useImage = (isset($item['live']) ? "plugins/images/cache/livetv.png" : null);
+            $embyItem['type'] = 'clip';
+            /*$embyItem['title'] = (string)$item['title'];
+            $embyItem['summary'] = (string)$item['summary'];
+            $embyItem['ratingKey'] = (string)$item['parentRatingKey'];
+            $embyItem['thumb'] = (string)$item['thumb'];
+            $embyItem['key'] = (string)$item['ratingKey'] . "-list";
+            $embyItem['nowPlayingThumb'] = (string)$item['art'];
+            $embyItem['nowPlayingKey'] = isset($item['ratingKey']) ? (string)$item['ratingKey'] . "-np" : (isset($item['live']) ? "livetv.png" : ":)");
+            $embyItem['nowPlayingTitle'] = $embyItem['title'];
+            $embyItem['nowPlayingBottom'] = isset($item['extraType']) ? "Trailer" : (isset($item['live']) ? "Live TV" : ":)");*/
+            break;
+        case 'MusicAlbum':
+        case 'Audio':
+            $embyItem['type'] = 'music';
+            /*$embyItem['title'] = (string)$item['parentTitle'];
+            $embyItem['summary'] = (string)$item['title'];
+			$embyItem['ratingKey'] = (string)$item['parentRatingKey'];
+            $embyItem['thumb'] = (string)$item['thumb'];
+            $embyItem['key'] = (string)$item['ratingKey'] . "-list";
+			$embyItem['nowPlayingThumb'] = ($item['parentThumb']) ? (string)$item['parentThumb'] :  (string)$item['art'];
+            $embyItem['nowPlayingKey'] = (string)$item['ratingKey'] . "-np";
+            $embyItem['nowPlayingTitle'] = (string)$item['grandparentTitle'].' - '.(string)$item['title'];
+            $embyItem['nowPlayingBottom'] = (string)$item['parentTitle'];
+            $embyItem['metadataKey'] = isset($item['grandparentRatingKey']) ? (string)$item['grandparentRatingKey'] : (string)$item['parentRatingKey'];*/
+            break;
+        default:
+            $embyItem['type'] = 'movie';
+            $embyItem['title'] = $item['Name'];
+            $embyItem['summary'] = '';
+            $embyItem['ratingKey'] = $item['Id'];
+            $embyItem['thumb'] = $item['ImageTags']['Primary'];
+            $embyItem['key'] = $item['Id'] . "-list";
+            $embyItem['nowPlayingThumb'] = $item['ImageTags']['Thumb'];
+            $embyItem['nowPlayingKey'] = $item['Id'] . "-np";
+            $embyItem['metadataKey'] = $item['Id'];
+            //$embyItem['nowPlayingTitle'] = (string)$item['title'];
+            //$embyItem['nowPlayingBottom'] = (string)$item['year'];
+	}
+    /*$embyItem['uid'] = (string)$item['ratingKey'];
+    $embyItem['elapsed'] = isset($item['viewOffset']) && $item['viewOffset'] !== '0' ? (int)$item['viewOffset'] : null;
+    $embyItem['duration'] = isset($item['duration']) ? (int)$item['duration'] : (int)$item->Media['duration'];
+    $embyItem['watched'] = ($embyItem['elapsed'] && $embyItem['duration'] ? floor(($embyItem['elapsed'] / $embyItem['duration']) * 100) : 0);
+    $embyItem['transcoded'] = isset($item->TranscodeSession['progress']) ? floor((int)$item->TranscodeSession['progress']- $embyItem['watched']) : '';
+    $embyItem['stream'] = isset($item->Media->Part->Stream['decision']) ? (string)$item->Media->Part->Stream['decision']: '';
+    $embyItem['id'] = str_replace('"', '', (string)$item->Player['machineIdentifier']);
+    $embyItem['session'] = (string)$item->Session['id'];
+    $embyItem['bandwidth'] = (string)$item->Session['bandwidth'];
+    $embyItem['bandwidthType'] = (string)$item->Session['location'];
+    $embyItem['sessionType'] = isset($item->TranscodeSession['progress']) ? 'Transcoding' : 'Direct Playing';
+    $embyItem['state'] = (((string)$item->Player['state'] == "paused") ? "pause" : "play");
+    $embyItem['user'] = ($GLOBALS['homepageShowStreamNames'] && qualifyRequest($GLOBALS['homepageShowStreamNamesAuth']) ) ? (string)$item->User['title'] : "";
+    $embyItem['userThumb'] = ($GLOBALS['homepageShowStreamNames'] && qualifyRequest($GLOBALS['homepageShowStreamNamesAuth']) ) ? (string)$item->User['thumb'] : "";
+    $embyItem['userAddress'] = ($GLOBALS['homepageShowStreamNames'] && qualifyRequest($GLOBALS['homepageShowStreamNamesAuth']) ) ? (string)$item->Player['address'] : "x.x.x.x";
+    $embyItem['address'] = $GLOBALS['plexTabURL'] ? $GLOBALS['plexTabURL']."/web/index.html#!/server/".$GLOBALS['plexID']."/details?key=/library/metadata/".$item['ratingKey'] : "https://app.plex.tv/web/app#!/server/".$GLOBALS['plexID']."/details?key=/library/metadata/".$item['ratingKey'];
+    $embyItem['nowPlayingOriginalImage'] = 'api/?v1/image&source=plex&img='.$embyItem['nowPlayingThumb'].'&height='.$nowPlayingHeight.'&width='.$nowPlayingWidth.'&key='.$embyItem['nowPlayingKey'].'$'.randString();
+    $embyItem['originalImage'] = 'api/?v1/image&source=plex&img='.$embyItem['thumb'].'&height='.$height.'&width='.$width.'&key='.$embyItem['key'].'$'.randString();
+    $embyItem['openTab'] = $GLOBALS['plexTabURL'] && $GLOBALS['plexTabName'] ? true : false;
+    $embyItem['tabName'] = $GLOBALS['plexTabName'] ? $GLOBALS['plexTabName'] : '';
+    // Stream info
+    $embyItem['userStream'] = array(
+        'platform' => (string)$item->Player['platform'],
+        'product' => (string)$item->Player['product'],
+        'device' => (string)$item->Player['device'],
+        'stream' => (string)$item->Media->Part['decision'].($item->TranscodeSession['throttled'] == '1' ? ' (Throttled)': ''),
+        'videoResolution' => (string)$item->Media['videoResolution'],
+        'throttled' => ($item->TranscodeSession['throttled'] == 1) ? true : false,
+        'sourceVideoCodec' => (string)$item->TranscodeSession['sourceVideoCodec'],
+        'videoCodec' => (string)$item->TranscodeSession['videoCodec'],
+        'audioCodec' => (string)$item->TranscodeSession['audioCodec'],
+        'sourceAudioCodec' => (string)$item->TranscodeSession['sourceAudioCodec'],
+        'videoDecision' => streamType((string)$item->TranscodeSession['videoDecision']),
+        'audioDecision' => streamType((string)$item->TranscodeSession['audioDecision']),
+        'container' => (string)$item->TranscodeSession['container'],
+        'audioChannels' => (string)$item->TranscodeSession['audioChannels']
+    );
+    // Genre catch all
+    if($item->Genre){
+        $genres = array();
+        foreach ($item->Genre as $key => $value) {
+            $genres[] = (string)$value['tag'];
+        }
+    }
+    // Actor catch all
+    if($item->Role ){
+        $actors = array();
+        foreach ($item->Role  as $key => $value) {
+            if($value['thumb']){
+                $actors[] = array(
+                    'name' =>  (string)$value['tag'],
+                    'role' =>  (string)$value['role'],
+                    'thumb' =>  (string)$value['thumb']
+                );
+            }
+        }
+    }
+    // Metadata information
+    $embyItem['metadata'] = array(
+        'guid' => (string)$item['guid'],
+        'summary' => (string)$item['summary'],
+        'rating' => (string)$item['rating'],
+        'duration' => (string)$item['duration'],
+        'originallyAvailableAt' => (string)$item['originallyAvailableAt'],
+        'year' => (string)$item['year'],
+        'studio' => (string)$item['studio'],
+        'tagline' => (string)$item['tagline'],
+        'genres' => ($item->Genre) ?  $genres : '',
+        'actors' => ($item->Role) ?  $actors : ''
+    );
+    if (file_exists($cacheDirectory.$embyItem['nowPlayingKey'].'.jpg')){ $embyItem['nowPlayingImageURL'] = $cacheDirectoryWeb.$embyItem['nowPlayingKey'].'.jpg'; }
+    if (file_exists($cacheDirectory.$embyItem['key'].'.jpg')){ $embyItem['imageURL']  = $cacheDirectoryWeb.$embyItem['key'].'.jpg'; }
+    if (file_exists($cacheDirectory.$embyItem['nowPlayingKey'].'.jpg') && (time() - 604800) > filemtime($cacheDirectory.$embyItem['nowPlayingKey'].'.jpg') || !file_exists($cacheDirectory.$embyItem['nowPlayingKey'].'.jpg')) {
+        $embyItem['nowPlayingImageURL'] = 'api/?v1/image&source=plex&img='.$embyItem['nowPlayingThumb'].'&height='.$nowPlayingHeight.'&width='.$nowPlayingWidth.'&key='.$embyItem['nowPlayingKey'].'';
+    }
+    if (file_exists($cacheDirectory.$embyItem['key'].'.jpg') && (time() - 604800) > filemtime($cacheDirectory.$embyItem['key'].'.jpg') || !file_exists($cacheDirectory.$embyItem['key'].'.jpg')) {
+        $embyItem['imageURL'] = 'api/?v1/image&source=plex&img='.$embyItem['thumb'].'&height='.$height.'&width='.$width.'&key='.$embyItem['key'].'';
+    }
+    if(!$embyItem['nowPlayingThumb'] ){ $embyItem['nowPlayingOriginalImage']  = $embyItem['nowPlayingImageURL']  = "plugins/images/cache/no-np.png"; $embyItem['nowPlayingKey'] = "no-np"; }
+    if(!$embyItem['thumb'] ){  $embyItem['originalImage'] = $embyItem['imageURL'] = "plugins/images/cache/no-list.png"; $embyItem['key'] = "no-list"; }
+	if(isset($useImage)){ $embyItem['useImage'] = $useImage; }*/
+
+    return $embyItem;
+}
 function resolvePlexItem($item) {
     // Static Height & Width
     $height = 300;
@@ -88,7 +248,7 @@ function resolvePlexItem($item) {
             $plexItem['nowPlayingKey'] = (string)$item['ratingKey'] . "-np";
             $plexItem['nowPlayingTitle'] = (string)$item['grandparentTitle'].' - '.(string)$item['title'];
             $plexItem['nowPlayingBottom'] = (string)$item['parentTitle'];
-            $plexItem['metadataKey'] = isset($item['parentRatingKey']) ? (string)$item['parentRatingKey'] : (string)$item['ratingKey'];
+            $plexItem['metadataKey'] = isset($item['grandparentRatingKey']) ? (string)$item['grandparentRatingKey'] : (string)$item['parentRatingKey'];
             break;
         default:
             $plexItem['type'] = 'movie';
@@ -187,7 +347,7 @@ function resolvePlexItem($item) {
     return $plexItem;
 }
 function plexConnect($action,$key=null){
-	if(!empty($GLOBALS['plexURL']) && !empty($GLOBALS['plexToken']) && !empty($GLOBALS['plexID'] && qualifyRequest($GLOBALS['homepagePlexStreamsAuth']))){
+	if(!empty($GLOBALS['plexURL']) && !empty($GLOBALS['plexToken']) && !empty($GLOBALS['plexID'] && qualifyRequest($GLOBALS['homepagePlexAuth']))){
         $url = qualifyURL($GLOBALS['plexURL']);
         switch ($action) {
             case 'streams':
@@ -225,3 +385,64 @@ function plexConnect($action,$key=null){
 	}
 	return false;
 }
+function embyConnect($action,$key=null){
+	if(!empty($GLOBALS['embyURL']) && !empty($GLOBALS['embyToken']) && qualifyRequest($GLOBALS['homepageEmbyAuth'])){
+        $url = qualifyURL($GLOBALS['embyURL']);
+        switch ($action) {
+            case 'streams':
+                $url = $url."/status/sessions?X-Plex-Token=".$GLOBALS['plexToken'];
+                break;
+            case 'recent':
+                $username = false;
+                if (isset($GLOBALS['organizrUser']['username'])) {
+                    $username = strtolower($GLOBALS['organizrUser']['username']);
+                }
+                // Get A User
+                $userIds = $url."/Users?api_key=".$GLOBALS['embyToken'];
+                $showPlayed = true;
+                try{
+        			$options = (localURL($userIds)) ? array('verify' => false ) : array();
+        			$response = Requests::get($userIds, array(), $options);
+        			if($response->success){
+        				$emby = json_decode($response->body, true);
+                        foreach ($emby as $value) { // Scan for admin user
+                            if (isset($value['Policy']) && isset($value['Policy']['IsAdministrator']) && $value['Policy']['IsAdministrator']) {
+                                $userId = $value['Id'];
+                            }
+                            if ($username && strtolower($value['Name']) == $username) {
+                                $userId = $value['Id'];
+                                $showPlayed = false;
+                                break;
+                            }
+                        }
+        			}
+        		}catch( Requests_Exception $e ) {
+        			writeLog('error', 'Emby Connect Function - Error: '.$e->getMessage(), 'SYSTEM');
+        		};
+                $url = $url.'/Users/'.$userId.'/Items/Latest?EnableImages=false&Limit=100&api_key='.$GLOBALS['embyToken'].($showPlayed?'':'&IsPlayed=false');
+                break;
+            case 'metadata':
+                $url = $url."/library/metadata/".$key."?X-Plex-Token=".$GLOBALS['plexToken'];
+                break;
+            default:
+                # code...
+                break;
+        }
+		try{
+			$options = (localURL($url)) ? array('verify' => false ) : array();
+			$response = Requests::get($url, array(), $options);
+			if($response->success){
+				$items = array();
+				$emby = json_decode($response->body, true);
+				foreach($emby AS $child) {
+					$items[] = resolveEmbyItem($child);
+				}
+				$api['content'] = $items;
+				return $api;
+			}
+		}catch( Requests_Exception $e ) {
+			writeLog('error', 'Plex Connect Function - Error: '.$e->getMessage(), 'SYSTEM');
+		};
+	}
+	return false;
+}

+ 115 - 51
api/functions/homepage-functions.php

@@ -188,63 +188,65 @@ function getHomepageList(){
                         'value' => $GLOBALS['plexID']
                     )
                 ),
-                'Modules' => array(
-                    array(
+				'Active Streams' => array(
+					array(
             			'type' => 'switch',
             			'name' => 'homepagePlexStreams',
-            			'label' => 'Show Streams',
+            			'label' => 'Enable',
             			'value' => $GLOBALS['homepagePlexStreams']
             		),
-                    array(
+					array(
     					'type' => 'select',
     					'name' => 'homepagePlexStreamsAuth',
-                        'label' => 'Stream Authorization',
+                        'label' => 'Minimum Authorization',
     					'value' => $GLOBALS['homepagePlexStreamsAuth'],
     					'options' => $groups
     				),
 					array(
             			'type' => 'switch',
-            			'name' => 'homepagePlexRecent',
-            			'label' => 'Show Recent Items',
-            			'value' => $GLOBALS['homepagePlexRecent']
-            		),
-                    array(
-    					'type' => 'select',
-    					'name' => 'homepagePlexRecentAuth',
-                        'label' => 'Recent Authorization',
-    					'value' => $GLOBALS['homepagePlexRecentAuth'],
-    					'options' => $groups
-    				)
-                ),
-                'Options' => array(
-                    array(
-            			'type' => 'switch',
             			'name' => 'homepageShowStreamNames',
-            			'label' => 'Show User Information',
+            			'label' => 'User Information',
             			'value' => $GLOBALS['homepageShowStreamNames']
             		),
 					array(
     					'type' => 'select',
     					'name' => 'homepageShowStreamNamesAuth',
-                        'label' => 'User Information Authorization',
+                        'label' => 'Minimum Authorization',
     					'value' => $GLOBALS['homepageShowStreamNamesAuth'],
     					'options' => $groups
     				),
-                    array(
+					array(
     					'type' => 'select',
     					'name' => 'homepageStreamRefresh',
-                        'label' => 'Stream Refresh Seconds',
+                        'label' => 'Refresh Seconds',
     					'value' => $GLOBALS['homepageStreamRefresh'],
     					'options' => $time
     				),
+				),
+                'Recent Items' => array(
 					array(
+            			'type' => 'switch',
+            			'name' => 'homepagePlexRecent',
+            			'label' => 'Enable',
+            			'value' => $GLOBALS['homepagePlexRecent']
+            		),
+                    array(
     					'type' => 'select',
-    					'name' => 'homepageRecentRefresh',
-                        'label' => 'Recent Items Refresh Seconds',
-    					'value' => $GLOBALS['homepageRecentRefresh'],
-    					'options' => $time
+    					'name' => 'homepagePlexRecentAuth',
+                        'label' => 'Minimum Authorization',
+    					'value' => $GLOBALS['homepagePlexRecentAuth'],
+    					'options' => $groups
     				),
 					array(
+						'type' => 'select',
+						'name' => 'homepageRecentRefresh',
+						'label' => 'Refresh Seconds',
+						'value' => $GLOBALS['homepageRecentRefresh'],
+						'options' => $time
+					),
+                ),
+                'Misc Options' => array(
+					array(
                         'type' => 'input',
                         'name' => 'plexTabName',
                         'label' => 'Plex Tab Name',
@@ -254,14 +256,14 @@ function getHomepageList(){
 					array(
                         'type' => 'input',
                         'name' => 'plexTabURL',
-                        'label' => 'Plex Tab URL',
+                        'label' => 'Plex Tab WAN URL',
                         'value' => $GLOBALS['plexTabURL'],
 						'placeholder' => 'http(s)://hostname:port'
                     )
                 )
             )
         ),
-        array(
+		array(
             'name' => 'Emby',
             'enabled' => true,
             'image' => 'plugins/images/tabs/emby.png',
@@ -270,43 +272,105 @@ function getHomepageList(){
                 'Enable' => array(
                     array(
             			'type' => 'switch',
-            			'name' => 'homepagePlexEnabled',
+            			'name' => 'homepageEmbyEnabled',
             			'label' => 'Enable',
-            			'value' => $GLOBALS['homepagePlexEnabled']
+            			'value' => $GLOBALS['homepageEmbyEnabled']
+            		),
+					array(
+            			'type' => 'select',
+            			'name' => 'homepageEmbyAuth',
+            			'label' => 'Minimum Authentication',
+            			'value' => $GLOBALS['homepageEmbyAuth'],
+                        'options' => $groups
             		)
                 ),
                 'Connection' => array(
                     array(
                         'type' => 'input',
-                        'name' => 'plexURL',
+                        'name' => 'embyURL',
                         'label' => 'URL',
-                        'value' => $GLOBALS['plexURL']
+                        'value' => $GLOBALS['embyURL'],
+						'placeholder' => 'http(s)://hostname:port'
                     ),
                     array(
                         'type' => 'input',
-                        'name' => 'plexToken',
+                        'name' => 'embyToken',
                         'label' => 'Token',
-                        'value' => $GLOBALS['plexToken']
+                        'value' => $GLOBALS['embyToken']
                     )
                 ),
-                'Authentication' => array(
-                    array(
-            			'type' => 'select',
-            			'name' => 'homepagePlexAuth',
-            			'label' => 'Minimum Authentication',
-            			'value' => $GLOBALS['homepagePlexAuth'],
-                        'options' => $groups
-            		)
-                ),
-                'Options' => array(
+				'Active Streams' => array(
+					array(
+            			'type' => 'switch',
+            			'name' => 'homepageEmbyStreams',
+            			'label' => 'Enable',
+            			'value' => $GLOBALS['homepageEmbyStreams']
+            		),
+					array(
+    					'type' => 'select',
+    					'name' => 'homepageEmbyStreamsAuth',
+                        'label' => 'Minimum Authorization',
+    					'value' => $GLOBALS['homepageEmbyStreamsAuth'],
+    					'options' => $groups
+    				),
+					array(
+            			'type' => 'switch',
+            			'name' => 'homepageShowStreamNames',
+            			'label' => 'User Information',
+            			'value' => $GLOBALS['homepageShowStreamNames']
+            		),
+					array(
+    					'type' => 'select',
+    					'name' => 'homepageShowStreamNamesAuth',
+                        'label' => 'Minimum Authorization',
+    					'value' => $GLOBALS['homepageShowStreamNamesAuth'],
+    					'options' => $groups
+    				),
+					array(
+    					'type' => 'select',
+    					'name' => 'homepageStreamRefresh',
+                        'label' => 'Refresh Seconds',
+    					'value' => $GLOBALS['homepageStreamRefresh'],
+    					'options' => $time
+    				),
+				),
+                'Recent Items' => array(
+					array(
+            			'type' => 'switch',
+            			'name' => 'homepageEmbyRecent',
+            			'label' => 'Enable',
+            			'value' => $GLOBALS['homepageEmbyRecent']
+            		),
                     array(
     					'type' => 'select',
-    					'name' => 'style',
-    					'label' => 'Style',
-    					'class' => 'styleChanger',
-    					'value' => $GLOBALS['style'],
+    					'name' => 'homepageEmbyRecentAuth',
+                        'label' => 'Minimum Authorization',
+    					'value' => $GLOBALS['homepageEmbyRecentAuth'],
     					'options' => $groups
-    				)
+    				),
+					array(
+						'type' => 'select',
+						'name' => 'homepageRecentRefresh',
+						'label' => 'Refresh Seconds',
+						'value' => $GLOBALS['homepageRecentRefresh'],
+						'options' => $time
+					),
+                ),
+                'Misc Options' => array(
+					array(
+                        'type' => 'input',
+                        'name' => 'embyTabName',
+                        'label' => 'Emby Tab Name',
+                        'value' => $GLOBALS['embyTabName'],
+						'placeholder' => 'Only use if you have Plex in a reverse proxy'
+                    ),
+					array(
+                        'type' => 'input',
+                        'name' => 'embyTabURL',
+                        'label' => 'Emby Tab WAN URL',
+                        'value' => $GLOBALS['embyTabURL'],
+						'placeholder' => 'http(s)://hostname:port'
+                    )
                 )
             )
         ),

+ 30 - 0
css/organizr.css

@@ -179,3 +179,33 @@ h2.m-b-0.font-medium.pull-right {
   -webkit-filter: drop-shadow(1px 1px 0px #1f1f1f);
   filter: drop-shadow(1px 1px 0px #1f1f1f);
 }
+.text-plex {
+  color: #E5A00D;
+}
+.text-emby {
+  color: #4CAF50;
+}
+.genre-list {
+  position: absolute;
+  bottom: 0;
+  left: 0;
+}
+.mouse {
+  cursor: pointer;
+}
+.el-element-overlay .el-card-item .el-overlay-1 img.imageSourceLeft {
+  width: 56%;
+  display:block;
+  position: absolute;
+  left:0px;
+  overflow: hidden;
+  filter: blur(0px) grayscale(1);
+}
+.el-element-overlay .el-card-item .el-overlay-1 img.imageSourceRight {
+  width: 56%;
+  display:block;
+  position: absolute;
+  right:0px;
+  overflow: hidden;
+  filter: blur(0px) grayscale(1)
+}

+ 1 - 1
js/custom.js

@@ -96,7 +96,7 @@ function pageLoad(){
           paginationSpeed : 400,
           margin:40,
           nav:false,
-          autoplay:false,
+          autoplay:true,
           dots:false,
           responsive:{
               0:{

+ 24 - 32
js/functions.js

@@ -658,7 +658,6 @@ function buildHomepageItem(array){
 				</div>
 			</div>
 			<form id="homepage-`+v.name+`-form" class="mfp-hide white-popup-block mfp-with-anim homepageForm">
-			    <h1 lang="en">Edit Settings</h1>
 			    <fieldset style="border:0;">`+buildFormGroup(v.settings)+`</fieldset>
 			    <div class="clearfix"></div>
 			</form>
@@ -695,7 +694,7 @@ function buildFormGroup(array){
 		var total = v.length;
 		group += `
 			<!-- FORM GROUP -->
-			<h3 class="box-title" lang="en">`+i+`</h3>
+			<h4 class="box-title" lang="en">`+i+`</h4>
 			<hr class="m-t-0 m-b-40">
 			<div class="row">
 		`;
@@ -1822,8 +1821,8 @@ function buildPlexStreamItem(array){
 				icon = 'icon-music-tone-alt';
 				width = 56;
 				bg = `
-				<img class="imageSource" style="width: 56%;display:block;position: absolute;left:0px;overflow: hidden;filter: blur(0px) grayscale(1);" src="`+v.nowPlayingImageURL+`">
-				<img class="imageSource" style="width: 56%;display:block;position: absolute;right:0px;overflow: hidden;filter: blur(0px) grayscale(1);" src="`+v.nowPlayingImageURL+`">
+				<img class="imageSource imageSourceLeft" src="`+v.nowPlayingImageURL+`">
+				<img class="imageSource imageSourceRight" src="`+v.nowPlayingImageURL+`">
 				`;
 				break;
 			case 'movie':
@@ -1871,7 +1870,7 @@ function buildPlexStreamItem(array){
 							<div class="progress-bar progress-bar-inverse" style="width: `+v.transcoded+`%;" role="progressbar"></div>
 						</div>
 						<h3 class="box-title pull-left p-l-10 elip" style="width:90%">`+v.nowPlayingTitle+`</h3>
-						<h3 class="box-title pull-right vertical-middle" style="width:10%"><i class="icon-control-`+v.state+` fa-fw text-primary" style=""></i></h3>
+						<h3 class="box-title pull-right vertical-middle" style="width:10%"><i class="icon-control-`+v.state+` fa-fw text-info" style=""></i></h3>
 						<div class="clearfix"></div>
 						<small class="pull-left p-l-10"><i class="`+icon+` fa-fw text-info"></i>`+v.nowPlayingBottom+`</small>
 						<small class="pull-right p-r-10">`+v.user+` <i class="icon-user"></i></small>
@@ -1934,7 +1933,7 @@ function buildPlexRecentItem(array){
 
 		}
 		items += `
-		<div class="item lazyload `+className+` metadata-get" data-key="`+v.metadataKey+`" data-uid="`+v.uid+`" data-src="`+v.imageURL+`">
+		<div class="item lazyload `+className+` metadata-get mouse" data-key="`+v.metadataKey+`" data-uid="`+v.uid+`" data-src="`+v.imageURL+`">
 			<span class="elip recent-title">`+v.title+`</span>
 			<a class="inline-popups `+v.uid+` hidden" href="#`+v.uid+`-metadata-div" data-effect="mfp-zoom-out"></a>
 			<div id="`+v.uid+`-metadata-div" class="white-popup mfp-with-anim mfp-hide">
@@ -1975,7 +1974,7 @@ function buildPlexRecent(array){
             <div class="panel panel-default">
                 <div class="panel-heading bg-info p-t-10 p-b-10">
 					<span class="pull-left m-t-5" lang="en">Recently Added to Plex</span>
-					<div class="btn-group m-r-10 pull-right">
+					<div class="btn-group pull-right">
 	                    <button aria-expanded="false" data-toggle="dropdown" class="btn btn-info dropdown-toggle waves-effect waves-light" type="button">
 							<i class="fa fa-filter m-r-5"></i><span class="caret"></span>
 						</button>
@@ -2004,18 +2003,24 @@ function buildMetadata(array){
 	var metadata = '';
 	var genres = '';
 	var actors = '';
-	var rating = '<div class="col-xs-4 p-10"></div>';
+	var rating = '<div class="col-xs-2 p-10"></div>';
 	$.each(array.content, function(i,v) {
 		console.log(typeof v.metadata.actors)
 		var hasActor = (typeof v.metadata.actors !== 'string') ? true : false;
+		var hasGenre = (typeof v.metadata.genres !== 'string') ? true : false;
 		if(hasActor){
 			$.each(v.metadata.actors, function(i,v) {
-				actors += '<div class="item lazyload recent-poster" data-src="'+v.thumb+'" alt="'+v.name+'" ><span class="elip recent-title">'+v.name+'</span></div>';
+				actors += '<div class="item lazyload recent-poster" data-src="'+v.thumb+'" alt="'+v.name+'" ><span class="elip recent-title p-5">'+v.name+'<br><small class="font-light">'+v.role+'</small></span></div>';
+			});
+		}
+		if(hasGenre){
+			$.each(v.metadata.genres, function(i,v) {
+				genres += '<span class="badge bg-org m-r-10">'+v+'</span>';
 			});
 		}
 		if(v.metadata.rating){
 			var ratingRound = Math.ceil(v.metadata.rating)*10;
-			rating = `<div class="col-xs-4 p-10"><div data-label="`+v.metadata.rating *10+`%" class="css-bar css-bar-`+Math.ceil(ratingRound/5)*5+` css-bar-sm m-b-0  css-bar-info"></div></div>`;
+			rating = `<div class="col-xs-2 p-10"><div data-label="`+v.metadata.rating *10+`%" class="css-bar css-bar-`+Math.ceil(ratingRound/5)*5+` css-bar-sm m-b-0  css-bar-info"><img src="plugins/images/rotten.png" class="nowPlayingUserThumb" alt="User"></div></div>`;
 		}
 
 		var seconds = v.metadata.duration / 1000 ; // or "2000"
@@ -2027,37 +2032,24 @@ function buildMetadata(array){
 		<div class="white-box m-b-0">
 			<div class="user-bg lazyload" data-src="`+v.nowPlayingImageURL+`">
 				`+rating+`
-				<div class="col-xs-8">
-	                <h2 class="m-b-0 font-medium pull-right">`+v.title+`<br>    <small class="text-muted m-t-0">`+v.metadata.tagline+`</small></h2>
-
+				<div class="col-xs-10">
+	                <h2 class="m-b-0 font-medium pull-right text-right">
+						`+v.title+`<br>
+						<small class="m-t-0 text-white">`+v.metadata.tagline+`</small><br>
+						<a class="openTab" data-tab-name="`+v.tabName+`" data-type="`+v.type+`" data-open-tab="`+v.openTab+`" data-url="`+v.address+`" href="javascript:void(0);"><i class="mdi mdi-plex mdi-36px text-plex"></i></a>
+					</h2>
 	            </div>
+				<div class="genre-list p-10">`+genres+`</div>
 			</div>
 		</div>
 		<div class="panel panel-info p-b-0 p-t-0">
-            <div class="panel-body p-b-0 p-t-0">
-				<div class="row text-center m-t-0">
-					<div class="col-xs-4 b-r">
-						<h2></h2>
-						<h4></h4>
-					</div>
-					<div class="col-xs-4 b-r">
-						<h2></h2>
-						<h4></h4>
-					</div>
-					<div class="col-xs-4">
-						<h2><a class="openTab" data-tab-name="`+v.tabName+`" data-type="`+v.type+`" data-open-tab="`+v.openTab+`" data-url="`+v.address+`" href="javascript:void(0);"><i class=" mdi mdi-plex mdi-24px"></i></a></h2>
-						<h4>Open Now</h4>
-					</div>
-				</div>
+            <div class="panel-body p-b-0 p-t-0 m-b-0">
 				<div class="p-20 text-center">
 					<p class="">`+v.metadata.summary+`</p>
-					<hr>
 				</div>
 				<div class="row">
 					<div class="col-lg-12">
-
-								<div class="owl-carousel owl-theme metadata-actors p-b-10">`+actors+`</div>
-
+						<div class="owl-carousel owl-theme metadata-actors p-b-10">`+actors+`</div>
 					</div>
 				</div>
             </div>

BIN
plugins/images/rotten.png