roblav96 1 Posted October 13, 2019 Posted October 13, 2019 TLDR How does the server tell a client to re-render library content? A few example use-cases are: client searches for library media, server dynamically adds media to library, client never receives library updates until they type the next word client views a library item, server dynamically downloads subtitles for library item, client never receives subtitle updates until they press back and view the library item again Things I've tried: POST /Library/Media/Updated only downloads metadata for parameters in the request body POST /Sessions/{Id}/Message/LibraryChanged command but the clients never receive a websocket message, the only time I've witnesses the client receive a LibraryChanged message is a full minute after a library scan is completed, would be nice to manually send this command immediately after the library scan Issues I've come across: Roku clients never receive updates of any kind from the server, most likely related to using roku's native remote control api which is restricted to same subnet ip addresses
Luke 38499 Posted October 23, 2019 Posted October 23, 2019 The server tells the clients via the websocket LibraryChanged messages, and yes, that can take a minute or so after the change actually happens. POST /Library/Media/Updated only downloads metadata for parameters in the request body This tells the server that a file changed, which then feeds that notification into the same place that the realtime monitor notifies. And then eventually later this will send LibraryChanged if something in the database was updated as a result of the file changes. client searches for library media, server dynamically adds media to library, client never receives library updates until they type the next word When does the server dynamically add media?
roblav96 1 Posted October 25, 2019 Author Posted October 25, 2019 Is there anyway I can manually send the LibraryChanged event to clients via websocket on the server? I've tried something like: await Session.command('LibraryChanged', { CollectionFolders: [], FoldersAddedTo: ['4'], FoldersRemovedFrom: [], IsEmpty: false, ItemsAdded: [], ItemsRemoved: [], ItemsUpdated: Items.map(v => v.Id), }) but the clients never received. The server dynamically adds media from my search plugin: https://github.com/roblav96/futon-media/blob/ba65f92d1589138bcccbb08e153dc3da949ad933/src/emby/search.ts#L98
Luke 38499 Posted October 25, 2019 Posted October 25, 2019 No, you can't force that to be sent out. You should use /Library/Media/Updated. This will tell the server that files were changed, and eventually this will lead to LibraryChanged messages getting sent out. Having said that, I'm not sure what your code is doing, but if it's creating or editing strm files then you might just be able to enable the realtime monitor and let that do the work for you of notifying the apps.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now