|
@ -2,19 +2,24 @@ |
|
|
use GuzzleHttp\Exception\GuzzleException; |
|
|
use GuzzleHttp\Exception\GuzzleException; |
|
|
use GuzzleHttp\Client; |
|
|
use GuzzleHttp\Client; |
|
|
|
|
|
|
|
|
class Sonarr implements Contracts\Applications, Contracts\Livestats { |
|
|
class Sonarr implements Contracts\Applications, Contracts\Livestats |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
public function defaultColour() |
|
|
public function defaultColour() |
|
|
{ |
|
|
{ |
|
|
return '#163740'; |
|
|
return '#163740'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function icon() |
|
|
public function icon() |
|
|
{ |
|
|
{ |
|
|
return 'supportedapps/sonarr.png'; |
|
|
return 'supportedapps/sonarr.png'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function configDetails() |
|
|
public function configDetails() |
|
|
{ |
|
|
{ |
|
|
return 'sonarr'; |
|
|
return 'sonarr'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function testConfig() |
|
|
public function testConfig() |
|
|
{ |
|
|
{ |
|
|
$res = $this->getStatus(); |
|
|
$res = $this->getStatus(); |
|
@ -39,6 +44,7 @@ class Sonarr implements Contracts\Applications, Contracts\Livestats { |
|
|
echo 'Something went wrong'; |
|
|
echo 'Something went wrong'; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function executeConfig() |
|
|
public function executeConfig() |
|
|
{ |
|
|
{ |
|
|
$html = ''; |
|
|
$html = ''; |
|
@ -51,6 +57,7 @@ class Sonarr implements Contracts\Applications, Contracts\Livestats { |
|
|
'; |
|
|
'; |
|
|
return json_encode(['status' => $active, 'html' => $html]); |
|
|
return json_encode(['status' => $active, 'html' => $html]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getStatus() |
|
|
public function getStatus() |
|
|
{ |
|
|
{ |
|
|
$config = $this->config; |
|
|
$config = $this->config; |
|
@ -61,6 +68,7 @@ class Sonarr implements Contracts\Applications, Contracts\Livestats { |
|
|
$res = $client->request('GET', $api_url); |
|
|
$res = $client->request('GET', $api_url); |
|
|
return $res; |
|
|
return $res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getWanted() |
|
|
public function getWanted() |
|
|
{ |
|
|
{ |
|
|
$config = $this->config; |
|
|
$config = $this->config; |
|
@ -70,11 +78,13 @@ class Sonarr implements Contracts\Applications, Contracts\Livestats { |
|
|
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|
|
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); |
|
|
$res = json_decode($client->request('GET', $api_url)); |
|
|
$res = json_decode($client->request('GET', $api_url)); |
|
|
$wanted = $res->totalRecords; |
|
|
$wanted = $res->totalRecords; |
|
|
if (empty($wanted)) { |
|
|
if (empty($wanted)) |
|
|
|
|
|
{ |
|
|
$wanted = 0; |
|
|
$wanted = 0; |
|
|
} |
|
|
} |
|
|
return $wanted; |
|
|
return $wanted; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getQueue() |
|
|
public function getQueue() |
|
|
{ |
|
|
{ |
|
|
$config = $this->config; |
|
|
$config = $this->config; |
|
|