Fix subtle issue with playlist import ordering. Fixes Bug #1241244.

TrackDAO::addTracks does two passes over the imported tracks list -- the
first collects track IDs which are already in the library. The second
adds tracks not in the library to the library. I added a third step to
re-sort the tracks by the caller's provided ordering. Includes some
other misc fixups.