Skip to content

Commit dac5093

Browse files
Nanganatormvdkleijn
authored andcommitted
Add Seerr enhanced app
Copy of existing Jellyseerr enhanced app with updated details and icon
1 parent e2adcdd commit dac5093

5 files changed

Lines changed: 142 additions & 0 deletions

File tree

Seerr/Seerr.php

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
namespace App\SupportedApps\Seerr;
4+
5+
class Seerr extends \App\SupportedApps implements \App\EnhancedApps
6+
{
7+
public $config;
8+
9+
//protected $login_first = true; // Uncomment if api requests need to be authed first
10+
//protected $method = 'POST'; // Uncomment if requests to the API should be set by POST
11+
12+
public function __construct()
13+
{
14+
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
15+
}
16+
17+
public function test()
18+
{
19+
$attrs = $this->getRequestAttrs();
20+
$test = parent::appTest($this->url("auth/me"), $attrs);
21+
22+
echo $test->status;
23+
}
24+
25+
public function livestats()
26+
{
27+
$status = "inactive";
28+
$data = [];
29+
$attrs = $this->getRequestAttrs();
30+
$requestsType = $this->getConfigValue("requests", "pending");
31+
$requestsCount = json_decode(
32+
parent::execute($this->url("request/count"), $attrs)->getBody()
33+
);
34+
$issuesType = $this->getConfigValue("issues", "open");
35+
$issuesCount = json_decode(
36+
parent::execute($this->url("issue/count"), $attrs)->getBody()
37+
);
38+
39+
if ($requestsCount || $issuesCount) {
40+
$data["requests"] = $requestsCount->$requestsType ?? 0;
41+
$data["issues"] = $issuesCount->$issuesType ?? 0;
42+
}
43+
44+
return parent::getLiveStats($status, $data);
45+
}
46+
47+
public function url($endpoint)
48+
{
49+
$api_url =
50+
parent::normaliseurl($this->config->url) .
51+
"api/v1/" .
52+
$endpoint;
53+
54+
return $api_url;
55+
}
56+
57+
public function getRequestAttrs()
58+
{
59+
$attrs["headers"] = [
60+
"accept" => "application/json",
61+
"X-Api-Key" => $this->config->apikey,
62+
];
63+
64+
return $attrs;
65+
}
66+
67+
public function getConfigValue($key, $default = null)
68+
{
69+
return isset($this->config) && isset($this->config->$key)
70+
? $this->config->$key
71+
: $default;
72+
}
73+
}

Seerr/app.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"appid": "8941259431327e65f98ef6f45f6e673039837daa",
3+
"name": "Seerr",
4+
"website": "https://seerr.dev",
5+
"license": "MIT License",
6+
"description": "Seerr is a request management and media discovery tool built to work with your existing Plex/Jellyfin ecosystem.",
7+
"enhanced": true,
8+
"tile_background": "dark",
9+
"icon": "seerr.svg"
10+
}

Seerr/config.blade.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
2+
<div class="items" style="flex-wrap: wrap;">
3+
<div class="input">
4+
<label>{{ strtoupper(__('app.url')) }}</label>
5+
{!! Form::text('config[override_url]', isset($item) ? $item->getconfig()->override_url : null, ['placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control']) !!}
6+
</div>
7+
<div class="input">
8+
<label>{{ __('app.apps.apikey') }}</label>
9+
{!! Form::text('config[apikey]', isset($item) ? $item->getconfig()->apikey : null, ['placeholder' => __('app.apps.apikey'), 'data-config' => 'apikey', 'class' => 'form-control config-item']) !!}
10+
</div>
11+
<div class="input">
12+
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
13+
</div>
14+
<div class="input">
15+
<label>Requests count</label>
16+
{!! Form::select('config[requests]', ['pending' => 'Pending', 'approved' => 'Approved', 'declined' => 'Declined', 'processing' => 'Processing', 'available' => 'Available', 'movie' => 'Movie', 'tv' => 'TV', 'total' => 'Total'], isset($item) && isset($item->getconfig()->requests) ? $item->getconfig()->requests : null, [
17+
'id' => 'requests',
18+
'class' => 'form-control config-item',
19+
]) !!}
20+
</div>
21+
<div class="input">
22+
<label>Issues count</label>
23+
{!! Form::select('config[issues]', ['open' => 'Open', 'closed' => 'Closed', 'video' => 'Video', 'audio' => 'Audio', 'subtitles' => 'Subtitles', 'others' => 'Others', 'total' => 'Total'], isset($item) && isset($item->getconfig()->issues) ? $item->getconfig()->issues : null, [
24+
'id' => 'issues',
25+
'class' => 'form-control config-item',
26+
]) !!}
27+
</div>
28+
</div>

Seerr/livestats.blade.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<ul class="livestats">
2+
<li>
3+
<span class="title">Requests</span>
4+
<strong>{!! $requests !!}</strong>
5+
</li>
6+
<li>
7+
<span class="title">Issues</span>
8+
<strong>{!! $issues !!}</strong>
9+
</li>
10+
</ul>

Seerr/seerr.svg

Lines changed: 21 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)