From 724b671ec90d05c62e68f8d7cd775fa1f607a4cf Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Wed, 16 Mar 2022 23:36:42 +0100 Subject: [PATCH] Tdarr enhanced app (#419) * update logo * Add statuses to panel * Set "enhanced": true --- Tdarr/Tdarr.php | 85 +++++++++++++++++++++++++++++++++++++- Tdarr/app.json | 2 +- Tdarr/config.blade.php | 10 +++++ Tdarr/livestats.blade.php | 16 +++++++ Tdarr/tdarr.png | Bin 11823 -> 244384 bytes 5 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 Tdarr/config.blade.php create mode 100644 Tdarr/livestats.blade.php diff --git a/Tdarr/Tdarr.php b/Tdarr/Tdarr.php index e4f1788f3..f0a951acd 100644 --- a/Tdarr/Tdarr.php +++ b/Tdarr/Tdarr.php @@ -1,5 +1,86 @@ 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; + } +} -} \ No newline at end of file diff --git a/Tdarr/app.json b/Tdarr/app.json index 1e95149f6..812bb7a69 100644 --- a/Tdarr/app.json +++ b/Tdarr/app.json @@ -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" } \ No newline at end of file diff --git a/Tdarr/config.blade.php b/Tdarr/config.blade.php new file mode 100644 index 000000000..53f26e13c --- /dev/null +++ b/Tdarr/config.blade.php @@ -0,0 +1,10 @@ +
zNLPE%k3}
zfZ=f7hiKaE)^+^O-L1}d7~W&$gn902oN*ys6|k+kF!;PmheRk@OXj1c
zyqQr3r5>(NTb#9rW1?S|D#J-d`w*^@b^n4<-*k5~1jj=SG6PkVN+~bXb
5wclCtxD;-^mIIYg-z>6@(wet{TX=N!
z@9U}R0Z9(Uv3l20cC0Z{I1