Skip to content

Commit

Permalink
Merge pull request #947 from phunkyfish/epg-debug-logging
Browse files Browse the repository at this point in the history
Add debug logging for EPG loads
  • Loading branch information
phunkyfish authored Feb 9, 2025
2 parents bb513d7 + 02cdf97 commit f45ef38
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
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.10.1"
version="21.10.2"
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.10.2
- Add debug logging for EPG loads

v21.10.1
- Translations updates from Weblate
- af_za, am_et, ar_sa, ast_es, az_az, be_by, bg_bg, bs_ba, ca_es, cs_cz, cy_gb, da_dk, de_de, el_gr, en_au, en_nz, en_us, eo, es_ar, es_es, es_mx, et_ee, eu_es, fa_af, fa_ir, fi_fi, fo_fo, fr_ca, fr_fr, gl_es, he_il, hi_in, hr_hr, hu_hu, hy_am, id_id, is_is, it_it, ja_jp, ko_kr, lt_lt, lv_lv, mi, mk_mk, ml_in, mn_mn, ms_my, mt_mt, my_mm, nb_no, nl_nl, pl_pl, pt_br, pt_pt, ro_ro, ru_ru, si_lk, sk_sk, sl_si, sq_al, sr_rs, sr_rs@latin, sv_se, szl, ta_in, te_in, tg_tj, th_th, tr_tr, uk_ua, uz_uz, vi_vn, zh_cn, zh_tw
Expand Down
8 changes: 8 additions & 0 deletions src/IptvSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,25 @@ void IptvSimple::Process()

if (m_settings->GetM3URefreshMode() == RefreshMode::REPEATED_REFRESH &&
refreshTimer >= (m_settings->GetM3URefreshIntervalMins() * 60))
{
Logger::Log(LEVEL_DEBUG, "%s - Refreshing Channels, Grous and EPG at minute interval: %d", __func__, m_settings->GetM3URefreshIntervalMins());
m_reloadChannelsGroupsAndEPG = true;
}

if (m_settings->GetM3URefreshMode() == RefreshMode::ONCE_PER_DAY &&
lastRefreshHour != timeInfo.tm_hour && timeInfo.tm_hour == m_settings->GetM3URefreshHour())
{
Logger::Log(LEVEL_DEBUG, "%s - Refreshing Channels, Grous and EPG at hour of day: %d", __func__, m_settings->GetM3URefreshHour());
m_reloadChannelsGroupsAndEPG = true;
}

std::lock_guard<std::mutex> lock(m_mutex);
if (m_running && m_reloadChannelsGroupsAndEPG)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1000));

Logger::Log(LEVEL_DEBUG, "%s - Reloading Channels, Groups and EPG", __func__);

m_settings->ReloadAddonInstanceSettings();
m_playlistLoader.ReloadPlayList();
m_epg.ReloadEPG(); // Reloading EPG also updates media
Expand Down
7 changes: 7 additions & 0 deletions src/iptvsimple/Epg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ bool Epg::Init(int epgMaxPastDays, int epgMaxFutureDays)

if (m_settings->IsCatchupEnabled() || m_settings->IsMediaEnabled())
{
Logger::Log(LEVEL_DEBUG, "%s - LoadEPG on Init, catchup or media", __FUNCTION__);
// Kodi may not load the data on each startup so we need to make sure it's loaded whether
// or not kodi considers it necessary when either 1) we need the EPG logos or 2) for
// catchup we need a local store of the EPG data
Expand Down Expand Up @@ -374,8 +375,10 @@ void Epg::ReloadEPG()

Clear();

Logger::Log(LEVEL_DEBUG, "%s - Reload EPG", __FUNCTION__);
if (LoadEPG(m_lastStart, m_lastEnd))
{
Logger::Log(LEVEL_DEBUG, "%s - Reloaded EPG", __FUNCTION__);
MergeEpgDataIntoMedia();

for (const auto& myChannel : m_channels.GetChannelsList())
Expand All @@ -392,11 +395,15 @@ PVR_ERROR Epg::GetEPGForChannel(int channelUid, time_t epgWindowStart, time_t ep
if (myChannel.GetUniqueId() != channelUid)
continue;

Logger::Log(LEVEL_DEBUG, "%s - Getting EPG for Channel: %s", __FUNCTION__, myChannel.GetChannelName().c_str());

if (epgWindowStart > m_lastStart || epgWindowEnd > m_lastEnd)
{
Logger::Log(LEVEL_DEBUG, "%s - Attempting load of EPG for Channel: %s", __FUNCTION__, myChannel.GetChannelName().c_str());
// reload EPG for new time interval only
LoadEPG(epgWindowStart, epgWindowEnd);
{
Logger::Log(LEVEL_DEBUG, "%s - Loaded EPG for Channel: %s", __FUNCTION__, myChannel.GetChannelName().c_str());
MergeEpgDataIntoMedia();

// doesn't matter is epg loaded or not we shouldn't try to load it for same interval
Expand Down

0 comments on commit f45ef38

Please sign in to comment.