Browse Source

Update Sonarr.php

pull/271/head
alxlaxv 7 years ago
committed by GitHub
parent
commit
6e7c2df032
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      app/SupportedApps/Sonarr.php

14
app/SupportedApps/Sonarr.php

@ -51,8 +51,8 @@ class Sonarr implements Contracts\Applications, Contracts\Livestats
$active = 'active';
$html = '
<ul class="livestats">
<li><span class="title">Wanted: ' . $this->getWanted() . '</span></li>
<li><span class="title">Activity: ' . $this->getQueue() . '</span></li>
<li><span class="title">Missing: ' . $this->getMissing() . '</span></li>
</ul>
';
return json_encode(['status' => $active, 'html' => $html]);
@ -69,7 +69,7 @@ class Sonarr implements Contracts\Applications, Contracts\Livestats
return $res;
}
public function getWanted()
public function getMissing()
{
$config = $this->config;
$url = $config->url;
@ -77,12 +77,12 @@ class Sonarr implements Contracts\Applications, Contracts\Livestats
$api_url = $url . '/api/wanted/missing?apikey=' . $config->apiKey . '&pageSize=1';
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]);
$res = json_decode($client->request('GET', $api_url));
$wanted = $res->totalRecords;
if (empty($wanted))
$missing = $res->totalRecords;
if (empty($missing))
{
$wanted = 0;
$missing = 0;
}
return $wanted;
return $missing;
}
public function getQueue()

Loading…
Cancel
Save