Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix supporting of local paths in Connection Manager #826

Merged
merged 3 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pvr.iptvsimple/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.iptvsimple"
version="21.7.0"
version="21.7.1"
name="IPTV Simple Client"
provider-name="nightik and Ross Nicholson">
<requires>@ADDON_DEPENDS@
Expand Down
3 changes: 3 additions & 0 deletions pvr.iptvsimple/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v21.7.1
- Fix supporting of local paths in Connection Manager

v21.7.0
- Add connection manager support to wait for a valid M3U file before starting the add-on instance
- The minimum refresh interval for the M3U should be 1 minutes and not zero, as that would be infinite refresh
Expand Down
4 changes: 3 additions & 1 deletion src/iptvsimple/ConnectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ void ConnectionManager::Process()
}

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

/* URL is set */
if (url.empty())
Expand All @@ -151,7 +153,7 @@ void ConnectionManager::Process()
}

/* Connect */
if ((firstRun || !m_onStartupOnly) && !WebUtils::Check(url, m_settings->GetConnectioncCheckTimeoutSecs()))
if ((firstRun || !m_onStartupOnly) && !WebUtils::Check(url, tcpTimeout, isLocalPath))
{
/* Unable to connect */
if (retryAttempt == 0)
Expand Down
1 change: 0 additions & 1 deletion src/iptvsimple/ConnectionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ namespace iptvsimple
PVR_CONNECTION_STATE m_state;

bool m_onStartupOnly = true;
bool m_notifyStateChangeToUser = false;

std::shared_ptr<iptvsimple::InstanceSettings> m_settings;
};
Expand Down
8 changes: 7 additions & 1 deletion src/iptvsimple/utilities/WebUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "WebUtils.h"

#include "FileUtils.h"
#include "Logger.h"

#include <cctype>
Expand Down Expand Up @@ -130,8 +131,13 @@ std::string WebUtils::RedactUrl(const std::string& url)
return redactedUrl;
}

bool WebUtils::Check(const std::string& strURL, int connectionTimeoutSecs)
bool WebUtils::Check(const std::string& strURL, int connectionTimeoutSecs, bool isLocalPath)
{
// For local paths we only need to check existence of the file
if (isLocalPath && FileUtils::FileExists(strURL))
return true;

//Otherwise it's remote
kodi::vfs::CFile fileHandle;
if (!fileHandle.CURLCreate(strURL))
{
Expand Down
2 changes: 1 addition & 1 deletion src/iptvsimple/utilities/WebUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace iptvsimple
static std::string ReadFileContentsStartOnly(const std::string& url, int* httpCode);
static bool IsHttpUrl(const std::string& url);
static std::string RedactUrl(const std::string& url);
static bool Check(const std::string& url, int connectionTimeoutSecs);
static bool Check(const std::string& url, int connectionTimeoutSecs, bool isLocalPath = false);
};
} // namespace utilities
} // namespace iptvsimple
Loading