diff --git a/app/Item.php b/app/Item.php
index aed4c2d9..6cff9776 100644
--- a/app/Item.php
+++ b/app/Item.php
@@ -26,6 +26,7 @@ class Item extends Model
public static function supportedList()
{
return [
+ 'CouchPotato' => \App\SupportedApps\CouchPotato::class,
'Deluge' => \App\SupportedApps\Deluge::class,
'Dokuwiki' => \App\SupportedApps\Dokuwiki::class,
'Duplicati' => \App\SupportedApps\Duplicati::class,
diff --git a/app/SupportedApps/CouchPotato.php b/app/SupportedApps/CouchPotato.php
new file mode 100644
index 00000000..82d93343
--- /dev/null
+++ b/app/SupportedApps/CouchPotato.php
@@ -0,0 +1,122 @@
+_client = new Client(
+ ['http_errors' => false,
+ 'timeout' => 10]
+ );
+ }
+
+ public function defaultColour()
+ {
+ return '#363840';
+ }
+ public function icon()
+ {
+ return 'supportedapps/couchPotato.png';
+ }
+ public function configDetails()
+ {
+ return 'couchpotato';
+ }
+ public function testConfig()
+ {
+ $res = $this->sendRequest();
+ if ($res == null) {
+ echo 'CouchPotato connection failed';
+ return;
+ }
+ switch($res->getStatusCode()) {
+ case 200:
+ echo "Successfully connected to CouchPotato";
+ break;
+ case 401:
+ echo 'Failed: Invalid credentials';
+ break;
+ case 404:
+ echo 'Failed: Please make sure your URL is correct and includes the port';
+ break;
+ case 409:
+ echo 'Failed: Incorrect session id';
+ break;
+ default:
+ echo 'Something went wrong... Code: '.$res->getStatusCode();
+ break;
+ }
+ }
+
+ public function executeConfig()
+ {
+ $html = '';
+ $res = $this->sendRequest();
+ if ($res == null) {
+ Log::debug('CouchPotato connection failed');
+ return '';
+ }
+ $data = json_decode($res->getBody());
+ if (! isset($data->movies)) {
+ Log::debug('Failed to fetch data from CouchPotato');
+ return '';
+ }
+ $movies = $data->movies;
+ $wantedMovies = $availableMovies = 0;
+ foreach ($movies as $v) {
+ switch ($v->status) {
+ case 'active':
+ $wantedMovies++;
+ break;
+ case 'done':
+ $availableMovies++;
+ break;
+ default:
+ Log::warning('Unexpected CouchPotato status received: '.$v['status']);
+ break;
+ }
+ }
+
+ $html = '
+
+
Wanted'.$wantedMovies.'
+
Available'.$availableMovies.'
+
+ ';
+ return json_encode(['status' => 'inactive', 'html' => $html]);
+ }
+
+ private function sendRequest()
+ {
+ $res = null;
+ try{
+ $res = $this->_client->request(
+ 'GET',
+ $this->getApiUrl()
+ );
+ }catch(\GuzzleHttp\Exception\BadResponseException $e){
+ Log::error("Connection to {$e->getRequest()->getUrl()} failed");
+ Log::debug($e->getMessage());
+ $res = $e->getRequest();
+ }catch(\GuzzleHttp\Exception\ConnectException $e) {
+ Log::error("CouchPotato connection refused");
+ Log::debug($e->getMessage());
+ }
+ return $res;
+ }
+
+ private function getApiUrl()
+ {
+ $url = $this->config->url;
+ $url = rtrim($url, '/');
+ $apiUrl = $url.'/api/'.$this->config->apikey.'/movie.list';
+ return $apiUrl;
+ }
+}
diff --git a/readme.md b/readme.md
index db3872a4..42f49770 100644
--- a/readme.md
+++ b/readme.md
@@ -28,6 +28,7 @@ If you want to see a quick video of it in use, go to https://youtu.be/GXnnMAxPzM
You can use the app to link to any site or application, but Foundation apps will auto fill in the icon for the app and supply a default color for the tile. In addition Enhanced apps allow you provide details to an apps API, allowing you to view live stats directly on the dashboad. For example, the NZBGet and Sabnzbd Enhanced apps will display the queue size and download speed while something is downloading.
**Enhanced**
+- CouchPotato
- NZBGet
- Pihole
- PlexPy
diff --git a/resources/views/supportedapps/couchpotato.blade.php b/resources/views/supportedapps/couchpotato.blade.php
new file mode 100644
index 00000000..beffe7f0
--- /dev/null
+++ b/resources/views/supportedapps/couchpotato.blade.php
@@ -0,0 +1,13 @@
+