mirror of
https://github.com/linuxserver/Heimdall-Apps.git
synced 2026-02-20 04:16:08 +08:00
Tdarr enhanced app (#419)
* update logo * Add statuses to panel * Set "enhanced": true
This commit is contained in:
parent
b16ce38cbb
commit
724b671ec9
@ -1,5 +1,86 @@
|
||||
<?php namespace App\SupportedApps\Tdarr;
|
||||
|
||||
class Tdarr extends \App\SupportedApps {
|
||||
class Tdarr extends \App\SupportedApps implements \App\EnhancedApps
|
||||
{
|
||||
|
||||
public $config;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
$url = $this->url('api/v2/status/');
|
||||
$test = parent::appTest($url);
|
||||
|
||||
echo $test->status;
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = 'inactive';
|
||||
|
||||
$reqData = array(
|
||||
'data' => array(
|
||||
'collection' => 'StatisticsJSONDB',
|
||||
'mode' => 'getById',
|
||||
'docID' => 'statistics'
|
||||
) ,
|
||||
);
|
||||
|
||||
$url = $this->url('api/v2/cruddb/');
|
||||
// Setup cURL
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch, array(
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json'
|
||||
) ,
|
||||
CURLOPT_POSTFIELDS => json_encode($reqData)
|
||||
));
|
||||
|
||||
// Send the request
|
||||
$response = curl_exec($ch);
|
||||
|
||||
// Check for errors
|
||||
if ($response === false)
|
||||
{
|
||||
die(curl_error($ch));
|
||||
}
|
||||
|
||||
$details = [];
|
||||
// Decode the response
|
||||
$details = json_decode($response, true);
|
||||
|
||||
$data = [];
|
||||
$data['queue'] = '';
|
||||
$data['processed'] = '';
|
||||
$data['errored'] = '';
|
||||
|
||||
if ($details)
|
||||
{
|
||||
$data['queue'] = $details['table1Count'] + $details['table4Count'];
|
||||
$data['processed'] = $details['table2Count'] + $details['table5Count'];
|
||||
$errored = $details['table3Count'] + $details['table6Count'];
|
||||
if ($errored > 0)
|
||||
{
|
||||
$data['errored'] = $errored;
|
||||
}
|
||||
}
|
||||
|
||||
// Close the cURL handler
|
||||
curl_close($ch);
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this
|
||||
->config
|
||||
->url) . $endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
"website": "https://github.com/HaveAGitGat/Tdarr",
|
||||
"license": "GNU General Public License v3.0 only",
|
||||
"description": "Tdarr is a self hosted web-app for automating media library transcode/remux management and making sure your files are exactly how you need them to be in terms of codecs/streams/containers etc. Designed to work alongside Sonarr/Radarr and built with the aim of modularisation, parallelisation and scalability, each library you add has its own transcode settings, filters and schedule. Workers can be fired up and closed down as necessary, and are split into 3 types - 'general', 'transcode' and 'health check'. Worker limits can be managed by the scheduler as well as manually. For a desktop application with similar functionality please see HBBatchBeast.",
|
||||
"enhanced": false,
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "tdarr.png"
|
||||
}
|
||||
10
Tdarr/config.blade.php
Normal file
10
Tdarr/config.blade.php
Normal file
@ -0,0 +1,10 @@
|
||||
<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]', null, array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
16
Tdarr/livestats.blade.php
Normal file
16
Tdarr/livestats.blade.php
Normal file
@ -0,0 +1,16 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Queue</span>
|
||||
<strong>{!! $queue !!}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">Proc</span>
|
||||
<strong>{!! $processed !!}</strong>
|
||||
</li>
|
||||
<?php if ($errored!='') { ?>
|
||||
<li>
|
||||
<span class="title">Err</span>
|
||||
<strong>{!! $errored !!}</strong>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
BIN
Tdarr/tdarr.png
BIN
Tdarr/tdarr.png
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 239 KiB |
Loading…
x
Reference in New Issue
Block a user