jellyfin / jellyfin-media-player

Jellyfin Desktop Client
GNU General Public License v2.0
3.3k stars 326 forks source link

Add automatic (or manual) home screen refresh #164

Open joshuaboniface opened 3 years ago

joshuaboniface commented 3 years ago

Is your feature request related to a problem? Please describe. Currently, the home screen of JMP never refreshes. This means that, for example, if new media is added to the library, the home screen won't update to show the new items in "Next Up"/"Latest ".

Describe the solution you'd like Some sort of automatic refresh of the homepage would be lovely. It wouldn't have to be too often, maybe every 30 or 60 seconds, and could be configurable. A "refresh" button in the top-right could also help.

Describe alternatives you've considered My current workaround is to visit a library, then return back home, but this is slightly annoying.

Additional context Since JMP is "just a wrapper" around Jellyfin Web, this might be better implemented there, but I figured I'd make the feature request here first to get your take on it - I've not noticed the issue when using Web, it seems to just occasionally refresh.

iwalton3 commented 3 years ago

I though new items were supposed to be added to the home screen by using the websocket feed without a page refresh?

joshuaboniface commented 3 years ago

That's what I figured too, but for some reason that isn't happening. I'd suspect it might be due to the websocket terminating (e.g. when my laptop goes to sleep), so perhaps periodic checks of the websocket connection are a better solution.

iwalton3 commented 3 years ago

Two considerations for the next time this happens:

joshuaboniface commented 3 years ago

Did you add the media while the computer was asleep?

Sometimes yes, sometimes no, it seems to happen in either case.

Can you use PlayTo to play media on JMP from another web browser after the computer wakes up?

I'll try this now.

joshuaboniface commented 3 years ago

Can you use PlayTo to play media on JMP from another web browser after the computer wakes up?

This did seem to work immediately.

Here's a Q though, what are the default websocket timeouts and such? I wonder if my HAProxy is throwing it for a loop.

iwalton3 commented 3 years ago

So interestingly enough, there is no automatic websocket reconnect on disconnect. Instead what happens is the next time the application gains focus again, it calls ensureWebSocket which will open the connection again.

https://github.com/jellyfin/jellyfin-web/blob/0831207057c26ba5d760b6e9617d05260a142f13/src/components/apphost.js#L401-L413

https://github.com/jellyfin/jellyfin-web/blob/0831207057c26ba5d760b6e9617d05260a142f13/src/components/appRouter.js#L532-L538

However, if you can PlayTo the jellyfin-media-player, that means the websocket connection is alive. One thing to note is that if media is added while the computer is asleep, JMP will not get the notification through the websocket that new media was added. This is also why Kodi needs a sync queue (although obviously for this situation we could just refresh the home page), since while Kodi listens for added items, it has to "catch up" while offline.

So I suppose the next question is does the websocket event actually get used for new media to update the home page? I know for sure it is used for "Next Up" to show the playback status.

joshuaboniface commented 3 years ago

Curious, I'm not sure, and come to think of it even when JMP is active (laptop not asleep) I've never seen it respond immediately to new media.

Cadair commented 2 years ago

I have been running into this since starting using it. For me it seems the websocket connection gets interrupted when I turn my screen off and it doesn't automatically come back without restarting the app. (I get refreshes, but I don't get remote control from other devices, if I just navigate to a different page).

guiltlab commented 2 years ago

Would really like a refresh button on the main page to scan for new additions.

sevenrats commented 11 months ago

for now this can be worked around by right clicking the background of any page and selecting "Refresh" Id like to convert this to a discussion, since it's not really a bug and we don't have a clear view of what the solution should look like. In fact, there is a very similar discussion open on server about automatic page updates. in my opinion this thread should be closed and linked to https://github.com/jellyfin/jellyfin/discussions/10700, our new universal location for discussing how to best provide automatic updates to the UI across the board. i will make this move eventually if I don't hear from anybody.