From 0701a6d5827aab4cc2dab0d0af47ddefc665c744 Mon Sep 17 00:00:00 2001 From: mikley Date: Mon, 28 Apr 2025 09:07:39 +0200 Subject: [PATCH 1/4] Update livestats.blade.php Print the media section information --- Plex/livestats.blade.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plex/livestats.blade.php b/Plex/livestats.blade.php index 33e5b11acf..5c20c12b25 100644 --- a/Plex/livestats.blade.php +++ b/Plex/livestats.blade.php @@ -1,11 +1,11 @@ From a8660e04bbfc3186421ee6525e5b3ddf8a1a8f58 Mon Sep 17 00:00:00 2001 From: mikley Date: Mon, 28 Apr 2025 09:08:35 +0200 Subject: [PATCH 2/4] Update config.blade.php Setting media section keys --- Plex/config.blade.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Plex/config.blade.php b/Plex/config.blade.php index 9fb3380660..f572e37e43 100644 --- a/Plex/config.blade.php +++ b/Plex/config.blade.php @@ -5,6 +5,14 @@ {!! Form::text('config[override_url]', isset($item) ? $item->getconfig()->override_url : null, ['placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control']) !!} +
+ + {!! Form::text('config[section_1_key]', isset($item) ? $item->getconfig()->section_1_key : null, ['placeholder' => __('section_1_key'), 'data-config' => 'section_1_key', 'class' => 'form-control config-i +
+
+ + {!! Form::text('config[section_2_key]', isset($item) ? $item->getconfig()->section_2_key : null, ['placeholder' => __('section_2_key'), 'data-config' => 'section_2_key', 'class' => 'form-control config-i +
{!! Form::text('config[token]', isset($item) ? $item->getconfig()->token : null, ['placeholder' => __('token'), 'data-config' => 'token', 'class' => 'form-control config-item']) !!} From 29694414af9571e42032df3260f9d18e88627ec9 Mon Sep 17 00:00:00 2001 From: mikley Date: Mon, 28 Apr 2025 09:10:32 +0200 Subject: [PATCH 3/4] Update Plex.php Querying media section data --- Plex/Plex.php | 54 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/Plex/Plex.php b/Plex/Plex.php index 1aeeda6b1d..fad93f1411 100644 --- a/Plex/Plex.php +++ b/Plex/Plex.php @@ -26,37 +26,35 @@ public function test() public function livestats() { $status = "inactive"; - $res = parent::execute( - $this->url("/library/recentlyAdded"), - $this->attrs() - ); - $body = $res->getBody(); - $xml = simplexml_load_string( - $body, - "SimpleXMLElement", - LIBXML_NOCDATA | LIBXML_NOBLANKS - ); - $data = []; - - if ($xml) { - $data["recently_added"] = $xml["size"]; - $status = "active"; + if($this->config->section_1_key > 0) { + $res = parent::execute($this->url("/library/sections/{$this->config->section_1_key}/all"), $this->attrs()); + $body = $res->getBody(); + $xml = simplexml_load_string( + $body, + "SimpleXMLElement", + LIBXML_NOCDATA | LIBXML_NOBLANKS + ); + if ($xml) { + $data["section_1_number"] = $xml["size"]; + $data["section_1_title"] = $xml["librarySectionTitle"]; + $status = "active"; + } } - $res = parent::execute($this->url("/library/onDeck")); - - $res = parent::execute($this->url("/library/onDeck"), $this->attrs()); - - $body = $res->getBody(); - $xml = simplexml_load_string( - $body, - "SimpleXMLElement", - LIBXML_NOCDATA | LIBXML_NOBLANKS - ); - if ($xml) { - $data["on_deck"] = $xml["size"]; - $status = "active"; + if($this->config->section_2_key > 0) { + $res = parent::execute($this->url("/library/sections/{$this->config->section_2_key}/all"), $this->attrs()); + $body = $res->getBody(); + $xml = simplexml_load_string( + $body, + "SimpleXMLElement", + LIBXML_NOCDATA | LIBXML_NOBLANKS + ); + if ($xml) { + $data["section_2_number"] = $xml["size"]; + $data["section_2_title"] = $xml["librarySectionTitle"]; + $status = "active"; + } } return parent::getLiveStats($status, $data); From 4083ca9835a21657e0515fa5176517aaba84131e Mon Sep 17 00:00:00 2001 From: mikley Date: Mon, 28 Apr 2025 15:02:56 +0200 Subject: [PATCH 4/4] Update Plex.php PHPCS fix 30 | ERROR | [x] Expected 1 space after IF keyword; 0 found 45 | ERROR | [x] Expected 1 space after IF keyword; 0 found --- Plex/Plex.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plex/Plex.php b/Plex/Plex.php index fad93f1411..e440e9f9d9 100644 --- a/Plex/Plex.php +++ b/Plex/Plex.php @@ -27,7 +27,7 @@ public function livestats() { $status = "inactive"; $data = []; - if($this->config->section_1_key > 0) { + if ($this->config->section_1_key > 0) { $res = parent::execute($this->url("/library/sections/{$this->config->section_1_key}/all"), $this->attrs()); $body = $res->getBody(); $xml = simplexml_load_string( @@ -42,7 +42,7 @@ public function livestats() } } - if($this->config->section_2_key > 0) { + if ($this->config->section_2_key > 0) { $res = parent::execute($this->url("/library/sections/{$this->config->section_2_key}/all"), $this->attrs()); $body = $res->getBody(); $xml = simplexml_load_string(