ajout heimdall
This commit is contained in:
51
heimdall/config/www/SupportedApps/Sonarr/Sonarr.php
Executable file
51
heimdall/config/www/SupportedApps/Sonarr/Sonarr.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php namespace App\SupportedApps\Sonarr;
|
||||
|
||||
class Sonarr 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()
|
||||
{
|
||||
$attrs = [
|
||||
'headers' => ['Accept' => 'application/json']
|
||||
];
|
||||
$test = parent::appTest($this->url('system/status'), $attrs);
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$data = [];
|
||||
$attrs = [
|
||||
'headers' => ['Accept' => 'application/json']
|
||||
];
|
||||
|
||||
|
||||
$missing = json_decode(parent::execute($this->url('wanted/missing'), $attrs)->getBody());
|
||||
$queue = json_decode(parent::execute($this->url('queue'), $attrs)->getBody());
|
||||
|
||||
$data = [];
|
||||
|
||||
if($missing || $queue) {
|
||||
$data['missing'] = $missing->totalRecords ?? 0;
|
||||
$data['queue'] = $queue->totalRecords ?? 0;
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
|
||||
}
|
||||
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url).'api/v3/'.$endpoint.'?apikey='.$this->config->apikey;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
27
heimdall/config/www/SupportedApps/Sonarr/app.json
Executable file
27
heimdall/config/www/SupportedApps/Sonarr/app.json
Executable file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"appid": "6e2a525ceb737f9ed8badcef5eb20d1502e39656",
|
||||
"name": "Sonarr",
|
||||
"website": "https://sonarr.tv/",
|
||||
"license": "GNU General Public License v3.0 only",
|
||||
"description": "Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort and rename them. It can also be configured to automatically upgrade the quality of files already downloaded when a better quality format becomes available.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "sonarr.png",
|
||||
"config": {
|
||||
"type": "apikey",
|
||||
"stat1": {
|
||||
"name": "Missing",
|
||||
"url": ":url:api/wanted/missing?apikey=:apikey:",
|
||||
"key": "totalRecords",
|
||||
"filter": "none",
|
||||
"updateOnChange": "No"
|
||||
},
|
||||
"stat2": {
|
||||
"name": "Queue",
|
||||
"url": ":url:api/queue?apikey=:apikey:",
|
||||
"key": null,
|
||||
"filter": "count",
|
||||
"updateOnChange": "No"
|
||||
}
|
||||
}
|
||||
}
|
||||
15
heimdall/config/www/SupportedApps/Sonarr/config.blade.php
Executable file
15
heimdall/config/www/SupportedApps/Sonarr/config.blade.php
Executable file
@@ -0,0 +1,15 @@
|
||||
<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.apikey') }}</label>
|
||||
{!! Form::text('config[apikey]', (isset($item) ? $item->getconfig()->apikey : null), array('placeholder' => __('app.apps.apikey'), 'data-config' => 'apikey', 'class' => 'form-control config-item')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
10
heimdall/config/www/SupportedApps/Sonarr/livestats.blade.php
Executable file
10
heimdall/config/www/SupportedApps/Sonarr/livestats.blade.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Missing</span>
|
||||
<strong>{!! $missing !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">Queue</span>
|
||||
<strong>{!! $queue !!}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
BIN
heimdall/config/www/SupportedApps/Sonarr/sonarr.png
Executable file
BIN
heimdall/config/www/SupportedApps/Sonarr/sonarr.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
Reference in New Issue
Block a user