diff --git a/Plex/Plex.php b/Plex/Plex.php index 1aeeda6b1d..e440e9f9d9 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); 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']) !!} +