andrewrk/groovebasin — pull request #234 by toofar (2014-04-27 10:04:41+00:00)
Title: Start at last play position on restart.

We now save the current seek offset for the currently playing track in the
database whenever the playlist changes. Then on startup we look for a track
with the offset set and seek to there. We still start paused though,
hopefully.

Currently when we change tracks I am not unsetting the pos of the previous
track but just unsetting the pos of all the tracks but the current. To do
otherwise would mean instrumenting all methods that change currentTrack.

I had to do some fiddling on checkUpdateGroovePlaylist() to get it to use
currentTrack.pos instead of seekRequestPos. I didn't look at all the code
paths that influence that point but it seems to work in testing (with the MPD
protocol anyway).

Todo on this branch:

* save playing/paused state too.
* catch ctrl-c and persistPlaylistItem(currentTrack); currently the seek position is only save when the playlist updated event is fired.