media library: sort track numbers as integers, not strings

This commit is contained in:
Andrzej Rybczak
2015-08-13 10:46:12 +02:00
parent c8ee598e0c
commit 8f9a1a8fc0
2 changed files with 8 additions and 1 deletions

View File

@@ -106,7 +106,13 @@ public:
if (ret != 0)
return ret < 0;
}
return a.getTrack() < b.getTrack();
try {
int ret = boost::lexical_cast<int>(a.getTags(&MPD::Song::getTrackNumber))
- boost::lexical_cast<int>(b.getTags(&MPD::Song::getTrackNumber));
return ret < 0;
} catch (boost::bad_lexical_cast &) {
return a.getTrackNumber() < b.getTrackNumber();
}
}
};