diff --git a/Findnlohmann_json.cmake b/Findnlohmann_json.cmake index 1161db0..0469a91 100644 --- a/Findnlohmann_json.cmake +++ b/Findnlohmann_json.cmake @@ -1,9 +1,9 @@ find_path(NLOHMANNJSON_INCLUDE_DIR nlohmann/json.hpp) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(NlohmannJson DEFAULT_MSG NLOHMANNJSON_INCLUDE_DIR) +find_package_handle_standard_args(nlohmann_json DEFAULT_MSG NLOHMANNJSON_INCLUDE_DIR) -if(NLOHMANNJSON_FOUND) +if(nlohmann_json_FOUND) set(NLOHMANNJSON_INCLUDE_DIRS ${NLOHMANNJSON_INCLUDE_DIR}) endif() diff --git a/pvr.freebox/addon.xml.in b/pvr.freebox/addon.xml.in index 65881e7..ccd8d92 100644 --- a/pvr.freebox/addon.xml.in +++ b/pvr.freebox/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff --git a/pvr.freebox/resources/language/resource.language.en_gb/strings.po b/pvr.freebox/resources/language/resource.language.en_gb/strings.po index 14b5543..ad40e58 100644 --- a/pvr.freebox/resources/language/resource.language.en_gb/strings.po +++ b/pvr.freebox/resources/language/resource.language.en_gb/strings.po @@ -117,11 +117,11 @@ msgid "Convert French categories into standard categories." msgstr "" msgctxt "#30025" -msgid "Server" +msgid "Server (DNS)" msgstr "" msgctxt "#30026" -msgid "Server name or IP address." +msgid "Server's host name or IP address." msgstr "" msgctxt "#30027" @@ -140,3 +140,11 @@ msgctxt "#30030" msgid "HLS" msgstr "" +msgctxt "#30031" +msgid "Server (NetBIOS)" +msgstr "" + +msgctxt "#30032" +msgid "Server's NetBIOS name." +msgstr "" + diff --git a/pvr.freebox/resources/language/resource.language.fr_fr/strings.po b/pvr.freebox/resources/language/resource.language.fr_fr/strings.po index 86fc8e4..942ec37 100644 --- a/pvr.freebox/resources/language/resource.language.fr_fr/strings.po +++ b/pvr.freebox/resources/language/resource.language.fr_fr/strings.po @@ -117,12 +117,12 @@ msgid "Convert French categories into standard categories." msgstr "Conversion des catégories françaises en catégories standard." msgctxt "#30025" -msgid "Server" -msgstr "Serveur" +msgid "Server (DNS)" +msgstr "Serveur (DNS)" msgctxt "#30026" -msgid "Server name or IP address." -msgstr "Nom du serveur ou adresse IP." +msgid "Server's host name or IP address." +msgstr "Nom d'hôte du serveur ou adresse IP." msgctxt "#30027" msgid "Protocol" @@ -140,3 +140,11 @@ msgctxt "#30030" msgid "HLS" msgstr "HLS" +msgctxt "#30031" +msgid "Server (NetBIOS)" +msgstr "Serveur (NetBIOS)" + +msgctxt "#30032" +msgid "Server's NetBIOS name" +msgstr "Nom NetBIOS du serveur." + diff --git a/pvr.freebox/resources/settings.xml b/pvr.freebox/resources/settings.xml index 3854dbb..58b68f8 100644 --- a/pvr.freebox/resources/settings.xml +++ b/pvr.freebox/resources/settings.xml @@ -3,11 +3,16 @@
- + 2 mafreebox.freebox.fr + + 2 + FREEBOX + + 0 10 diff --git a/src/Freebox.cpp b/src/Freebox.cpp index c01906b..d11a435 100644 --- a/src/Freebox.cpp +++ b/src/Freebox.cpp @@ -857,8 +857,8 @@ bool Freebox::ProcessChannels () for (auto & s : *f) data.emplace_back (ParseSource (s["type"]), ParseQuality (s["quality"]), - freebox_replace_server (s["rtsp"], m_server), - freebox_replace_server (s["hls"], m_server)); + freebox_replace_server (s["rtsp"], m_hostname), + freebox_replace_server (s["hls"], m_hostname)); } #if 0 if (! kodi::vfs::DirectoryExists (m_path + "logos")) @@ -927,22 +927,34 @@ Freebox::~Freebox () CloseSession (); } -void Freebox::SetServer (const string & server) +void Freebox::SetHostName (const string & hostname) { lock_guard lock (m_mutex); - m_server = server; + m_hostname = hostname; } -string Freebox::GetServer () const +string Freebox::GetHostName () const { lock_guard lock (m_mutex); - return m_server; + return m_hostname; +} + +void Freebox::SetNetBIOS (const string & netbios) +{ + lock_guard lock (m_mutex); + m_netbios = netbios; +} + +string Freebox::GetNetBIOS () const +{ + lock_guard lock (m_mutex); + return m_netbios; } // NOT thread-safe ! string Freebox::URL (const string & query) const { - return "http://" + m_server + query; + return "http://" + m_hostname + query; } void Freebox::SetSource (Source s) @@ -1224,9 +1236,15 @@ ADDON_STATUS Freebox::Create () ADDON_STATUS Freebox::SetSetting (const string & settingName, const kodi::CSettingValue & settingValue) { - /**/ if (settingName == "server") + /**/ if (settingName == "hostname") + { + SetHostName (settingValue.GetString ()); + return ADDON_STATUS_NEED_RESTART; + } + + else if (settingName == "netbios") { - SetServer (settingValue.GetString ()); + SetNetBIOS (settingValue.GetString ()); return ADDON_STATUS_NEED_RESTART; } @@ -1259,7 +1277,8 @@ ADDON_STATUS Freebox::SetSetting (const string & settingName, const kodi::CSetti void Freebox::ReadSettings () { - m_server = kodi::GetSettingString ("server", PVR_FREEBOX_DEFAULT_SERVER); + m_hostname = kodi::GetSettingString ("hostname", PVR_FREEBOX_DEFAULT_HOSTNAME); + m_netbios = kodi::GetSettingString ("netbios", PVR_FREEBOX_DEFAULT_NETBIOS); m_delay = kodi::GetSettingInt ("delay", PVR_FREEBOX_DEFAULT_DELAY); m_tv_source = kodi::GetSettingEnum ("source", PVR_FREEBOX_DEFAULT_SOURCE); m_tv_quality = kodi::GetSettingEnum ("quality", PVR_FREEBOX_DEFAULT_QUALITY); @@ -1304,7 +1323,7 @@ PVR_ERROR Freebox::GetBackendVersion (string & version) PVR_ERROR Freebox::GetBackendHostname (string & hostname) { - hostname = GetServer (); + hostname = GetHostName (); return PVR_ERROR_NO_ERROR; } @@ -1542,7 +1561,7 @@ PVR_ERROR Freebox::GetRecordingStreamProperties (const kodi::addon::PVRRecording return PVR_ERROR_SERVER_ERROR; const Recording & r = i->second; - string stream = "smb://" + m_server + '/' + r.media + '/' + r.path + '/' + r.filename; + string stream = "smb://" + m_netbios + '/' + r.media + '/' + r.path + '/' + r.filename; properties.emplace_back (PVR_STREAM_PROPERTY_STREAMURL, stream); properties.emplace_back (PVR_STREAM_PROPERTY_ISREALTIMESTREAM, "false"); diff --git a/src/Freebox.h b/src/Freebox.h index d46e397..746f2a8 100644 --- a/src/Freebox.h +++ b/src/Freebox.h @@ -54,7 +54,8 @@ #define PVR_FREEBOX_STRING_CHANNEL_QUALITY_LD 30018 #define PVR_FREEBOX_STRING_CHANNEL_QUALITY_3D 30019 -#define PVR_FREEBOX_DEFAULT_SERVER "mafreebox.freebox.fr" +#define PVR_FREEBOX_DEFAULT_HOSTNAME "mafreebox.freebox.fr" +#define PVR_FREEBOX_DEFAULT_NETBIOS "FREEBOX" #define PVR_FREEBOX_DEFAULT_DELAY 10 #define PVR_FREEBOX_DEFAULT_SOURCE Source::IPTV #define PVR_FREEBOX_DEFAULT_QUALITY Quality::HD @@ -382,8 +383,10 @@ class ATTRIBUTE_HIDDEN Freebox : void ReadSettings (); // Freebox Server. - void SetServer (const std::string &); - std::string GetServer () const; + void SetHostName (const std::string &); + std::string GetHostName () const; + void SetNetBIOS (const std::string &); + std::string GetNetBIOS () const; // Source setting. void SetSource (Source); @@ -469,7 +472,8 @@ class ATTRIBUTE_HIDDEN Freebox : // Add-on path. std::string m_path; // Freebox Server. - std::string m_server = PVR_FREEBOX_DEFAULT_SERVER; + std::string m_hostname = PVR_FREEBOX_DEFAULT_HOSTNAME; + std::string m_netbios = PVR_FREEBOX_DEFAULT_NETBIOS; // Delay between queries. int m_delay = PVR_FREEBOX_DEFAULT_DELAY; // Freebox OS //////////////////////////////////////////////////////////////