apognu / otter

Music player for Funkwhale
MIT License
215 stars 21 forks source link

Display if whole album is offline available #57

Open georgkrause opened 4 years ago

georgkrause commented 4 years ago

Currently the display if a track is offline available is only available for tracks but not for an album. It would be cool if there would be an "offline available" sign for each album.

apognu commented 4 years ago

I'll look into it, but I'm afraid this Funkwhale PR removing the track list from the /albums/ endpoint might complicate things.

Before this, we might have looped over each track in each album and mark those appropriately. If the track list is not returned with the albums, we're looking at one additional HTTP request per album, before we're even able to process the data.

I'll spend some time considering our option here.

MightyCreak commented 4 years ago

@georgkrause I think there's a typo in the subject: "hole" -> "whole"

apognu commented 4 years ago

I am currently experimenting with a very large rewrite of Otter, using more "modern" and flexible techniques for fetching, storing and displaying data.

In a nutshell, all data coming from Funkwhale would be inserted in a local database, which can then be queried to be displayed and used by the app. This has several advantages, including for this issue (right now, I can't locally ask for "all tracks contained in an album", which this would need).

I'll put that on hold until I have a clearer view of where Otter's codebase is going.

MightyCreak commented 4 years ago

Caching data also comes with its issues. You'll need to ensure the local db is synchronized with the remote db, which is clearly doable by checking the modify dates. But maybe consider doing the "bruteforce" approach first? Get all the tracks of an album and verify which one is already downloaded and which one isn't. If at least one is not downloaded, don't show the badge. With everything done asynchronously, the only effect on the user is that the badge will show a few milliseconds after the page is displayed.

What do you think?

apognu commented 4 years ago

I'm really considering the performance issues here. This is an action to be performed for each album shown on screen. Which means at least one separate network request by album, each, in my experience, taking a lot longer than a few milliseconds.

Of course it is possible, but I have to be careful not to incur too much load on the mobile device or the Funkwhale instance. After all, there might be a good reason Funkwhale removed the track list from the album request.

It is something I'll try, anyway, but I'm not convinced.