catharsis / spotifile

FUSE file system for Spotify
BSD 3-Clause "New" or "Revised" License
144 stars 7 forks source link

Attempt to reduce playlist load time #25

Closed catharsis closed 8 years ago

catharsis commented 9 years ago

More advanced media players sanely assume that reading the header of each file in a playlist directory is a cheap operation. For spotifile, this is not true, since libspotify does not provide a way to get audio format information without loading the track and inspecting the audio data on delivery, and we need that data to be able to correctly fill in the track's header. For large playlists, this induces an significant overhead in such players, as they try to figure out the track duration from the header (again, sanely).

Ironically, we already have the duration information, but no way of portably communicating it to players. Though, it's possible that there is some auxiliary file we could create to provide this information, I'll have to look into this.

Thought: It might be worthwhile to try to cheat, and assume that all tracks on any album share the same format.

catharsis commented 9 years ago

This might be related to #18, in that using mp3 would allow us to put duration data into id3 tags. If that could resolve the actual issue of players triggering track loading remains to be seen, however.

catharsis commented 9 years ago

Then again, maybe I'm overthinking this, or at least attacking it from the wrong direction... Most players should have the option to turn such features off (e.g in VLC you'd uncheck "Automatically preparse files"), which would make this a non-issue.

It's probably better to strive for correctness for now, and worry about performance later.