Browse Source

plex fix on fix on fix on fix, geez

causefx 8 năm trước cách đây
mục cha
commit
0b98e1ac2e

+ 2 - 14
api/functions/api-functions.php

@@ -149,20 +149,8 @@ function createDB($path,$filename) {
     	// Create Options
     	$options = $createDB->query('CREATE TABLE `options` (
     		`id`	INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
-    		`users_id`	INTEGER UNIQUE,
-    		`title`	TEXT UNIQUE,
-    		`topbar`	TEXT,
-    		`bottombar`	TEXT,
-    		`sidebar`	TEXT,
-    		`hoverbg`	TEXT,
-    		`topbartext`	TEXT,
-    		`activetabBG`	TEXT,
-    		`activetabicon`	TEXT,
-    		`activetabtext`	TEXT,
-    		`inactiveicon`	TEXT,
-    		`inactivetext`	TEXT,
-    		`loading`	TEXT,
-    		`hovertext`	TEXT
+    		`name`	TEXT UNIQUE,
+    		`value`	TEXT
     	);');
     	// Create Invites
     	$invites = $createDB->query('CREATE TABLE `invites` (

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

@@ -97,8 +97,9 @@ function resolvePlexItem($item) {
             $plexItem['nowPlayingBottom'] = (string)$item['year'];
 		}
         $plexItem['elapsed'] = isset($item['viewOffset']) ? (int)$item['viewOffset'] : null;
+        $plexItem['elapsed'] = isset($plexItem['elapsed']) && $plexItem['elapsed'] == 0 ? null : $plexItem['elapsed'];
         $plexItem['duration'] = isset($item['duration']) ? (int)$item['duration'] : (int)$item->Media['duration'];
-        $plexItem['watched'] = ($plexItem['elapsed'] ? floor(($plexItem['elapsed'] / $plexItem['duration']) * 100) : 0);
+        $plexItem['watched'] = ($plexItem['elapsed'] && $plexItem['duration'] ? floor(($plexItem['elapsed'] / $plexItem['duration']) * 100) : 0);
         $plexItem['transcoded'] = isset($item->TranscodeSession['progress']) ? floor((int)$item->TranscodeSession['progress']- $plexItem['watched']) : '';
         $plexItem['stream'] = isset($item->Media->Part->Stream['decision']) ? (string)$item->Media->Part->Stream['decision']: '';
         $plexItem['id'] = str_replace('"', '', (string)$item->Player['machineIdentifier']);