Skip to content

Commit a063bdd

Browse files
authored
Merge pull request #826 from phunkyfish/conn-mgr-special-paths
Fix supporting of local paths in Connection Manager
2 parents cc885d2 + 4b8bfa7 commit a063bdd

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

pvr.iptvsimple/addon.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<addon
33
id="pvr.iptvsimple"
4-
version="21.7.0"
4+
version="21.7.1"
55
name="IPTV Simple Client"
66
provider-name="nightik and Ross Nicholson">
77
<requires>@ADDON_DEPENDS@

pvr.iptvsimple/changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v21.7.1
2+
- Fix supporting of local paths in Connection Manager
3+
14
v21.7.0
25
- Add connection manager support to wait for a valid M3U file before starting the add-on instance
36
- The minimum refresh interval for the M3U should be 1 minutes and not zero, as that would be infinite refresh

src/iptvsimple/ConnectionManager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ void ConnectionManager::Process()
141141
}
142142

143143
const std::string url = m_settings->GetM3ULocation();
144+
int tcpTimeout = m_settings->GetConnectioncCheckTimeoutSecs();
145+
bool isLocalPath = m_settings->GetM3UPathType() == PathType::LOCAL_PATH;
144146

145147
/* URL is set */
146148
if (url.empty())
@@ -151,7 +153,7 @@ void ConnectionManager::Process()
151153
}
152154

153155
/* Connect */
154-
if ((firstRun || !m_onStartupOnly) && !WebUtils::Check(url, m_settings->GetConnectioncCheckTimeoutSecs()))
156+
if ((firstRun || !m_onStartupOnly) && !WebUtils::Check(url, tcpTimeout, isLocalPath))
155157
{
156158
/* Unable to connect */
157159
if (retryAttempt == 0)

src/iptvsimple/ConnectionManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ namespace iptvsimple
5050
PVR_CONNECTION_STATE m_state;
5151

5252
bool m_onStartupOnly = true;
53-
bool m_notifyStateChangeToUser = false;
5453

5554
std::shared_ptr<iptvsimple::InstanceSettings> m_settings;
5655
};

src/iptvsimple/utilities/WebUtils.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "WebUtils.h"
99

10+
#include "FileUtils.h"
1011
#include "Logger.h"
1112

1213
#include <cctype>
@@ -130,8 +131,13 @@ std::string WebUtils::RedactUrl(const std::string& url)
130131
return redactedUrl;
131132
}
132133

133-
bool WebUtils::Check(const std::string& strURL, int connectionTimeoutSecs)
134+
bool WebUtils::Check(const std::string& strURL, int connectionTimeoutSecs, bool isLocalPath)
134135
{
136+
// For local paths we only need to check existence of the file
137+
if (isLocalPath && FileUtils::FileExists(strURL))
138+
return true;
139+
140+
//Otherwise it's remote
135141
kodi::vfs::CFile fileHandle;
136142
if (!fileHandle.CURLCreate(strURL))
137143
{

src/iptvsimple/utilities/WebUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace iptvsimple
2727
static std::string ReadFileContentsStartOnly(const std::string& url, int* httpCode);
2828
static bool IsHttpUrl(const std::string& url);
2929
static std::string RedactUrl(const std::string& url);
30-
static bool Check(const std::string& url, int connectionTimeoutSecs);
30+
static bool Check(const std::string& url, int connectionTimeoutSecs, bool isLocalPath = false);
3131
};
3232
} // namespace utilities
3333
} // namespace iptvsimple

0 commit comments

Comments
 (0)