Mach5 / supersonic

Open-source web-based media streamer and jukebox fork of Subsonic. Supports MP3, OGG, AAC and other streamable audio and video formats. Runs on Windows, GNU/Linux and Mac using Java.
243 stars 60 forks source link

cache music index to speed up library browsing #7

Open timoreimann opened 12 years ago

timoreimann commented 12 years ago

Apparently, the Android app sends a request to the server for every music directory level accessed. This is especially bothering when switching between UI tabs. Some kind of caching mechanism should be implemented and used instead.

timoreimann commented 12 years ago

I'd to implement this feature by means of building and maintaining the music cache on the server side. An extension to the REST API will then allow clients to request possible cache updates.

A simple log journal managed on the server should provide the basis for cache management. It should work something like this: Every time the music library is modified on the backend (e.g., music content added or removed), an entry describing the change is added to a simple text-based log and tagged with a version (similar to a file system journal). Clients (e.g., Android devices) regularly ask the server for possible music indices updates and provide their local index version with the request. The server then checks if the passed version is smaller than the latest version in the journal, and if so, returns all modifications yet unknown to the client in a merged format. The client updates its local index and remembers the new version which is then provided in future synchronization requests.

Naturally, it should be possible for clients to force a premature synchronization update, or recreate the index from scratch should anything go wrong.