ajout heimdall
This commit is contained in:
55
heimdall/config/www/SupportedApps/Plex/Plex.php
Executable file
55
heimdall/config/www/SupportedApps/Plex/Plex.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php namespace App\SupportedApps\Plex;
|
||||
|
||||
class Plex extends \App\SupportedApps implements \App\EnhancedApps {
|
||||
|
||||
public $config;
|
||||
|
||||
//protected $login_first = true; // Uncomment if api requests need to be authed first
|
||||
//protected $method = 'POST'; // Uncomment if requests to the API should be set by POST
|
||||
|
||||
function __construct() {
|
||||
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
$test = parent::appTest($this->url('/library/recentlyAdded'));
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('/library/recentlyAdded'));
|
||||
|
||||
$body = $res->getBody();
|
||||
$xml = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
|
||||
$data = [];
|
||||
if($xml) {
|
||||
$data['recently_added'] = $xml['size'];
|
||||
$status = 'active';
|
||||
}
|
||||
|
||||
$res = parent::execute($this->url('/library/onDeck'));
|
||||
|
||||
$body = $res->getBody();
|
||||
$xml = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
|
||||
if($xml) {
|
||||
$data['on_deck'] = $xml['size'];
|
||||
$status = 'active';
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$url = parse_url(parent::normaliseurl($this->config->url));
|
||||
$scheme = $url['scheme'];
|
||||
$domain = $url['host'];
|
||||
$port = isset($url['port']) ? $url['port'] : '32400';
|
||||
$api_url = $scheme."://".$domain.":".$port.$endpoint."?X-Plex-Token=".$this->config->token;
|
||||
return $api_url;
|
||||
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/Plex/app.json
Executable file
10
heimdall/config/www/SupportedApps/Plex/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "aebda823a279b219476c565be863d83739999502",
|
||||
"name": "Plex",
|
||||
"website": "https://www.plex.tv/",
|
||||
"license": "Freemium",
|
||||
"description": "Plex media server allows you to aggregate all your personal media and access it anywhere you go. Enjoy your own content on all your devices with Plex.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "plex.png"
|
||||
}
|
||||
15
heimdall/config/www/SupportedApps/Plex/config.blade.php
Executable file
15
heimdall/config/www/SupportedApps/Plex/config.blade.php
Executable file
@@ -0,0 +1,15 @@
|
||||
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
|
||||
<div class="items">
|
||||
<input type="hidden" data-config="dataonly" class="config-item" name="config[dataonly]" value="1" />
|
||||
<div class="input">
|
||||
<label>{{ strtoupper(__('app.url')) }}</label>
|
||||
{!! Form::text('config[override_url]', (isset($item) ? $item->getconfig()->override_url : null), array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
|
||||
</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), array('placeholder' => __('token'), 'data-config' => 'token', 'class' => 'form-control config-item')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
11
heimdall/config/www/SupportedApps/Plex/livestats.blade.php
Executable file
11
heimdall/config/www/SupportedApps/Plex/livestats.blade.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Recent</span>
|
||||
<strong>{!! $recently_added !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">On Deck</span>
|
||||
<strong>{!! $on_deck !!}</strong>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
BIN
heimdall/config/www/SupportedApps/Plex/plex.png
Executable file
BIN
heimdall/config/www/SupportedApps/Plex/plex.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
Reference in New Issue
Block a user