kodi-pvr / pvr.hdhomerun

Kodi's HDHomeRun client addon
GNU General Public License v2.0
20 stars 24 forks source link

[Backport] Add setting to use HTTP-based tuner discovery #135

Closed djp952 closed 2 years ago

djp952 commented 2 years ago

Backport of PR https://github.com/kodi-pvr/pvr.hdhomerun/pull/133 - "Add setting to use HTTP-based tuner discovery" for Matrix, which reads:

Refers to Issue https://github.com/kodi-pvr/pvr.hdhomerun/issues/116 - "Use ip address instead of device discovery"

This Pull Request adds a new setting to the addon that allows users to opt into using the SiliconDust API "HTTP Discovery" (at least that's what I've always it) to find their tuner devices. The normal UDP broadcast discovery doesn't work when the tuner(s) are on a different subnet than the client.

The HTTP discovery data can become "stale", as any device the user had turned on and connected will stay in this list for up to 24 hours after it's been turned off or disconnected. As such, the only data points used from the API are "DeviceID", which indicates the device has tuners and "LocalIP". The LocalIP address is used to then contact the device and gather the discovery information normally via libhdhomerun. This allows stale devices to be ignored.

If no devices are found via HTTP, there is a fallback to try UDP discovery as well. I felt this important since this API might disappear in the future.