ajout heimdall
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
<?php namespace App\SupportedApps\Emby;
|
||||
|
||||
class Emby extends \App\SupportedApps implements \App\EnhancedApps {
|
||||
|
||||
public $config;
|
||||
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
$test = parent::appTest($this->url('System/Info'), $this->getAttrs());
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('/emby/Items/Counts'), $this->getAttrs());
|
||||
$result = json_decode($res->getBody());
|
||||
$details = ['visiblestats'=>[]];
|
||||
foreach($this->config->availablestats as $stat) {
|
||||
$newstat = new \stdClass();
|
||||
$newstat->title = self::getAvailableStats()[$stat];
|
||||
$newstat->value = $result->{$stat};
|
||||
$details['visiblestats'][] = $newstat;
|
||||
}
|
||||
return parent::getLiveStats($status, $details);
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url).$endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
|
||||
private function getAttrs() {
|
||||
return [
|
||||
'headers' => [
|
||||
'X-Emby-Token' => $this->config->password,
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public static function getAvailableStats() {
|
||||
return [
|
||||
'MovieCount'=>'Movies',
|
||||
'SeriesCount'=>'Series',
|
||||
'EpisodeCount'=>'Episodes',
|
||||
'GameCount'=>'Games',
|
||||
'ArtistCount'=>'Artists',
|
||||
'ProgramCount'=>'Programs',
|
||||
'GameSystemCount'=>'GameSystems',
|
||||
'TrailerCount'=>'Trailers',
|
||||
'SongCount'=>'Songs',
|
||||
'AlbumCount'=>'Albums',
|
||||
'MusicVideoCount'=>'MusicVideos',
|
||||
'BoxSetCount'=>'BoxSets',
|
||||
'BookCount'=>'Books',
|
||||
'ItemCount'=>'Items',
|
||||
];
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"appid": "3021fea57e9b932f14822d47e47d163f47812ef1",
|
||||
"name": "Emby",
|
||||
"website": "https://emby.media/",
|
||||
"license": "Proprietary",
|
||||
"description": "Emby (formerly Media Browser) is a media server designed to organize, play, and stream audio and video to a variety of devices.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "emby.png",
|
||||
"config": {
|
||||
"type": "apikey",
|
||||
"stat1": {
|
||||
"name": "Movies",
|
||||
"url": ":url:emby/Items/Counts?api_key=:apikey:",
|
||||
"key": "MovieCount",
|
||||
"filter": "none",
|
||||
"updateOnChange": "No",
|
||||
"suffix": ""
|
||||
},
|
||||
"stat2": {
|
||||
"name": "Series",
|
||||
"url": ":url:emby/Items/Counts?api_key=:apikey:",
|
||||
"key": "SeriesCount",
|
||||
"filter": "none",
|
||||
"updateOnChange": "No",
|
||||
"suffix": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
|
||||
<div class="items">
|
||||
<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>{{ __('app.apps.password') }} (secret token)</label>
|
||||
{!! Form::text('config[password]', isset($item)?$item->getConfig()->password:null, array('placeholder' => __('app.apps.password'), 'data-config' => 'password', 'class' => 'form-control config-item')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>Stats to show</label>
|
||||
{!! Form::select('config[availablestats][]', App\SupportedApps\Emby\Emby::getAvailableStats(), isset($item) ? ($item->getConfig()->availablestats ?? null) : null, array('multiple'=>'multiple')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,8 @@
|
||||
<ul class="livestats">
|
||||
@foreach ($visiblestats as $stat)
|
||||
<li>
|
||||
<span class="title">{!! $stat->title !!}</span>
|
||||
<strong>{!! $stat->value !!}</strong>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
Reference in New Issue
Block a user