-
-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from robearlam/master
Updated Lidarr to be an enhanced app
- Loading branch information
Showing
4 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,39 @@ | ||
<?php namespace App\SupportedApps\Lidarr; | ||
|
||
class Lidarr extends \App\SupportedApps { | ||
class Lidarr 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('system/status')); | ||
echo $test->status; | ||
} | ||
|
||
public function livestats() | ||
{ | ||
$status = 'inactive'; | ||
$missing = json_decode(parent::execute($this->url('wanted/missing'))->getBody()); | ||
$queue = json_decode(parent::execute($this->url('queue'))->getBody()); | ||
|
||
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/v1/'.$endpoint.'?apikey='.$this->config->apikey; | ||
return $api_url; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |