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
831ec77ec5
commit
18901a7c38
@ -57,7 +57,7 @@ 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 != "" {
|
||||||
let escapedFilter = filter.replacingOccurrences(of: "'", with: "\\'")
|
let escapedFilter = filter.replacingOccurrences(of: "'", with: "\\'")
|
||||||
|
|
||||||
@ -66,11 +66,12 @@ extension MPDClient {
|
|||||||
"(any contains '\(escapedFilter)')"
|
"(any contains '\(escapedFilter)')"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
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(
|
||||||
@ -92,10 +93,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