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

Add debug logging for EPG loads - Piers #948

Open
wants to merge 2 commits into
base: Piers
Choose a base branch
from
Open
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="22.4.2"
version="22.4.3"
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 @@
v22.4.3
- Add debug logging for EPG loads

v22.4.2
- 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