2019-03-20, 21:07
Hello,
I am working on a random trailers addon which can be invoked as either a screensaver or script. I seeking some suggestions for how to overcome several issues:
There is a lot of backend overhead discovering all of the trailers for movies in the library + TMDB + iTunes, as well running ffmpeg on trailers to normalize their volumes. I certainly don't want to restart this every time the script exits and I also want to share this with the screensaver. I have recently added caches that will speed things up quite a bit, but I still want to avoid all of the initial discovery, especially when the caches are cleared.
The backend, once invoked, runs until Kodi exits. The interface between front-end and back-end is basically: getNextMovieInfoToPlay.
The only difference between the script and screensaver is that they differ in a tiny bit of startup code. The docs seem to encourage shipping as separate addons. I can see where this makes it more clear to the end-user what they have enabled. It also provides the option to have separate settings (currently they are shared). I assume that if they are separate addons that the screensaver will import the script addon which will contain all of the UI and do the real work.
There is quite a bit of code in both the backend and frontend, with the back-end the largest.
Any guidance is most welcome.
Frank
I am working on a random trailers addon which can be invoked as either a screensaver or script. I seeking some suggestions for how to overcome several issues:
- Each time the addon is launched, a new instance is created. I would much rather reuse an existing instance. As a minimum, the back-end needs to be reused since it is expensive to start.
- Should the addon be split into multiple addons: script, screensaver and backend?
There is a lot of backend overhead discovering all of the trailers for movies in the library + TMDB + iTunes, as well running ffmpeg on trailers to normalize their volumes. I certainly don't want to restart this every time the script exits and I also want to share this with the screensaver. I have recently added caches that will speed things up quite a bit, but I still want to avoid all of the initial discovery, especially when the caches are cleared.
The backend, once invoked, runs until Kodi exits. The interface between front-end and back-end is basically: getNextMovieInfoToPlay.
The only difference between the script and screensaver is that they differ in a tiny bit of startup code. The docs seem to encourage shipping as separate addons. I can see where this makes it more clear to the end-user what they have enabled. It also provides the option to have separate settings (currently they are shared). I assume that if they are separate addons that the screensaver will import the script addon which will contain all of the UI and do the real work.
There is quite a bit of code in both the backend and frontend, with the back-end the largest.
Any guidance is most welcome.
Frank