add-ons / service.iptv.manager

Integrate TV and radio channels with EPG data from other add-ons in Kodi PVR.
https://github.com/add-ons/service.iptv.manager/wiki
GNU General Public License v3.0
95 stars 28 forks source link

Refresh..... #82

Open Cisse-Moes opened 3 years ago

Cisse-Moes commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 (https://github.com/Catch-up-TV-and-More/plugin.video.catchuptvandmore/issues/507#issuecomment-841965435)

thedude4ever commented 3 years ago

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 commented 3 years ago

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

sy6sy2 commented 3 years ago

Me again.

If you look at the log given here https://github.com/add-ons/service.iptv.manager/issues/82#issuecomment-808775468 you can see that:

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:

(Thank you @Psychoses for the help)

Psychoses commented 3 years ago

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

https://github.com/add-ons/service.iptv.manager/blob/513e25d8ce564299628d5f84661c28a472b2709c/resources/lib/modules/addon.py#L254

https://github.com/add-ons/service.iptv.manager/blob/513e25d8ce564299628d5f84661c28a472b2709c/resources/lib/modules/addon.py#L258

Psychoses commented 3 years ago

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 commented 3 years ago

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

https://github.com/add-ons/service.iptv.manager/blob/513e25d8ce564299628d5f84661c28a472b2709c/resources/lib/modules/addon.py#L254

https://github.com/add-ons/service.iptv.manager/blob/513e25d8ce564299628d5f84661c28a472b2709c/resources/lib/modules/addon.py#L258

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 commented 3 years ago

@frankdpGH No prob. Thx you for your log @ https://github.com/add-ons/service.iptv.manager/issues/82#issuecomment-808775468, 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.