Hi,
I’m busy creating an extension for the RadioBrowser service (http://radio-browser.info), a radio stream directory. The API docs can be found at https://nl1.api.radio-browser.info/.
I have something working for now: I implemented browse and lookup inside a LibraryProvider subclass.
In the browse method I request lists of stations through the RadioBrowser API containing the name and uuid of the station. I then return models.Ref.Track instances with the name of the station and the uri containing the uuid.
To implement the lookup I have to create models.Track instances from the uri alone so I don’t have access to the name of the track (in this case the station name). Using the RadioBrowser API I can only lookup a single station entry by uuid per request which could mean a lot of needless requests as I already retrieved that information in the browse method.
So far I came up with two possible solutions:
- Just add the name as part of the
uriinbrowseand extract that inlookup. This is what I currently use and works fine. It just feels very ugly adding additional metadata to theuri. It would also mean that a change in station name would invalidate theuri. - Add some caching mechanism mapping station uuid to metadata. This can then be filled from
browseand used inlookup. Apart from the extra memory required (lists of stations can be long) how much entries would I need to keep? Especially if there are multiple clients connecting to the mopidy instance.
Any ideas what would be the most appropriate solution? Any additional ideas?
Thanks