mirror of
https://github.com/linuxserver/Heimdall-Apps.git
synced 2026-02-06 03:42:06 +08:00
Plex section status (#828)
* Update livestats.blade.php Print the media section information * Update config.blade.php Setting media section keys * Update Plex.php Querying media section data * 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
This commit is contained in:
parent
48e2ab3979
commit
663c81f679
@ -26,37 +26,35 @@ class Plex extends \App\SupportedApps implements \App\EnhancedApps
|
||||
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);
|
||||
|
||||
@ -5,6 +5,14 @@
|
||||
<label>{{ strtoupper(__('app.url')) }}</label>
|
||||
{!! Form::text('config[override_url]', isset($item) ? $item->getconfig()->override_url : null, ['placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control']) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label title="">Section 1 Key (<a href="https://support.plex.tv/articles/201638786-plex-media-server-url-commands/" target="_blank">help?</a>)</label>
|
||||
{!! 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
|
||||
</div>
|
||||
<div class="input">
|
||||
<label title="">Section 2 Key (<a href="https://support.plex.tv/articles/201638786-plex-media-server-url-commands/" target="_blank">help?</a>)</label>
|
||||
{!! 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
|
||||
</div>
|
||||
<div class="input">
|
||||
<label title="">Plex Token (<a href="https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/" target="_blank">help?</a>)</label>
|
||||
{!! Form::text('config[token]', isset($item) ? $item->getconfig()->token : null, ['placeholder' => __('token'), 'data-config' => 'token', 'class' => 'form-control config-item']) !!}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Recent</span>
|
||||
<strong>{!! $recently_added ?? '' !!}</strong>
|
||||
<span class="title">{!! $section_1_title ?? '' !!}</span>
|
||||
<strong>{!! $section_1_number ?? '' !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">On Deck</span>
|
||||
<strong>{!! $on_deck ?? '' !!}</strong>
|
||||
<span class="title">{!! $section_2_title ?? '' !!}</span>
|
||||
<strong>{!! $section_2_number ?? '' !!}</strong>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user