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

Refresh..... #82

Open
Cisse-Moes opened this issue Mar 26, 2021 · 19 comments
Open

Refresh..... #82

Cisse-Moes opened this issue Mar 26, 2021 · 19 comments
Labels
enhancement New feature or request

Comments

@Cisse-Moes
Copy link

Hello kodi lovers!
I have libreelec running on a mini ashrock. Works fine . Only if I close it and I start again the same day, then the iptv manager does its thing and I get all channels listed as well as the timeline. But when I start the next day everything stays blank. And do I have to refresh manually in the app.
I suspect that if this boot, the channels will not be refreshed, but as far as I can see I cannot set this anywhere. Or is there another solution?
greetings Cisse

@frankdpGH
Copy link

Hi @Cisse-Moes , I have similar issues.
In my opinion the problem is that during update in iptvsimple.py errors can happen (other addons not responding) that are causing an uncomplete or empty epg.xml / playlist.m3u8. In case of error the writing of new files should be prevented. Once this problem is solved a more frequent update is possible as now you have to wait one hour to get a valid stream in your epg.

@dagwieers
Copy link
Contributor

@frankdpGH If an add-on fails to return data, it is excluded, but it should not cause an incomplete or empty EPG. If this is the case, it is a bug. I have not seen this myself (and we have seen our fair share of failing add-ons during development).

One improvement is to fall back to cached information when an add-on fails, but that has other implications (more memory use, or more disk activity). Disk activity wears out SD cards.

In any case, this is a corner case and a failing add-on always shows a notification during update. It is probably more effective to ensure add-ons work reliably.

@frankdpGH
Copy link

Thanks @dagwieers for the quick response. The main cause of errors is that my Android TV Box goes in standby and Kodi remains running. This causes wrong behavior. I have blocked the error by comparing filesize before renaming in iptvsimple.py. I believe that writing an empty epg as mentioned above should not happen. I'm also pushing more frequent updates (every 10 Mins instead of 1 hour) to have up to date epg links, maybe this is pushing the error too.

@frankdpGH
Copy link

Some Log material as example of partial disappearing of channels.
See Kodi.Log at 18:21 Refresch started after resuming from standby. Different error messages popping up from addons VRT Radio, Go Play, VTM Go. After refresh all VTM channels have disappeared.
At 18:44 new manual refresh : all restored.
So in the first refresh I would prefer that epg.xml and playlist.m3u8 is not updated in case of error.
IPTV_Manager_Refresh_error.zip

@michaelarnauts
Copy link
Contributor

I haven't looked at the log, but I assume that when there is no network connection (yet) after returning from standby, you'll probably get this behaviour.

@dagwieers
Copy link
Contributor

Maybe there is a way for IPTV Manager to check if there is network connectivity.

But yes, if all add-ons fail for this reason, you may end up with nothing. If there is nothing, maybe IPTV should not be writiing to disk.

And at least the channel listing could be cached in memory for when an add-on fails to work.

@daufinsyd
Copy link

Hi :)
Is there any news ?
I don't know why but it happens almost each day and I have to manually refresh the list (plus I only have less than 20 Channels but it takes like 5 Minutes to complete).

@dagwieers
Copy link
Contributor

@daufinsyd Since you can easily reproduce this, it could help if you looked at the code to find the actual cause, or a quick fix for this. Python code is quite easy to read/modify and the logic is not that hard.

@daufinsyd
Copy link

Hi @dagwieers
I'm no python dev but since get_epg() seems to return an empty dict if there is no data (or invalid data), one could simply check that before epg.append(addon.get_epg()).

epg_data = addon.get_epg()
if epg_data:
  epg.append(addon.get_epg())
else:
  # append the current configuration for the channel

get_channels() seems to be analog but with array.

@michaelarnauts
Copy link
Contributor

I took a look at your logfile, but it's not really clear what causes this issue. IPTV Manager is supposed to open a port on 127.0.0.1, and asks the Addon to send data to that port, but somehow, the add-on gets a Connection refused error, and IPTV Manager gets a timeout, as if there is a firewall or something on the device blocking the requests?

Are you using a special setup for a VPN or something that changes the network settings?

@thedude4ever
Copy link

thedude4ever commented May 5, 2021

Hi,

Same issue for me on Kodi 18 (raspberry 4). Need to refresh channels manually, it often solve the pb. But sometimes a kodi restart is needed.
I've tried to setup librelec to wait for network connection before launching Kodi but it didn't solve the issue.

@sy6sy2
Copy link

sy6sy2 commented May 17, 2021

Hi @popiggy, do you also have the ConnectionRefusedError error in your log?

We also have the same issue for users of Catch-up TV & More (Catch-up-TV-and-More/plugin.video.catchuptvandmore#507 (comment))

@thedude4ever
Copy link

Hi @sy6sy2
Don't see any connection refused error, only these ones:

ERROR: [service.iptv.manager] [resources.lib.modules.addon] Something went wrong while calling plugin.video.catchuptvandmore: [Errno -5] No address associated with hostname

ERROR: AddOnLog: PVR IPTV Simple Client: Unable to load channels from file '/storage/.kodi/userdata/addon_data/service.iptv.manager/playlist.m3u8': file is corrupted

@sy6sy2
Copy link

sy6sy2 commented May 17, 2021

@michaelarnauts, another user of CUTV&M also have this ConnectionRefusedError error with an Android TV device (see log here Catch-up-TV-and-More/plugin.video.catchuptvandmore#507 (comment)).

@sy6sy2
Copy link

sy6sy2 commented May 17, 2021

Me again.

If you look at the log given here #82 (comment) you can see that:

  • At 18:21:06.139 IPTVManager open a socket on 45699 and call plugin://plugin.audio.vrt.radio/iptv/channels.
  • At 18:21:17.412 IPTVManager trigger a timeout because 10 seconds have elapsed.
  • At 18:21:20.481 VRT get a ConnectionRefusedError. No surprise here, because at 18:21:17.412 IPTVManager closed the socket on which VRT try to connect.

So, the hypothesis is that just after Kodi starts on Android, Kodi doesn't have an internet connection during the first seconds. So, the video plugins are not able to send channels/epg to IPTVManager and they get a timeout.

Maybe two solutions to try:

  • Delayed the first IPTVManager refresh process
  • If IPTVManager get a timeout for one plugin, keep the previous channels and TV guide.

(Thank you @Psychoses for the help)

@Psychoses
Copy link

Psychoses commented May 17, 2021

Maybe increase this one ? (like a temp fix for hurry people)
i have set the timeout to None and all seems fix

def _wait_for_data(self, sock, timeout=10):

sock.settimeout(timeout)

@Psychoses
Copy link

Psychoses commented May 22, 2021

I noted different timing on kodi startup case. I have analyse this sequence on many device :

Waiting for a connection part 1 (m3u)
[Catch-up-TV-&-More.support] Route Execution Time part 1
Closing socket

Waiting for a connection part 2 (epg)
[Catch-up-TV-&-More.support] Route Execution Time part 2
Closing socket

The total time of the full process is between 8s and 5min.

Summary

faster => slower

Device
AMD Ryzen 7 3700X / Xiaomi Redmi Note 4 / Xiaomi MIBOX3 / TCL BeyondTV2

Waiting for a connection part 1 (m3u) => Connected to 127.0.0.1
2s / 21s / 56s / 1min6

[Catch-up-TV-&-More.support] Route Execution Time part 1
166ms / 4s / 4s / 3s

Waiting for a connection part 2 (epg) => Connected to 127.0.0.1
2s / 17s / 40s / 1min4

[Catch-up-TV-&-More.support] Route Execution Time part 2
4s / 22s / 55s / 2min45

Total
8s / 1min10 / 2min30 / 5min

detailed report.txt

@frankdpGH
Copy link

Maybe increase this one ? (like a temp fix for hurry people)
i have set the timeout to None and all seems fix

def _wait_for_data(self, sock, timeout=10):

sock.settimeout(timeout)

Hi @Psychoses : thanks for this hint. Indeed with "timeout = None" all error messages are gone and the xml files are complete. 10 secs is too low, maybe a settings.xml possibility? Indeed the update routine will take will take a few seconds more, but it is not annoying and there are no more errors in the log.

@Psychoses
Copy link

@frankdpGH No prob. Thx you for your log @ #82 (comment), This help us a lot to locate the problem.

I don't know what is the best soluce here, i'm not the main dev and not a expert.

I think, for end user like us, we can just use none here until @dagwieers or @michaelarnauts take the right decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants