@@ -220,13 +220,21 @@ db_selection_print(Response &r, Partition &partition,
|
||||
db.Visit(selection, d, collect_songs, p);
|
||||
}
|
||||
|
||||
std::stable_sort(songs.begin(), songs.end(),
|
||||
[sort, descending](const DetachedSong &a,
|
||||
const DetachedSong &b){
|
||||
return CompareTags(sort, descending,
|
||||
a.GetTag(),
|
||||
b.GetTag());
|
||||
});
|
||||
if (sort == TagType(SORT_TAG_LAST_MODIFIED))
|
||||
std::stable_sort(songs.begin(), songs.end(),
|
||||
[descending](const DetachedSong &a, const DetachedSong &b){
|
||||
return descending
|
||||
? a.GetLastModified() > b.GetLastModified()
|
||||
: a.GetLastModified() < b.GetLastModified();
|
||||
});
|
||||
else
|
||||
std::stable_sort(songs.begin(), songs.end(),
|
||||
[sort, descending](const DetachedSong &a,
|
||||
const DetachedSong &b){
|
||||
return CompareTags(sort, descending,
|
||||
a.GetTag(),
|
||||
b.GetTag());
|
||||
});
|
||||
|
||||
if (window_end < songs.size())
|
||||
songs.erase(std::next(songs.begin(), window_end),
|
||||
|
@@ -38,6 +38,10 @@ db_selection_print(Response &r, Partition &partition,
|
||||
const DatabaseSelection &selection,
|
||||
bool full, bool base);
|
||||
|
||||
/**
|
||||
* @param sort the sort tag; TAG_NUM_OF_ITEM_TYPES means don't sort;
|
||||
* LOCATE_TAG_MODIFIED_SINCE means sort by file modification time
|
||||
*/
|
||||
void
|
||||
db_selection_print(Response &r, Partition &partition,
|
||||
const DatabaseSelection &selection,
|
||||
|
Reference in New Issue
Block a user