arabcoders / watchstate

Self-hosted service to sync your plex, jellyfin and emby play state. without relying on 3rd-party external services.
MIT License
478 stars 9 forks source link

[BUG] this is not working #419

Closed 7eptem closed 8 months ago

7eptem commented 8 months ago

Describe the bug ERROR: Request for [homeplex] libraries has failed Please Describe the problem you are facing. i have installed in urand (regardless if i tick in template export/import enable or disable) no difference i added a backend, put api and when i run docker exec -ti watchstate console state:export -vvifs homeplex

NOTICE: Not possible to use push mode when [-f, --force-full] flag is used. NOTICE: SYSTEM: Using push mode for [0] backends and export mode for [1] backends. NOTICE: Export mode start. NOTICE: SYSTEM: Preloading DirectMapper data. INFO: MAPPER: Preloaded [0] pointers into memory. NOTICE: SYSTEM: Preloading DirectMapper data is complete. NOTICE: SYSTEM: Exporting play state to [homeplex]. ERROR: Request for [homeplex] libraries has failed. WARNING: SYSTEM: Not updating last export date. [homeplex] report an error. NOTICE: SYSTEM: Sending [0] play state comparison requests. NOTICE: SYSTEM: Sent [0] play state comparison requests. NOTICE: Export mode ends. NOTICE: SYSTEM: No play state changes detected. WARNING: SYSTEM: Not updating last export date for [homeplex]. Backend reported an error.

based on insttructions

then i used docker exec -ti watchstate console state:export -v -s homeplex , same error

docker exec -ti watchstate console system:logs logger.ERROR: Request for [homeplex] libraries has failed. {"exception":{"file":"/opt/app/vendor/symfony/http-client/Chunk/ErrorChunk.php","line":56,"kind":"Symfony\Component\HttpClient\Exception\TransportException","message":"Could not resolve host: 10-10-10-6.a6788a7f1cdb49f4990a4928edc8d636.plex.direct for \"https://10-10-10-6.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400/library/sections\".","trace":[]}} []

arabcoders commented 8 months ago

from the logs

Could not resolve host: 10-10-10-6.a6788a7f1cdb49f4990a4928edc8d6

use different host when selecting the url.

7eptem commented 8 months ago

https://10-10-10-6.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400 local Ip https://172-18-0-1.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400 i dont know what is that https://81-158-xx-xx.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400 wan IP (dynamic IP)

arabcoders commented 8 months ago

https://10-10-10-6.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400 local Ip

https://172-18-0-1.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400 i dont know what is that

https://81-158-xx-xx.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400 wan IP (dynamic IP)

you can use network_mode: host and use the local ip if plex bot running in a container. if plex is also running in different container. you should probably create common network between them and refer to plex that way.

Sometimes it not possible to contact different vlan from docker.

7eptem commented 8 months ago

this is still not working, even is they are on same network, however if i use http i think is working, don't know for sure, because i don't see any changes from my plex to jellyfin

arabcoders commented 8 months ago

this is still not working, even is they are on same network, however if i use http i think is working, don't know for sure, because i don't see any changes from my plex to jellyfin

could you post your docker-compose for your plex? is the port 32400 exposed globally? if so try manually change the URL to http://10.10.10.6:32400

7eptem commented 8 months ago

this is still not working, even is they are on same network, however if i use http i think is working, don't know for sure, because i don't see any changes from my plex to jellyfin

could you post your docker-compose for your plex? is the port 32400 exposed globally? if so try manually change the URL to http://your_server_ip:32400

yes the port is enabled for remote access so i did added the http://localip:32400 and i think the export command is working but i don't see any changes in my jellyfin

i also added webhooks but i dont know if is properly done because i only paste http://localhost:8080/?apikey=[WEBHOOK_TOKEN] in the webhooks (ho i need a webhook token, where do i get it from)

sorry but the available information is very confusing for me on how to set up

arabcoders commented 8 months ago

Webhook comes later after you have successfully added the backend. the export will not work if there is nothing to export you need first to import the data please follow the steps outlined in README.md

7eptem commented 8 months ago

this is how i set up

1

docker exec -ti watchstate console config:add What should we be calling this backend?

Backend name is used to identify the backend. The backend name must only contains lower case a-z, 0-9 and _.

Choose good name to identify your backend. For example, home_plex.

homeplex

2

Select [homeplex] type. [0] plex [1] emby [2] jellyfin

0

3

Enter [homeplex] X-Plex-Token.

to find your plex token. follow the steps described in the following link. https://support.plex.tv/articles/204059436

Plex uses tokens to differentiate between users. As such the token you enter not necessarily the final one that ends up in the config due to user selection.

plextoken

4

Trying to get list of servers associated with the token from plex.tv API. Please wait... Select [homeplex] URL. [0] HomeCinema - https://10-10-10-6.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400 [1] HomeCinema - https://172-18-0-1.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400 [2] HomeCinema - https://81-158-xx-xx.a6788a7f1cdb49f4990a4928edc8d636.plex.direct:32400 [3] Other. Enter manually.

3 Enter [homeplex] URL.

To see list of servers associated with this plex token, Please write the following as URL http://choose

http://10.10.10.6:32400 (other option did not work)

Attempting to automatically get the server unique identifier from API. Please wait... Backend responded with [29554b44c91bb30e982f534cf8f0b45c062dc12a] as it's unique identifier. setting it as default value. Enter [homeplex] Unique identifier. [Default: 29554b44c91bb30e982f534cf8f0b45c062dc12a]

The Server Unique identifier is randomly generated string on server setup.

If you select invalid or give incorrect server unique identifier, the access token generation will fail. and Webhooks receiver will most likely be non-functional as well.

DO NOT CHANGE the default value unless you know what you are doing, or was told by devs.

i press ENTER

5

Attempting to get users list from plex.tv API. Please wait... Select [homeplex] User.

[0] Seven [1] user2 [2] user3 0 Requesting plex token for [Seven] from plex.tv API.

6

Enable [homeplex] watch/play state import? [Y|N] [Default: Yes]

WARNING: If this backend is new and does not have your correct watch/play state, then YOU MUST answer with no. If the date on movies/episodes is newer than your recorded watch/play date, it will override that. Select no, and export your current watch/play state, and then you can re-enable this option.

For more information please read the FAQ.

ENTER

7

Enable watch/play state export to [homeplex]? [Y|N] [Default: Yes]

If the backend has newer date on movies/episodes, For example new server setup, You're going to need to do forced full sync for the first time, as the export command normally checks the date on objects before changing the play state. and forced full sync override that check. After that you can do normal export. The command to do forced full export is:

docker exec -ti watchstate console state:export -vvifs homeplex

ENTER

8

Limit [plex:homeplex] webhook events to the selected user? [Y|N] [Default: No]

For Plex, if you have managed users, YOU MUST enable this option to prevent other users from diluting your watch/play state. As plex uses webhook associated with the account.

For Jellyfin/Emby, You SHOULD NOT enable this option, instead rely on the server selected user, As sometimes their webhook events does not include user information, and you will be missing events.

Please refers to the FAQ file "What are the webhook limitations?" section to know more

This option only relevant if you're going to use webhook related functionalities.

ENTER

9

Limit [plex:homeplex] webhook events to the specified backend unique id? [Y|N] [Default: No]

for Plex, This option MUST BE enabled if you have multi plex servers associated with your account. As Plex uses Plex account to store webhook URLs not the server itself. If you do not enable this option, then any events from any servers associated with your plex account will be processed.

for Jellyfin/Emby, this option optional and can be enabled if you unified your API key.

This option only relevant if you're going to use webhook related functionalities.

ENTER

10

Limit [plex:homeplex] webhook events to the specified backend unique id? [Y|N] [Default: No]

for Plex, This option MUST BE enabled if you have multi plex servers associated with your account. As Plex uses Plex account to store webhook URLs not the server itself. If you do not enable this option, then any events from any servers associated with your plex account will be processed.

for Jellyfin/Emby, this option optional and can be enabled if you unified your API key.

This option only relevant if you're going to use webhook related functionalities.

homeplex: type: plex token: v8xspxxxxxxxxxxxxxxxx url: 'http://10.10.10.6:32400' uuid: 29554b44c91bb30e982f534cf8f0b45c062dc12a user: 66xxxxxxxx options: plex_user_uuid: 84c65xxxxxxxxxxx ADMIN_TOKEN: 9EjUxxxxxxxxxxx import: enabled: true export: enabled: true webhook: match: user: false uuid: false token: 38d11da0921b1287cd4bac86a051d913

Is the info correct? [Y|N] [Default: Yes]

ENTER

11

Create database indexes now? [Y|N] [Default: Yes]

This is necessary action to ensure speedy operations on database, If you do not run this now, you have to manually run the system:index command, or restart the container which will trigger index check to make sure your database data is fully indexed.

P.S: this could take few minutes to execute.

ENTER

12

Would you like to import play state & metadata from the backend now? [Y|N] [Default: No]

P.S: this could take few minutes to execute.

ENTER Import complete

did the same for Jellyfin then i restarted the container

and i see nothing regardless of what was on system:index command, or restart the container

then i use the command docker exec -ti watchstate console state:import -v -s homeplex -s homejelly

so now how do i know if is working ?

arabcoders commented 8 months ago

it should be ok now, try running db:list see if you see any entires

7eptem commented 8 months ago

it should be ok now, try running db:list see if you see any entires

i do see entry in DB:list

is there any way to force sync, or how do i know if they will be sync'd, i noticed that the task is 1H and 1h:30 min, can be this reduced ?

arabcoders commented 8 months ago

it should be ok now, try running db:list see if you see any entires

i do see entry in DB:list

is there any way to force sync, or how do i know if they will be sync'd, i noticed that the task is 1H and 1h:30 min, can be this reduced ?

if you are sure your data is correct in the database then you can force export using state:export -vvf -s backend_name, hope on discord for quick questions i am available there right now.