Skip to content

Commit f8d9251

Browse files
authored
Merge pull request #381 from arabcoders/dev
Made getInfo error more clearly communicated.
2 parents 197859c + 7f5468f commit f8d9251

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

FAQ.md

+45-2
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,54 @@ make `.info.json` optional However at the moment the file is required for emby/j
555555
* Download this plugin [jf-ytdlp-info-reader-plugin](https://github.com/arabcoders/jf-ytdlp-info-reader-plugin). Please
556556
refer to the link on how to install it.
557557

558-
### Emby Setup
558+
#### Emby Setup
559559

560560
* Download this plugin [emby-ytdlp-info-reader-plugin](https://github.com/arabcoders/emby-ytdlp-info-reader-plugin).
561561
Please refer to the link on how to install it.
562562

563563
If your media is not matching correctly or not marking it as expected, it's most likely scanners issues as plex and
564564
jellyfin/emby reports the GUID differently, and we try our best to match them. So, please hop on discord with the
565-
relevant data if they are not matching correctly, and we hopefully can resolve it.
565+
relevant data if they are not matching correctly, and we hopefully can resolve it.
566+
567+
---
568+
569+
### How to check if the container able to communicate with the media backends?
570+
571+
If you having problem adding a backend to `WatchState`, it most likely network related problem, Where the container
572+
isn't able to communicate with the media backend. Thus, you will get errors. To make sure the container is able to
573+
communicate with the media backend, you can run the following command and check the output.
574+
575+
If the command fails for any reason, then you most likely have network related problem.
576+
577+
#### For Plex.
578+
579+
```bash
580+
$ docker exec -ti watchstate bash
581+
$ curl -v -H "Accept: application/json" -H "X-Plex-Token: [PLEX_TOKEN]" http://[PLEX_URL]/library/sections
582+
```
583+
584+
* Replace `[PLEX_TOKEN]` with your plex token.
585+
* Replace `[PLEX_URL]` with your plex url. The one you selected when prompted by the command.
586+
587+
```
588+
{"MediaContainer":{"size":25,...}}
589+
```
590+
591+
If everything is working correctly you should see something like this previous json output.
592+
593+
#### For Jellyfin & Emby.
594+
595+
```bash
596+
$ docker exec -ti watchstate bash
597+
$ curl -v -H "Accept: application/json" -H "X-MediaBrowser-Token: [BACKEND_API_KEY]" http://[BACKEND_HOST]/library/sections
598+
```
599+
600+
* Replace `[BACKEND_API_KEY]` with your jellyfin/emby api key.
601+
* Replace `[BACKEND_HOST]` with your jellyfin/emby host. it can be a host or ip:port i.e. `jf.mydomain.ltd` or `172.23.0.11:8096`
602+
603+
```
604+
{"OperatingSystemDisplayName":"Linux","HasPendingRestart":false,"IsShuttingDown":false,...}}
605+
```
606+
607+
If everything is working correctly you should see something like this previous json output.
608+

src/Backends/Jellyfin/Action/GetInfo.php

+17
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,23 @@ public function __invoke(Context $context, array $opts = []): Response
7474
);
7575
}
7676

77+
if (empty($content)) {
78+
return new Response(
79+
status: false,
80+
error: new Error(
81+
message: 'Request for [{backend}] {action} returned with empty response. Please make sure the container can communicate with the backend.',
82+
context: [
83+
'action' => $this->action,
84+
'client' => $context->clientName,
85+
'backend' => $context->backendName,
86+
'url' => (string)$url,
87+
'response' => $content,
88+
],
89+
level: Levels::ERROR
90+
)
91+
);
92+
}
93+
7794
$item = json_decode(
7895
json: $content,
7996
associative: true,

src/Backends/Plex/Action/GetInfo.php

+17
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,23 @@ public function __invoke(Context $context, array $opts = []): Response
7474
);
7575
}
7676

77+
if (empty($content)) {
78+
return new Response(
79+
status: false,
80+
error: new Error(
81+
message: 'Request for [{backend}] {action} returned with empty response. Please make sure the container can communicate with the backend.',
82+
context: [
83+
'action' => $this->action,
84+
'client' => $context->clientName,
85+
'backend' => $context->backendName,
86+
'url' => (string)$url,
87+
'response' => $content,
88+
],
89+
level: Levels::ERROR
90+
)
91+
);
92+
}
93+
7794
$item = json_decode(
7895
json: $content,
7996
associative: true,

0 commit comments

Comments
 (0)