jellyfin / jellyfin-kodi

Jellyfin Plugin for Kodi
https://jellyfin.org
GNU General Public License v3.0
860 stars 113 forks source link

Server name/address, Login method, and Username are disabled in settings #383

Open Jon12345 opened 4 years ago

Jon12345 commented 4 years ago

Looks like a known issue, but it's tripped me up a few times (apologies if there's already a github issue).

https://www.reddit.com/r/jellyfin/comments/g2bshe/jellyfin_for_kodi_server_address_greyed_out_in/

Workaround (as mentioned in reddit): Addons ->My add-ons -> Jellyfin -> Configure -> Advanced -> Reset local Kodi database -> Restart Kodi

mcarlton00 commented 4 years ago

What's your use case for this? It was disabled on purpose so that users weren't getting malformed databases from trying to change between multiple servers. Also as I mentioned on the reddit thread, it didn't seem to actually work/save properly from my testing at the time.

Jon12345 commented 4 years ago

I rebooted my router and my jellyfin server got a new IP, so Kodi was no longer able to play items (stuck on "Working" forever). (That seems like another issue - why does it remember an old IP when I only gave it a hostname?)

The work-around is fine - it's just hard for users to know that it's needed. Maybe "Reset database" can be moved to be closer to these server details?

mcarlton00 commented 4 years ago

The "proper" fix is to use DNS to connect to your server instead of hardcoded IP addresses. Also a server generally is hardcoded to a given IP address, so getting a new DHCP address just doesn't happen in the large cases.

If you connected by hostname/DNS, it will always use DNS and not store the IP address. However, if you used the autodetect to connect to your server instead of manually entering a URL that will function only over ip:port.

The problem is that the server URL needs to be changed in multiple places in the stored files (and possibly database, I don't remember), so it's not a super straightforward thing to do. And if you were connected to server A and then change it to server B without resetting the database, bad things happen.

Jon12345 commented 4 years ago

Just so I understand correctly, you're recommending to: 1) Not use autodetect to connect (as this will store the IP address), and 2) Manually connect to the server via DNS hostname, not IP address and/or 3) Hardcode IP address for the jellyfin server ?

mcarlton00 commented 4 years ago

More or less, yeah.

If you give your server a static IP address, then autodetect is totally fine since it will never change. So it's more

or

I personally would say this is better practice regardless, as this issue will likely occur on all clients, not just Kodi.

Though I can see the appeal of wanting an option to update the server URL in the app without needing to resync the database. We'll need to think more about how it could be done safely. Likely connecting to the new URL and checking if the server ID is the same, otherwise prompting to reset the database.

Jon12345 commented 4 years ago

Sounds good. I don't have any issue with needing to reset the database, or about static IPs. My concern is more about the discoverability - ie how do users know that's what is needed?

Some possible solutions:

Btw a couple of unrelated minor UX issues:

mcarlton00 commented 4 years ago

I don't like saying "reset database is the solution" because depending on the library size, that could be a pretty long process. Syncing my music library alone is almost a half hour. Which is kinda why we generally recommend fixing it using other technologies that are meant to handle those sort of dynamic updates so the app doesn't have to worry about them.

hostho commented 4 years ago

I ran into this issue as well by autodiscovery of a dynamic ip. Resetting the db is not an option as the initial sync takes several hours (a lot of music).

My workaround is a static ip mapping for the original dynamic address - clearly my fault as I did not do this before setting up jellyfin&kodi.

I propose several fixes, maybe one of these will help with this problem:

jellyfin-kodi has worked perfectly for me besides this minor issue. I can try and implement options 1 and/or 3 if you like these approaches.

mcarlton00 commented 4 years ago

The music sync should be significantly faster since 0.5.8 now (from 15 minutes to 2 minutes on my system), but that's besides the point here.

  1. Not really feasible. If somebody isn't running DNS on their local network, reverse DNS lookups wouldn't give us any info.
  2. Also not really feasible. The android app is basically all ethereal. We need to have that metadata synced, and if you do the auto discovery and somehow find a different server (at a friends' house, for example), it probably won't be helpful.
  3. This is more or less what I've been thinking of, but haven't gotten to looking into it yet. At a minimum it's stored in $HOME/.kodi/userdata/addon_data/plugin.video.jellyfin/settings.xml and $HOME/.kodi/userdata/addon_data/plugin.video.jellyfin/data.json. My impression is that it should only live in the settings file. It may also be in the database somewhere, but I don't remember 100%. I don't see it in jellyfin.db from a quick glance, but more in depth digging is needed.