kodi-pvr / pvr.hdhomerun

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

Use ip address instead of device discovery #116

Open radu022003 opened 2 years ago

radu022003 commented 2 years ago

I am using a hdhomerun tuner over OpenVPN and using the direct link from the device's web interface, plays the video stream without problems. But because of the VPN, the application is not able to discover the tuner by itself. Using a static ip address in the settings menu, would solve this problem and use it in the creation of the url or as the first argument for function hdhomerun_discover_find_devices_custom_v2 , instead of 0, would solve at least this kind of issues.

isamudaison commented 2 years ago

+1 on this... my HDHR tuners are on a different subnet from my Kodi device, and whatever method is used to 'discover' the tuners isn't working. I'd rather be able to input the IP addresses manually.

djp952 commented 2 years ago

There is currently a supported way to do this within the ecosystem, but I have word from SiliconDust that they're planning to make it go away sometime. Not sure who's watching over this PVR right now, and it could be short-lived support, but there is a cloud-based device discovery method as well.

Hitting the URL https://api.hdhomerun.com/discover from pretty much anywhere on the user's network will return JSON indicating the user's local devices. This works across subnets (and in Virtual Machines), but I am unsure as to how crazy the network can get and have it still work:

[
    {
        "DeviceID": "XXXXXXXX",
        "LocalIP": "192.168.0.XXX,
        "ConditionalAccess": 1,
        "BaseURL": "http://192.168.0.XXX",
        "DiscoverURL": "http://192.168.0.XXX/discover.json",
        "LineupURL": "http://192.168.0.XXX/lineup.json"
    },
    {
        "DeviceID": "XXXXXXXX",
        "LocalIP": "192.168.0.XXX",
        "ConditionalAccess": 1,
        "BaseURL": "http://192.168.0.XXX",
        "DiscoverURL": "http://192.168.0.XXX/discover.json",
        "LineupURL": "http://192.168.0.XXX/lineup.json"
    }
]

All that would necessarily be needed from this data is the IP address(es). This addon already has a JSON parser dependency.

I'd be willing to take this on for you and submit a PR, but again my big concern is that the API might suddenly disappear in the near future without warning. SiliconDust's own applications don't use this API anymore (I believe the now defunct my.hdhomerun.com web site did, and that's why it existed), and it's not documented anywhere, but it definitely exists today.

Thoughts?

fuzzard commented 2 years ago

No harm as an optional. Sounds like the simple way the OP was asking for was just an override anyway to set an ip to use for a tuner. So whatever you feel like doing im sure is fine.

Worst case, SD remove the feature, then we just remove it. no harm really.

djp952 commented 2 years ago

Cool; I'll get on this as soon as is possible and we can roll the dice as to how long it will last :)

djp952 commented 2 years ago

Hi @radu022003, it looks like this change has propagated out for both Matrix and Nexus, do you feel that enabling this new option has resolved your concern satisfactorily and this Issue might be able to be closed?

radu022003 commented 2 years ago

Hi, I have just tested it on windows and the hdhomerun is succesfully detected and all channels. Works as expected. One last question, when would it be available for raspberry pi too? I am using it with LibreElec and so far there is not available yet. Maybe a guide about how to compile it for raspberry pi would be also useful. Thanks!

phunkyfish commented 2 years ago

Will a bit of luck it will be in the latest LibreElec release from a few days ago. Hopefully this was merged prior to their kickoff of the release build for kodi 19.4.

LibreElec 10.0.2 should be available for auto update in a few days.