As mentioned in the comments, there is a lot of code circling around using the unfortunate not open source libspotify. The API examples provided, carefully omitting a way to iterate over all playlists.
You mention that you want something that can connect to spotify (the online API is certainly what Spotify would like everyone to use) but I'm pretty sure the same can be done offline. As you said yourself, the files can be backed up.
Located in:
~/.config/spotify/Users/name/
or
{USER_APP_DATA}/Spotify/Users/{USER_ID}
You can probably already tell I'm not a fan of proprietary libraries restricting access to what I can or can not do. So I came up with a simple program that can print the names of all stored playlists. This is helpful enough because I usually add one album per playlist.
I'm pretty sure it can be developed further to include individual tracks.
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
int main(int argc, char *argv[]) {
std::vector<char> vbuf;
unsigned int len;
std::vector<char>::iterator bpos,dpos,epos;
std::ifstream in("playlist.bnk", std::ios::in|std::ios::binary);
if (in) {
in.seekg(0,std::ios::end);
len = in.tellg();
vbuf.resize(len);
in.seekg(0,std::ios::beg);
in.read(&vbuf[0],len);
for(std::vector<char>::iterator it = vbuf.begin(); it != vbuf.end(); ++it) {
if (*it == (char)0x02 && *(it+1) == (char)0x09) {
bpos = it+3;
}
if (*it == (char)0xE2 && *(it+1) == (char)0x80 && *(it+2) == (char)0x93 && bpos != vbuf.end()) {
dpos = it;
}
if (*it == (char)0x18 && *(it+1) == (char)0x01 && *(it+2) == (char)0x19 && dpos != vbuf.end()) {
epos = it;
}
if (bpos != vbuf.end() && dpos != vbuf.end() && epos != vbuf.end()) {
for(std::vector<char>::iterator it2 = bpos; it2 < dpos; ++it2) {
std::cout << *it2;
}
for(std::vector<char>::iterator it2 = dpos; it2 < epos; ++it2) {
std::cout << *it2;
}
std::cout << std::endl;
bpos = vbuf.end();
dpos = vbuf.end();
epos = vbuf.end();
}
}
}
}