diff --git a/NEWS b/NEWS index 03efb96a..0332a5a1 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,7 @@ ncmpcpp-0.7 (????-??-??) * Sorting actions were rebound to Ctrl-S. * Support for range selection was added (bound to Ctrl-V by default). In addition, sorting, reversing and shuffling items in playlist now works on ranges. * Support for selecting found items was added (bound to Ctrl-_ by default). +* Tracks in media library are now properly sorted for track numbers greater than 99. ncmpcpp-0.6.5 (2015-07-05) diff --git a/src/media_library.cpp b/src/media_library.cpp index ea630ad1..7e5fba12 100644 --- a/src/media_library.cpp +++ b/src/media_library.cpp @@ -106,7 +106,13 @@ public: if (ret != 0) return ret < 0; } - return a.getTrack() < b.getTrack(); + try { + int ret = boost::lexical_cast(a.getTags(&MPD::Song::getTrackNumber)) + - boost::lexical_cast(b.getTags(&MPD::Song::getTrackNumber)); + return ret < 0; + } catch (boost::bad_lexical_cast &) { + return a.getTrackNumber() < b.getTrackNumber(); + } } };