ajout heimdall
This commit is contained in:
52
heimdall/config/www/SupportedApps/SABnzbd/SABnzbd.php
Executable file
52
heimdall/config/www/SupportedApps/SABnzbd/SABnzbd.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php namespace App\SupportedApps\SABnzbd;
|
||||
|
||||
class SABnzbd 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('queue'));
|
||||
if($test->code === 200) {
|
||||
$data = json_decode($test->response);
|
||||
if(isset($data->error) && !empty($data->error)) {
|
||||
$test->status = 'Failed: '.$data->error;
|
||||
}
|
||||
}
|
||||
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('queue'));
|
||||
$details = json_decode($res->getBody());
|
||||
|
||||
$data = [];
|
||||
|
||||
if($details) {
|
||||
$size = $details->queue->mbleft;
|
||||
$rate = $details->queue->kbpersec;
|
||||
$data['queue_size'] = format_bytes($size*1000*1000, false, ' <span>', '</span>');
|
||||
$data['current_speed'] = format_bytes($rate*1000, false, ' <span>', '/s</span>');
|
||||
$status = ($size > 0 || $rate > 0) ? 'active' : 'inactive';
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$apikey = $this->config->apikey;
|
||||
$api_url = parent::normaliseurl($this->config->url).'api?output=json&apikey='.$apikey.'&mode='.$endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
29
heimdall/config/www/SupportedApps/SABnzbd/app.json
Executable file
29
heimdall/config/www/SupportedApps/SABnzbd/app.json
Executable file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"appid": "7aa898759f1d210aaa5edc8a184bfe5e1668b5bd",
|
||||
"name": "SABnzbd",
|
||||
"website": "https://sabnzbd.org/",
|
||||
"license": "GNU General Public License v2.0 or later",
|
||||
"description": "SABnzbd is a multi-platform binary newsgroup downloader. The program works in the background and simplifies the downloading verifying and extracting of files from Usenet.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "sabnzbd.png",
|
||||
"config": {
|
||||
"type": "apikey",
|
||||
"stat1": {
|
||||
"name": "Queue",
|
||||
"url": ":url:api?output=json&apikey=:apikey:&mode=queue",
|
||||
"key": "queue.sizeleft",
|
||||
"filter": "none",
|
||||
"updateOnChange": "Yes",
|
||||
"suffix": ""
|
||||
},
|
||||
"stat2": {
|
||||
"name": "Speed",
|
||||
"url": ":url:api?output=json&apikey=:apikey:&mode=queue",
|
||||
"key": "queue.speed",
|
||||
"filter": "speed",
|
||||
"updateOnChange": "Yes",
|
||||
"suffix": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
15
heimdall/config/www/SupportedApps/SABnzbd/config.blade.php
Executable file
15
heimdall/config/www/SupportedApps/SABnzbd/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/SABnzbd/livestats.blade.php
Executable file
10
heimdall/config/www/SupportedApps/SABnzbd/livestats.blade.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Queue</span>
|
||||
<strong>{!! $queue_size !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">Speed</span>
|
||||
<strong>{!! $current_speed !!}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
BIN
heimdall/config/www/SupportedApps/SABnzbd/sabnzbd.png
Executable file
BIN
heimdall/config/www/SupportedApps/SABnzbd/sabnzbd.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
Reference in New Issue
Block a user