How to aproach lazy loading results?

Why I am trying to do this
I am fascinated by the potential of mopidy but the backend plugins for sources that I am interested in are buggy as best

I am implementing a few backends but i’ve started with new YouTube music API.

If I search for albums YouTube music only returns titles and IDs and I have to make an additional request for each library to get details (e.g. Tracks).

But most of the time details won’t be loaded because usually, front ends don’t display full album details on the search page.

My plan
Create a lazy loaded object that fetches the data when it’s accessed.
It will find an instance of the library back end that was created and a call method that resolves missing fields.

Potential problems

  1. There might be issue with the front ends if they cache results and do not request again when on the album page

  2. Back-end calls are typed checks so I’ll have to fool the back end somehow maybe inherent from the original class or patch some type-checking functions

  3. I don’t know how to access an instance of the running mopidy so I can find the instance of the library that created that lazy objects

If you have any solutions to my problems or suggestions/ideas please respond:slight_smile: