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

Kodi only checks for add-on updates every 24 hours #764

Open
dagwieers opened this issue May 27, 2020 · 18 comments · Fixed by #767 or #769
Open

Kodi only checks for add-on updates every 24 hours #764

dagwieers opened this issue May 27, 2020 · 18 comments · Fixed by #767 or #769
Labels
enhancement New feature or request kodi Related to the Kodi media player reported This issue has been reported to upstream project

Comments

@dagwieers
Copy link
Collaborator

dagwieers commented May 27, 2020

Describe the feature

In a VOD-centric world, Kodi add-ons are living by the grace of the VOD content provider and the stability of the VOD infrastructure. Unfortunately, since Kodi add-ons are not first-class citizens, they are not prepared or made aware of coming changes to the VOD infrastructure.

This means that "suddenly" the Kodi add-on stops working when the VOD infrastructure undergoes changes that the Kodi add-on was not prepared for. This immediately impacts users. And no matter how fast add-on developers react, or how well they are improving their processes, this will always be reactive.

Many add-ons pro-actively test their add-ons at full length and are made aware of such issues as soon as they arise, and a fix is out as fast as possible. We still need to wait until the add-on is being accepted and merged in the Kodi repository, And additionally it takes up to 24 hours to get these add-ons installed on end-user systems.

24 hours mean that daily users are always affected, which is a real problem for Kodi as a reliable platform.

  • Mean time to detection (MTTD) is now close to 0
  • Mean time to acknowledge (MTTA) depends on add-on development team, could be within hours
  • Mean time to recovery (MTTR) is a problem
    • Fixing depends on add-on development team
    • Getting it merged into Kodi repository depends on Team Kodi
    • Getting it on user systems depends on this 24h check in Kodi

We would like to see this 24 hour check in Kodi to be reduced to 4 or 6 hours so that fixes can be delivered before they impact end-users.

In most cases being able to get the fix on end-users systems by 18:00 would avoid impacting the majority of users.

@dagwieers dagwieers added enhancement New feature or request kodi Related to the Kodi media player labels May 27, 2020
@dagwieers
Copy link
Collaborator Author

dagwieers commented May 27, 2020

For international add-ons

(Think: Netflix, HBO GO or Disney+)
With a 24h repository update frequency, it takes 24 hours to get a fix to all end-users. Since primetime moves from timezone to timezone, getting a fix out more quickly is paramount. If we miss European primetime due to unavailability of Add-on developers, we could still save US primetime, but not if the frequency is 24 hours.

For regional add-ons

(Think: European broadcasting)
If we would like to get a fix deployed to all our users before primetime (18:00?), you have to get a newly released add-on pushed and merged in the Kodi repository by 12:00 if the update frequency is 6h. Which is highly unlikely IMO.

In the incidents we have experienced, new VOD infra releases happened in the morning (we have seen them at 06:00 as well as at 09:00), that gives about 3 to 5 hours to get a fix and push it out to users. We have been in this situation and we have been able to fix, but not able to push to users because of the 24h frequency.

So a repository update frequency of 4h makes more sense overall IMO.

@dagwieers dagwieers changed the title Kodi only checks for updates every 24 hours Kodi only checks for add-on updates every 24 hours May 27, 2020
@dagwieers
Copy link
Collaborator Author

I opened xbmc/xbmc#17955 for this upstream.

@dagwieers dagwieers added the fixed An upstream fix is available but not yet released label May 27, 2020
@dagwieers
Copy link
Collaborator Author

So @matthuisman has an interesting suggestion at: xbmc/xbmc#17955 (comment)

We could offer an easier path for users to update the add-on from the add-on settings. We could put this under the Expert category at the top, or a separate "Update" category. Even if we can increase the frequency of the Kodi add-ons repository, having the ability to update the repositories manually is a useful addition in any case.

This is not an alternative to increasing the frequency, we still need this for a better user experience.

@dagwieers
Copy link
Collaborator Author

dagwieers commented May 27, 2020

So I tested this:

  • UpdateAddonRepos only works if the add-on has Auto-update enabled
  • InstallAddon(plugin.video.vrt.nu) does not seem to work if the add-on is already installed
  • I don't see how we can check if an add-on has Auto-update disabled
  • I don't see how we can ensure that an add-on has Auto-update enabled

So only running UpdateAddonRepos is a possibility at this time.

Update: The upcoming VRT NU add-on will include an option in the settings to update your repositories and add-ons.

@matthuisman
Copy link

matthuisman commented May 29, 2020

I found UpdateAddonRepos does fetch available updates even with Auto updates disabled.

However, yes - it won't make the add-ons actually update.
If they have disabled auto updates - then probably best not to update it automatically anyway?
But at least kodi will know of the update quicker.

Your right - InstallAddon won't update an add-on.
A work around would be to remove the addon first.
It's pretty hacky though.

pseudo code

xbmc.executebuiltin('UpdateAddonRepos')
for addon in to_update:
     shutil.rmdir(addon.dir) #or rename
xbmc.executebuiltin('UpdateLocalAddons')
for addon in to_update:
    xbmc.executebuiltin('InstallAddon(addon.id )', True)
    Addons.SetAddonEnabled(addon.id)

I just tested and kodi doesn't wait for UpdateAddonRepos to complete...
Which makes it ever trickier and above won't even work.

You should be able to detect if auto updates are enabled with the JSON RPC call

{'method': 'Settings.GetSettingValue', 'params': {'setting': 'general.addonupdates'}}
0 = Install automatically
1= Notify but dont install
2 = Never check

You can probably even change it with
{'method': 'Settings.SetSettingValue', 'params': {'setting': 'general.addonupdates', 'value': 0}}

@dagwieers
Copy link
Collaborator Author

@matthuisman I am not interested in adding this as a workaround. But my main concern was that the add-on may have Auto update disabled. Which we cannot detect and we cannot change.

@matthuisman

This comment has been minimized.

@dagwieers

This comment has been minimized.

@matthuisman

This comment has been minimized.

@matthuisman

This comment has been minimized.

@dagwieers

This comment has been minimized.

@matthuisman
Copy link

matthuisman commented May 29, 2020

oh, I see in the add-on info menu.
I've gone through that menu so much and never took notice of the auto-update toggle. (Haha)

Even kodi updating repos more often won't help if they have updates disabled.
So what are you thinking to fix that?

@dagwieers
Copy link
Collaborator Author

dagwieers commented May 29, 2020

It's a marginal problem, the majority of users do not have this disabled. I would even say, someone that has this disabled is a technical user. And if they do, they live with the consequences, at least they can tell they do not run the latest version. My concern is mostly stated at the description of this bug.

  1. Infrastructure change breaks add-on
  2. We know this has happened (within 30 minutes)
  3. We fix it as fast as we can (within hours)
  4. Our fix is sitting idle in the Kodi repository (for days) ← we could offer our own repository
  5. Our fix needs 24 hours to be installed for all users ← this is our main concern

This has happened to us now a dozen times. Not just with this add-on, with various add-ons and even with inputstreamhelper (affecting almost every Kodi user at once). If a fix takes 24 hours to get distributed, (and we are not able to fix it before primetime) it means every single daily user is impacted. This is a very disruptive event.

If Kodi is not able to offer a reliable viewing experience, people will not rely on it and will not recommend it to others. I have a hard time recommending Kodi to anyone non-technical because it may fail at any given time and may require manual intervention to get something fixed timely. (Even though we do our best to fix issues within hours, we cannot get it to users)

BTW for an add-on that is used internationally this dynamic is different, there is no single primetime. So a solution for Netflix, HBO GO, Disney+ is even more important, both in scope and impact.

@Cpainy
Copy link

Cpainy commented May 29, 2020

I'm using kodi for my daily TV viewing via addons. Don't have cable any more. Downtime is annoying. I really support any development to decrease downtime!

@dagwieers
Copy link
Collaborator Author

dagwieers commented May 29, 2020

@mediaminister mentioned on Slack that we could monitor the VRT NU app on the Google Play Store and Apple App Store to get an advance warning of (potential) upcoming infrastructure changes. It may not help us fix proactively, but could help to plan fixing reactively.

Especially the Apple Store app history link is useful to look at what has changed. The changelog actually hints which updates are backend related !!

This would require a GitHub CI workflow to detect and report changes.

@mediaminister
Copy link
Collaborator

mediaminister commented May 29, 2020

I already have some code for Google Play:

# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, print_function, unicode_literals
import re
import json
from datetime import datetime

try:  # Python 3
    from urllib.request import urlopen, Request
except ImportError:  # Python 2
    from urllib2 import urlopen, Request

url = "https://play.google.com/store/apps/details?id=be.vrt.vrtnu"
req = Request(url)
response = urlopen(req)
regex = re.compile(r'AF_initDataCallback\(([\s\S]*?)\);<\/')
match = re.findall(regex, response.read().decode('utf-8'))
key = re.compile(r"key: 'ds:(.*?)',")
value = re.compile(r'return ([\s\S]*?)}}')
info =  next((json.loads(re.search(value, prop).group(1)) for prop in match if re.search(key, prop).group(1) == '8'), None)
print(info[1])
info =  next((json.loads(re.search(value, prop).group(1)) for prop in match if re.search(key, prop).group(1) == '5'), None)
print(info[0][12][6][1])
published = info[0][12][8][0]
print(published)
print(datetime.fromtimestamp(published).isoformat())

@dagwieers dagwieers linked a pull request May 29, 2020 that will close this issue
@dagwieers
Copy link
Collaborator Author

@mediaminister Perfect, I think one of them is sufficient.

@dagwieers dagwieers reopened this May 29, 2020
@dagwieers dagwieers linked a pull request May 30, 2020 that will close this issue
@dagwieers dagwieers added reported This issue has been reported to upstream project and removed fixed An upstream fix is available but not yet released labels Jul 20, 2020
@dagwieers
Copy link
Collaborator Author

Kodi has added a new feature upstream that allows to control the update interval from the server as was suggested: xbmc/xbmc@4396fdc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kodi Related to the Kodi media player reported This issue has been reported to upstream project
Projects
None yet
4 participants