diff --git a/Seerr/Seerr.php b/Seerr/Seerr.php new file mode 100644 index 0000000000..8ed4d29411 --- /dev/null +++ b/Seerr/Seerr.php @@ -0,0 +1,73 @@ +jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set + } + + public function test() + { + $attrs = $this->getRequestAttrs(); + $test = parent::appTest($this->url("auth/me"), $attrs); + + echo $test->status; + } + + public function livestats() + { + $status = "inactive"; + $data = []; + $attrs = $this->getRequestAttrs(); + $requestsType = $this->getConfigValue("requests", "pending"); + $requestsCount = json_decode( + parent::execute($this->url("request/count"), $attrs)->getBody() + ); + $issuesType = $this->getConfigValue("issues", "open"); + $issuesCount = json_decode( + parent::execute($this->url("issue/count"), $attrs)->getBody() + ); + + if ($requestsCount || $issuesCount) { + $data["requests"] = $requestsCount->$requestsType ?? 0; + $data["issues"] = $issuesCount->$issuesType ?? 0; + } + + return parent::getLiveStats($status, $data); + } + + public function url($endpoint) + { + $api_url = + parent::normaliseurl($this->config->url) . + "api/v1/" . + $endpoint; + + return $api_url; + } + + public function getRequestAttrs() + { + $attrs["headers"] = [ + "accept" => "application/json", + "X-Api-Key" => $this->config->apikey, + ]; + + return $attrs; + } + + public function getConfigValue($key, $default = null) + { + return isset($this->config) && isset($this->config->$key) + ? $this->config->$key + : $default; + } +} diff --git a/Seerr/app.json b/Seerr/app.json new file mode 100644 index 0000000000..7a6501e1d0 --- /dev/null +++ b/Seerr/app.json @@ -0,0 +1,10 @@ +{ + "appid": "8941259431327e65f98ef6f45f6e673039837daa", + "name": "Seerr", + "website": "https://seerr.dev", + "license": "MIT License", + "description": "Seerr is a request management and media discovery tool built to work with your existing Plex/Jellyfin ecosystem.", + "enhanced": true, + "tile_background": "dark", + "icon": "seerr.svg" +} \ No newline at end of file diff --git a/Seerr/config.blade.php b/Seerr/config.blade.php new file mode 100644 index 0000000000..61c549bb8e --- /dev/null +++ b/Seerr/config.blade.php @@ -0,0 +1,28 @@ +

{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')

+
+
+ + {!! Form::text('config[override_url]', isset($item) ? $item->getconfig()->override_url : null, ['placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control']) !!} +
+
+ + {!! Form::text('config[apikey]', isset($item) ? $item->getconfig()->apikey : null, ['placeholder' => __('app.apps.apikey'), 'data-config' => 'apikey', 'class' => 'form-control config-item']) !!} +
+
+ +
+
+ + {!! 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, [ + 'id' => 'requests', + 'class' => 'form-control config-item', + ]) !!} +
+
+ + {!! 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, [ + 'id' => 'issues', + 'class' => 'form-control config-item', + ]) !!} +
+
diff --git a/Seerr/livestats.blade.php b/Seerr/livestats.blade.php new file mode 100644 index 0000000000..0e1e305aff --- /dev/null +++ b/Seerr/livestats.blade.php @@ -0,0 +1,10 @@ + diff --git a/Seerr/seerr.svg b/Seerr/seerr.svg new file mode 100644 index 0000000000..fdd50a8d3d --- /dev/null +++ b/Seerr/seerr.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file