Skip to content

Commit

Permalink
Support async connect
Browse files Browse the repository at this point in the history
  • Loading branch information
phunkyfish committed Mar 20, 2023
1 parent 6cef720 commit 34a0b83
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/IptvSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ bool IptvSimple::Initialise()
{
std::lock_guard<std::mutex> lock(m_mutex);

ConnectionStateChange("", PVR_CONNECTION_STATE_CONNECTING, "");

m_channels.Init();
m_channelGroups.Init();
m_providers.Init();
Expand All @@ -43,6 +45,11 @@ bool IptvSimple::Initialise()
{
m_channels.ChannelsLoadFailed();
m_channelGroups.ChannelGroupsLoadFailed();
ConnectionStateChange("", PVR_CONNECTION_STATE_DISCONNECTED, "");
}
else
{
ConnectionStateChange("", PVR_CONNECTION_STATE_CONNECTED, "");
}
m_epg.Init(EpgMaxPastDays(), EpgMaxFutureDays());

Expand Down Expand Up @@ -116,7 +123,8 @@ void IptvSimple::Process()
std::this_thread::sleep_for(std::chrono::milliseconds(1000));

m_settings->ReloadAddonInstanceSettings();
m_playlistLoader.ReloadPlayList();
if (m_playlistLoader.ReloadPlayList())
ConnectionStateChange("", PVR_CONNECTION_STATE_CONNECTED, "");
m_epg.ReloadEPG(); // Reloading EPG also updates media

m_reloadChannelsGroupsAndEPG = false;
Expand Down
6 changes: 5 additions & 1 deletion src/iptvsimple/PlaylistLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ void PlaylistLoader::ParseSinglePropertyIntoChannel(const std::string& line, Cha
}
}

void PlaylistLoader::ReloadPlayList()
bool PlaylistLoader::ReloadPlayList()
{
m_m3uLocation = m_settings->GetM3ULocation();

Expand All @@ -532,11 +532,15 @@ void PlaylistLoader::ReloadPlayList()
m_client->TriggerChannelGroupsUpdate();
m_client->TriggerProvidersUpdate();
m_client->TriggerRecordingUpdate();

return true;
}
else
{
m_channels.ChannelsLoadFailed();
m_channelGroups.ChannelGroupsLoadFailed();

return false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/iptvsimple/PlaylistLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace iptvsimple
bool Init();

bool LoadPlayList();
void ReloadPlayList();
bool ReloadPlayList();

private:
static std::string ReadMarkerValue(const std::string& line, const std::string& markerName);
Expand Down

0 comments on commit 34a0b83

Please sign in to comment.