From 6b95d7427a7d29dd60bc8f464a04b2a004de9eaf Mon Sep 17 00:00:00 2001 From: Cloud Dumper Date: Fri, 6 Jan 2012 11:01:32 +0100 Subject: [PATCH] Sort results from music collection getters. Albums and artists are now ordered by name, song by track number and name. --- apps/media/lib_collection.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/media/lib_collection.php b/apps/media/lib_collection.php index caa3ac3f479..1240f1de2f0 100644 --- a/apps/media/lib_collection.php +++ b/apps/media/lib_collection.php @@ -127,7 +127,7 @@ class OC_MEDIA_COLLECTION{ $search='%'; } $query=OC_DB::prepare("SELECT DISTINCT *PREFIX*media_artists.artist_name AS artist_name , *PREFIX*media_artists.artist_id AS artist_id FROM *PREFIX*media_artists - INNER JOIN *PREFIX*media_songs ON *PREFIX*media_artists.artist_id=*PREFIX*media_songs.song_artist WHERE artist_name LIKE ? AND *PREFIX*media_songs.song_user=?"); + INNER JOIN *PREFIX*media_songs ON *PREFIX*media_artists.artist_id=*PREFIX*media_songs.song_artist WHERE artist_name LIKE ? AND *PREFIX*media_songs.song_user=? ORDER BY artist_name"); return $query->execute(array($search,self::$uid))->fetchAll(); } @@ -160,7 +160,7 @@ class OC_MEDIA_COLLECTION{ */ static public function getAlbums($artist=0,$search='%',$exact=false){ $cmd="SELECT DISTINCT *PREFIX*media_albums.album_name AS album_name , *PREFIX*media_albums.album_artist AS album_artist , *PREFIX*media_albums.album_id AS album_id - FROM *PREFIX*media_albums INNER JOIN *PREFIX*media_songs ON *PREFIX*media_albums.album_id=*PREFIX*media_songs.song_album WHERE *PREFIX*media_songs.song_user=? "; + FROM *PREFIX*media_albums INNER JOIN *PREFIX*media_songs ON *PREFIX*media_albums.album_id=*PREFIX*media_songs.song_album WHERE *PREFIX*media_songs.song_user=? ORDER BY album_name"; $params=array(self::$uid); if($artist!=0){ $cmd.="AND *PREFIX*media_albums.album_artist = ? "; @@ -233,7 +233,7 @@ class OC_MEDIA_COLLECTION{ }else{ $searchString=''; } - $query=OC_DB::prepare("SELECT * FROM *PREFIX*media_songs WHERE song_user=? $artistString $albumString $searchString"); + $query=OC_DB::prepare("SELECT * FROM *PREFIX*media_songs WHERE song_user=? $artistString $albumString $searchString ORDER BY song_track, song_name"); return $query->execute($params)->fetchAll(); } @@ -378,4 +378,4 @@ class OC_MEDIA_COLLECTION{ } } -?> \ No newline at end of file +?> -- 2.39.5