Cloudbox / autoscan

Autoscan replaces the default Plex and Emby behaviour for picking up changes on the file system.
MIT License
594 stars 49 forks source link

jellyfin: No target libraries found / failed determining library #237

Open domi-a opened 3 weeks ago

domi-a commented 3 weeks ago

hi,

wonderful work. discovered this app yesterday and got it running in a couple of minutes. thanks!

i know there are a lot of issues with this error message. but i thinkered the whole day and am pretty sure, that this is a bug.

i don't need rewrite rules as my paths for autoscan and jellyfin are exact the same. everytime i make changes to the filesysem, it can't match it to my jellyfin library. WRN No target libraries found error="/mnt/video_temp/movies: failed determining library" target=jellyfin url=http://10.13.13.11:8096

it seems like this line does not make any sense: https://github.com/Cloudbox/autoscan/blob/e5575d5ffd35141615e9e144ff42d99aaa5b8af7/targets/jellyfin/jellyfin.go#L97 it never matches my paths. but looking in https://github.com/Cloudbox/autoscan/blob/e5575d5ffd35141615e9e144ff42d99aaa5b8af7/targets/jellyfin/api.go#L118 the library path always get suffixed with a slash, while the fs changes always come without a trailing slash!

i did not manage to debug this code, but it seems to compare every 'folder' without a slash suffix to a 'l.Path' with a slash suffix. which never matches and does not send updates to jellyfin. so the HasPrefix method seems not appropiate.

for everyone who needs a immediate fix:

i would suggest not relying on must have target rewrite rules. and the real fix would be not much work and should not harm any other bad behavior.

while looking at the code i have the feeling it may affect other target systems like plex as well. maybe it would be a good idea to not suffix the read lines from the system with a slash or suffixing every path from fs changes with a trailing slash.

sry for the poor analysis, i did never read any go code before this day.

best regards, domi