gordie
gordie

Reputation: 1955

Kodi addons : how can I cache / load datas?

I’m writing a video addon that loads datas from a web API.

My problem is that, each time I access an (already) visited virtual folder, it loads the data again, while it could be cached - and it makes my addon slow.

Is there some core function to cache then get cached datas for Kodi addons ?

Thanks

Upvotes: 0

Views: 353

Answers (2)

Roman Miroshnychenko
Roman Miroshnychenko

Reputation: 1564

There is no such "core" function, so you need to implement your own caching mechanism. An addon has its "profile" directory where it can store its own arbitrary files. A profile directory path can be obtained the following way:

  import xbmcaddon
  import xbmcvfs

  profile_dir = xbmcvfs.translatePath(xbmcaddon.Addon().getAddonInfo('profile'))

Upvotes: 0

Alex B
Alex B

Reputation: 70

I guess you can just store your request results in the Kodi data folder

Upvotes: 0

Related Questions