apognu / otter

Music player for Funkwhale

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Local database and live data

apognu opened this issue · comments

I've been working on a major rewrite of Otter, mainly around data retrieval, storage and querying. In a nutshell, all data retrieved from Funkwhale would get written to a local database, which would get queried to be displayed within the app.

This has several advantages, such as allow for more performant pagination, complex queries ("have all tracks within this albums been downloaded?") or for immediate update of state across the app (changing favorite status would be instantly reflected in the queue, the now playing view and the favorites listing), on top of being easier to maintain.

This work is being tracked in dev/livedata and is not yet usable.

This will be a very long-term development endeavor, and I did encounter a blocking issue: to be usable, the order in which Funkwhale returns items (for instance, sorted by name) must be exactly replicable from Otter's local database, in order to prevent items "jumping" in the UI. This is problematic as, as far as I know, Android's database implementations that I tried (sqlite, Room and Realm) do not support localized Unicode sorting, which Funkwhale uses. This is a problem inherent to Android, and there does not seem like there's anything I can do but wait (or have Funkwhale change its sorting algorithm, which would not be okay with me).

This issue is just a placeholder until a solution is found.

If anyone around here is an actual Android developer or knows someone who has some experience dealing with Room and Unicode sorting, I'd be glad to discuss with them.

Is this of any use?

I thought it would, but I already tried that: it still does not sort data in the same order as Funkwhale (or as any programming language when sorting in en_US locale).

Thank for your help, though.

Apparently, from my tests, Couchbase Lite has proper support for localized Unicode ordering, so that could be a solution, though it would require quite a heavy amount of boilerplate and rewrite.

But this is a lead.

Edit: might have spoken too soon. They have options for localized Unicode ordering, but it still gives out a different order than Funkwhale's.