mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Sort albums by artist
Why wasn't I doing this before?
This commit is contained in:
parent
8de9945893
commit
c2bc1faa4a
@ -57,18 +57,19 @@ extension MPDClient {
|
|||||||
func albums(filter: String) {
|
func albums(filter: String) {
|
||||||
var albums: [MPDAlbum] = []
|
var albums: [MPDAlbum] = []
|
||||||
|
|
||||||
mpd_search_db_songs(self.connection, false)
|
mpd_search_db_songs(connection, false)
|
||||||
if filter != "" {
|
if filter != "" {
|
||||||
mpd_search_add_expression(
|
mpd_search_add_expression(
|
||||||
self.connection,
|
self.connection,
|
||||||
"(any contains '\(filter)')"
|
"(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)
|
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 mpdSong = MPDSong(song)
|
||||||
|
|
||||||
let mpdAlbum = MPDAlbum(
|
let mpdAlbum = MPDAlbum(
|
||||||
@ -90,10 +91,10 @@ extension MPDClient {
|
|||||||
|
|
||||||
var firstSong: MPDSong?
|
var firstSong: MPDSong?
|
||||||
|
|
||||||
mpd_search_db_songs(self.connection, true)
|
mpd_search_db_songs(connection, true)
|
||||||
mpd_search_add_tag_constraint(self.connection, MPD_OPERATOR_DEFAULT, MPD_TAG_ALBUM, album.title)
|
mpd_search_add_tag_constraint(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(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_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, MPD_TAG_TRACK, "1")
|
||||||
|
|
||||||
mpd_search_commit(self.connection)
|
mpd_search_commit(self.connection)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user