ajout heimdall
This commit is contained in:
45
heimdall/config/www/SupportedApps/Nzbget/Nzbget.php
Executable file
45
heimdall/config/www/SupportedApps/Nzbget/Nzbget.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php namespace App\SupportedApps\Nzbget;
|
||||
|
||||
class Nzbget extends \App\SupportedApps implements \App\EnhancedApps {
|
||||
|
||||
public $config;
|
||||
|
||||
public function test()
|
||||
{
|
||||
$test = parent::appTest($this->url('status'));
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
$res = parent::execute($this->url('status'));
|
||||
$details = json_decode($res->getBody());
|
||||
|
||||
$data = [];
|
||||
|
||||
if($details) {
|
||||
$size = $details->result->RemainingSizeMB;
|
||||
$rate = $details->result->DownloadRate;
|
||||
$data['queue_size'] = format_bytes($size*1000*1000, false, ' <span>', '</span>');
|
||||
$data['current_speed'] = format_bytes($rate, false, ' <span>');
|
||||
$status = ($size > 0 || $rate > 0) ? 'active' : 'inactive';
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
|
||||
}
|
||||
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url);
|
||||
$username = urlencode($this->config->username);
|
||||
$password = urlencode($this->config->password);
|
||||
$rebuild_url = str_replace('http://', 'http://'.$username.':'.$password.'@', $api_url);
|
||||
$rebuild_url = str_replace('https://', 'https://'.$username.':'.$password.'@', $rebuild_url);
|
||||
$rebuild_url = rtrim($rebuild_url, '/');
|
||||
|
||||
$api_url = $rebuild_url.'/jsonrpc/'.$endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/Nzbget/app.json
Executable file
10
heimdall/config/www/SupportedApps/Nzbget/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "31a7b1d936c4e8503bb446e5ff8ada669d1846bd",
|
||||
"name": "Nzbget",
|
||||
"website": "https://nzbget.net/",
|
||||
"license": "GNU General Public License v2.0 only",
|
||||
"description": "NZBGet is a binary downloader, which downloads files from Usenet based on information given in nzb-files. NZBGet is written in C++ and is known for its extraordinary performance and efficiency.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "nzbget.png"
|
||||
}
|
||||
18
heimdall/config/www/SupportedApps/Nzbget/config.blade.php
Executable file
18
heimdall/config/www/SupportedApps/Nzbget/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), array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>{{ __('app.apps.username') }}</label>
|
||||
{!! Form::text('config[username]', (isset($item) ? $item->getconfig()->username : null), array('placeholder' => __('app.apps.username'), 'data-config' => 'username', 'class' => 'form-control config-item')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>{{ __('app.apps.password') }}</label>
|
||||
{!! Form::input('password', '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">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
5
heimdall/config/www/SupportedApps/Nzbget/livestats.blade.php
Executable file
5
heimdall/config/www/SupportedApps/Nzbget/livestats.blade.php
Executable file
@@ -0,0 +1,5 @@
|
||||
<ul class="livestats">
|
||||
<li><span class="title">Queue</span><strong>{!! $queue_size !!}</strong></li>
|
||||
<li><span class="title">Speed</span><strong>{!! $current_speed !!}/s</span></strong></li>
|
||||
</ul>
|
||||
|
||||
BIN
heimdall/config/www/SupportedApps/Nzbget/nzbget.png
Executable file
BIN
heimdall/config/www/SupportedApps/Nzbget/nzbget.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Reference in New Issue
Block a user