ejurgensen/forked-daapd — pull request #74 by chme (2014-12-27 09:06:49+00:00)
Title: fix delete query for removing files if a spotify playlist is deleted

The delete query for removing the entries in the files table in db_spotify_pl_delete looks wrong.

´´´
DELETE FROM files WHERE path LIKE 'spotify:%%' AND NOT path IN (SELECT filepath FROM playlistitems WHERE id <> %d);
´´´

The argument id should be the playlist-id instead of the playlistitem-id in the query. I took it a step further by moving the delete of the files table entries to the first position, so that the subselect does not need to scan the whole playlistitems table.

I am not really familiar with the spotify integration code, so i might be wrong about this.