Favorites management API changes#127
Conversation
…gement Signed-off-by: darrell-k <darrell@darrell.org.uk>
Signed-off-by: darrell-k <darrell@darrell.org.uk>
|
Running with the changes now. Do you anticipate this having any affect on the OMLI import process? I haven't looked at the code yet but could imagine a possible conflict. |
|
There shouldn't be any effect on OMLI, but worth checking. |
| $self->getUserFavorites(sub{}, 'refresh'); | ||
| $self->getUserFavoriteIds(sub{}, 'refresh'); | ||
| $self->getUserFavoriteStatus(sub{}, { type => 'album', item_id => $args->{album_ids} }, 'refresh') if $args->{album_ids}; | ||
| $self->getUserFavoriteStatus(sub{}, { type => 'artist', item_id => $args->{artist_ids} }, 'refresh') if $args->{artist_ids}; | ||
| $self->getUserFavoriteStatus(sub{}, { type => 'track', item_id => $args->{track_ids} }, 'refresh') if $args->{track_ids}; |
There was a problem hiding this comment.
This is doing more work than before. Is it worth it? Wouldn't the first call have all the information the subsequent two would get us?
There was a problem hiding this comment.
We're just clearing caches here, after an add or delete favourite. Maybe we should do it within the add/delete api routines. At least we would know which of the 3 types to clear in the case of the status cache.
There was a problem hiding this comment.
This is not only wiping caches, you're doing calls to eg. favorite/status, too, right?
There was a problem hiding this comment.
Yes, sorry I meant wipe/recreate cache. We could delay the recreation of the cache entry until it is requested again, so just do the clear at that stage.
Replace favorite/getUserFavorites with favorite/getUserFavoriteIds or favorite/status when retrieving the status of favorites. It's a lot less data.
In
QobuzGetTracksandQobuzArtistuse favorite/status to return a simple boolean.In
QobuzManageFavoritesuse favorite/getUserFavoriteIds because although it's more data to return than favorite/status, it avoids having to call the status API 3 times (for albums, tracks and artists).The new API results are cached for 60 seconds, like favorite/getUserFavorites, so extend the cache management in
createFavoriteanddeleteFavorite.Please give this a good going over.