From 99de2294dd47244bd55dc4b9900277bb0bdeccdb Mon Sep 17 00:00:00 2001 From: fuzzard Date: Wed, 28 Dec 2022 08:33:40 +1000 Subject: [PATCH 1/3] Allow user to set specific IP of hdhomerun unit --- .../resource.language.en_gb/strings.po | 4 ++++ pvr.hdhomerun/resources/settings.xml | 8 +++++++ src/HDHomeRunTuners.cpp | 22 +++++++++++++++++++ src/Settings.cpp | 6 +++++ src/Settings.h | 4 ++++ 5 files changed, 44 insertions(+) diff --git a/pvr.hdhomerun/resources/language/resource.language.en_gb/strings.po b/pvr.hdhomerun/resources/language/resource.language.en_gb/strings.po index 7ecddfa..70f9db8 100644 --- a/pvr.hdhomerun/resources/language/resource.language.en_gb/strings.po +++ b/pvr.hdhomerun/resources/language/resource.language.en_gb/strings.po @@ -47,3 +47,7 @@ msgstr "" msgctxt "#32006" msgid "Use HTTP discovery" msgstr "" + +msgctxt "#32007" +msgid "Set IP of device to use" +msgstr "" diff --git a/pvr.hdhomerun/resources/settings.xml b/pvr.hdhomerun/resources/settings.xml index a11c85a..4128ecf 100644 --- a/pvr.hdhomerun/resources/settings.xml +++ b/pvr.hdhomerun/resources/settings.xml @@ -28,6 +28,14 @@ false + + 0 + + + true + + + diff --git a/src/HDHomeRunTuners.cpp b/src/HDHomeRunTuners.cpp index 0e1f1ff..c9213bc 100644 --- a/src/HDHomeRunTuners.cpp +++ b/src/HDHomeRunTuners.cpp @@ -180,6 +180,28 @@ bool HDHomeRunTuners::Update(int nMode) nTunerCount = hdhomerun_discover_find_devices_custom_v2( 0, HDHOMERUN_DEVICE_TYPE_TUNER, HDHOMERUN_DEVICE_ID_WILDCARD, foundDevices, 16); + // If neither HTTPDiscovery or normal broadcast discovery do not find a device, if a + // user has entered an IP address in settings for a forced IP, do a search based on that + // specific IP. We only accomodate IPv4 addresses currently. + if (nTunerCount <= 0) + { + std::string strUserForcedIP = SettingsType::Get().GetForcedIP(); + if (!strUserForcedIP.empty()) + { + unsigned char addressbuf[sizeof(struct in6_addr)]; + + int s = inet_pton(AF_INET, strUserForcedIP.c_str(), addressbuf); + if (s > 0) + { + uint32_t ipaddress = (addressbuf[0] << 24) + (addressbuf[1] << 16) + (addressbuf[2] << 8) + addressbuf[3]; + nTunerCount = hdhomerun_discover_find_devices_custom_v2( + ipaddress, HDHOMERUN_DEVICE_TYPE_TUNER, HDHOMERUN_DEVICE_ID_WILDCARD, foundDevices, 16); + + KODI_LOG(ADDON_LOG_DEBUG, "Found %d HDHomeRun tuners on IP %s", nTunerCount, strUserForcedIP.c_str()); + } + } + } + if (nTunerCount <= 0) return false; diff --git a/src/Settings.cpp b/src/Settings.cpp index bc40590..98c6951 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -22,6 +22,7 @@ bool SettingsType::ReadSettings() bMarkNew = kodi::addon::GetSettingBoolean("mark_new", true); bDebug = kodi::addon::GetSettingBoolean("debug", false); bHttpDiscovery = kodi::addon::GetSettingBoolean("http_discovery", false); + strForcedIP = kodi::addon::GetSettingString("force_ip", ""); return true; } @@ -48,6 +49,11 @@ ADDON_STATUS SettingsType::SetSetting(const std::string& settingName, bHttpDiscovery = settingValue.GetBoolean(); return ADDON_STATUS_NEED_RESTART; } + else if (settingName == "force_ip") + { + strForcedIP = settingValue.GetString(); + return ADDON_STATUS_NEED_RESTART; + } return ADDON_STATUS_OK; } diff --git a/src/Settings.h b/src/Settings.h index 636ff15..2d0f495 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -9,6 +9,8 @@ #pragma once +#include + #include class ATTR_DLL_LOCAL SettingsType @@ -24,6 +26,7 @@ class ATTR_DLL_LOCAL SettingsType bool GetDebug() const { return bDebug; } bool GetMarkNew() const { return bMarkNew; } bool GetHttpDiscovery() const { return bHttpDiscovery; } + std::string GetForcedIP() const { return strForcedIP; } private: SettingsType() = default; @@ -33,4 +36,5 @@ class ATTR_DLL_LOCAL SettingsType bool bDebug = false; bool bMarkNew = false; bool bHttpDiscovery = false; + std::string strForcedIP; }; From 44c05ef4caece6a9cceb1e4595f588461ea62038 Mon Sep 17 00:00:00 2001 From: fuzzard Date: Thu, 29 Dec 2022 07:09:42 +1000 Subject: [PATCH 2/3] [settings] Add help labels and reorder some group settings Add some help label and information about some strings for translators Move discovery settings into their own specific group --- .../resource.language.en_gb/strings.po | 26 +++++++++++++++++++ pvr.hdhomerun/resources/settings.xml | 6 +++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/pvr.hdhomerun/resources/language/resource.language.en_gb/strings.po b/pvr.hdhomerun/resources/language/resource.language.en_gb/strings.po index 70f9db8..6c26617 100644 --- a/pvr.hdhomerun/resources/language/resource.language.en_gb/strings.po +++ b/pvr.hdhomerun/resources/language/resource.language.en_gb/strings.po @@ -24,6 +24,7 @@ msgctxt "Addon Description" msgid "HDHomeRun PVR Client" msgstr "" +#. label-category: general msgctxt "#32001" msgid "General" msgstr "" @@ -44,10 +45,35 @@ msgctxt "#32005" msgid "Mark new show" msgstr "" +#. label: Device Discovery - http_discovery msgctxt "#32006" msgid "Use HTTP discovery" msgstr "" +#. label: Device Discovery - force_ip msgctxt "#32007" msgid "Set IP of device to use" msgstr "" + +#. label-group: General - Device Discovery +msgctxt "#32008" +msgid "Device Discovery" +msgstr "" + +#empty strings from id 32009 to 320099 + +#. ############ +#. help info # +#. ############ + +#. help info - General + +#. help: Device Discovery - http_discovery +msgctxt "#32100" +msgid "This uses Silicondust web API to return HDHomeRun devices connected with the same internet IP address" +msgstr "" + +#. help: Device Discovery - force_ip +msgctxt "#32101" +msgid "When other discovery methods do not work, enter an [B]IPv4[/B] address of a HDHomeRun device to explicitly search only that IP. This works when Broadcast and HTTP discovery do not find devices due to LAN/WAN differences in Client/Tuner. Restart Addon by Disabling and Enabling when changed." +msgstr "" diff --git a/pvr.hdhomerun/resources/settings.xml b/pvr.hdhomerun/resources/settings.xml index 4128ecf..22f19de 100644 --- a/pvr.hdhomerun/resources/settings.xml +++ b/pvr.hdhomerun/resources/settings.xml @@ -23,12 +23,14 @@ true - + + + 0 false - + 0 From ea79e32d3896df7685c021d10b76f690628f7625 Mon Sep 17 00:00:00 2001 From: fuzzard Date: Thu, 29 Dec 2022 07:36:04 +1000 Subject: [PATCH 3/3] Version bump to 20.5.0 + changelog --- pvr.hdhomerun/addon.xml.in | 2 +- pvr.hdhomerun/changelog.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pvr.hdhomerun/addon.xml.in b/pvr.hdhomerun/addon.xml.in index 70f1674..4116f87 100644 --- a/pvr.hdhomerun/addon.xml.in +++ b/pvr.hdhomerun/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff --git a/pvr.hdhomerun/changelog.txt b/pvr.hdhomerun/changelog.txt index decf9b5..d186a6c 100644 --- a/pvr.hdhomerun/changelog.txt +++ b/pvr.hdhomerun/changelog.txt @@ -1,3 +1,7 @@ +v20.5.0 +- Add some help labels to some settings and group discovery related settings +- Allow a user to specifically set IP address of HDHomerun device to search for if other discovery methods dont work. + v20.4.0 - Kodi inputstream API update to version 3.2.0 - Kodi PVR API update to version 8.0.2