sorting song in a playlist by most played isn't really a part of the spotify api, however there is some kind of private toplist functionality, i'll look that up. Sorting by rating is already implemented in the latest version