ajout heimdall
This commit is contained in:
66
heimdall/config/www/SupportedApps/Jellyfin/Jellyfin.php
Executable file
66
heimdall/config/www/SupportedApps/Jellyfin/Jellyfin.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?php namespace App\SupportedApps\Jellyfin;
|
||||
|
||||
class Jellyfin extends \App\SupportedApps implements \App\EnhancedApps
|
||||
{
|
||||
public $config;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
$test = parent::appTest(
|
||||
$this->url("System/Info/Public"),
|
||||
$this->getAttrs()
|
||||
);
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = "inactive";
|
||||
$res = parent::execute($this->url("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-MediaBrowser-Token" => $this->config->password,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public static function getAvailableStats()
|
||||
{
|
||||
return [
|
||||
"MovieCount" => "Movies",
|
||||
"SeriesCount" => "Series",
|
||||
"EpisodeCount" => "Episodes",
|
||||
"ArtistCount" => "Artists",
|
||||
"ProgramCount" => "Programs",
|
||||
"TrailerCount" => "Trailers",
|
||||
"SongCount" => "Songs",
|
||||
"AlbumCount" => "Albums",
|
||||
"MusicVideoCount" => "MusicVideos",
|
||||
"BoxSetCount" => "BoxSets",
|
||||
"BookCount" => "Books",
|
||||
"ItemCount" => "Items",
|
||||
];
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/Jellyfin/app.json
Executable file
10
heimdall/config/www/SupportedApps/Jellyfin/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "3e0a7f109bd760b9474c78cb652e8c3e82669226",
|
||||
"name": "Jellyfin",
|
||||
"website": "https://jellyfin.github.io",
|
||||
"license": "GNU General Public License v2.0 only",
|
||||
"description": "Jellyfin is the Free Software Media System that puts you in control of managing and streaming your media. There are no strings attached, no premium licenses or features, and no hidden agendas.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "jellyfin.svg"
|
||||
}
|
||||
18
heimdall/config/www/SupportedApps/Jellyfin/config.blade.php
Executable file
18
heimdall/config/www/SupportedApps/Jellyfin/config.blade.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<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, ['placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control']) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>{{ __('app.apps.password') }} (secret token)</label>
|
||||
{!! Form::input('password', 'config[password]', '', ['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\Jellyfin\Jellyfin::getAvailableStats(), isset($item) ? $item->getConfig()->availablestats ?? null : null, ['multiple' => 'multiple']) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
BIN
heimdall/config/www/SupportedApps/Jellyfin/jellyfin.png
Executable file
BIN
heimdall/config/www/SupportedApps/Jellyfin/jellyfin.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
8
heimdall/config/www/SupportedApps/Jellyfin/livestats.blade.php
Executable file
8
heimdall/config/www/SupportedApps/Jellyfin/livestats.blade.php
Executable file
@@ -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