From f7a01f7e0b20a9237fa79dac64ef8f42ae295de9 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 30 Oct 2016 22:16:29 -0700 Subject: [PATCH] Fixed a bug where content wasn't ordered reliably --- src/index.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.rs b/src/index.rs index 5daf553..51cd588 100644 --- a/src/index.rs +++ b/src/index.rs @@ -442,7 +442,7 @@ impl Index { let mut output = Vec::new(); let path_string = real_path.to_string_lossy(); - let mut select = db.prepare("SELECT path, artwork, year, artist, album FROM directories WHERE parent = ?").unwrap(); + let mut select = db.prepare("SELECT path, artwork, year, artist, album FROM directories WHERE parent = ? ORDER BY path ASC").unwrap(); select.bind(1, &Value::String(path_string.deref().to_owned())).unwrap(); while let State::Row = select.next().unwrap() { @@ -480,7 +480,7 @@ impl Index { fn browse_songs(&self, real_path: &Path) -> Vec { let db = self.connect(); let path_string = real_path.to_string_lossy(); - let mut select = db.prepare("SELECT path, track_number, title, year, album_artist, artist, album, artwork FROM songs WHERE parent = ?").unwrap(); + let mut select = db.prepare("SELECT path, track_number, title, year, album_artist, artist, album, artwork FROM songs WHERE parent = ? ORDER BY path ASC").unwrap(); select.bind(1, &Value::String(path_string.deref().to_owned())).unwrap(); self.select_songs(&mut select).into_iter().map(|s| CollectionFile::Song(s)).collect() } @@ -518,7 +518,7 @@ impl Index { let db = self.connect(); let real_path = try!(self.vfs.virtual_to_real(virtual_path)); let path_string = real_path.to_string_lossy().into_owned() + "%"; - let mut select = db.prepare("SELECT path, track_number, title, year, album_artist, artist, album, artwork FROM songs WHERE path LIKE ?").unwrap(); + let mut select = db.prepare("SELECT path, track_number, title, year, album_artist, artist, album, artwork FROM songs WHERE path LIKE ? ORDER BY path").unwrap(); select.bind(1, &Value::String(path_string.deref().to_owned())).unwrap(); Ok(self.select_songs(&mut select)) }