diff --git a/Shared/MPDClient/Extensions/MPDClient+Album.swift b/Shared/MPDClient/Extensions/MPDClient+Album.swift index a826e23..0b65917 100644 --- a/Shared/MPDClient/Extensions/MPDClient+Album.swift +++ b/Shared/MPDClient/Extensions/MPDClient+Album.swift @@ -57,18 +57,19 @@ extension MPDClient { func albums(filter: String) { var albums: [MPDAlbum] = [] - mpd_search_db_songs(self.connection, false) + mpd_search_db_songs(connection, false) if filter != "" { mpd_search_add_expression( self.connection, "(any contains '\(filter)')" ) } - mpd_search_add_tag_constraint(self.connection, MPD_OPERATOR_DEFAULT, MPD_TAG_TRACK, "1") + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, MPD_TAG_TRACK, "1") + mpd_search_add_sort_tag(connection, MPD_TAG_ALBUM_ARTIST_SORT, false) mpd_search_commit(self.connection) - while let song = mpd_recv_song(self.connection) { + while let song = mpd_recv_song(connection) { let mpdSong = MPDSong(song) let mpdAlbum = MPDAlbum( @@ -90,10 +91,10 @@ extension MPDClient { var firstSong: MPDSong? - mpd_search_db_songs(self.connection, true) - mpd_search_add_tag_constraint(self.connection, MPD_OPERATOR_DEFAULT, MPD_TAG_ALBUM, album.title) - mpd_search_add_tag_constraint(self.connection, MPD_OPERATOR_DEFAULT, MPD_TAG_ALBUM_ARTIST, album.artist) - mpd_search_add_tag_constraint(self.connection, MPD_OPERATOR_DEFAULT, MPD_TAG_TRACK, "1") + mpd_search_db_songs(connection, true) + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, MPD_TAG_ALBUM, album.title) + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, MPD_TAG_ALBUM_ARTIST, album.artist) + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, MPD_TAG_TRACK, "1") mpd_search_commit(self.connection)