mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Remove redundant selfs
This commit is contained in:
parent
abe2c293eb
commit
f39c2a4f99
@ -30,13 +30,13 @@ extension MPDClient {
|
|||||||
func searchSongs(_ terms: [MPDClient.MPDTag: String]) -> [MPDSong] {
|
func searchSongs(_ terms: [MPDClient.MPDTag: String]) -> [MPDSong] {
|
||||||
var songs: [MPDSong] = []
|
var songs: [MPDSong] = []
|
||||||
|
|
||||||
mpd_search_db_songs(self.connection, true)
|
mpd_search_db_songs(connection, true)
|
||||||
for (tag, term) in terms {
|
for (tag, term) in terms {
|
||||||
mpd_search_add_tag_constraint(self.connection, MPD_OPERATOR_DEFAULT, tag.mpdTag(), term)
|
mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, tag.mpdTag(), term)
|
||||||
}
|
}
|
||||||
mpd_search_commit(self.connection)
|
mpd_search_commit(connection)
|
||||||
|
|
||||||
while let song = mpd_recv_song(self.connection) {
|
while let song = mpd_recv_song(connection) {
|
||||||
songs.append(MPDSong(song))
|
songs.append(MPDSong(song))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,31 +51,31 @@ extension MPDClient {
|
|||||||
) -> Void {
|
) -> Void {
|
||||||
var size: Int?
|
var size: Int?
|
||||||
|
|
||||||
mpd_send_albumart(self.connection, songUri, String(offset))
|
mpd_send_albumart(connection, songUri, String(offset))
|
||||||
|
|
||||||
guard let sizePair = mpd_recv_pair(self.connection) else {
|
guard let sizePair = mpd_recv_pair(connection) else {
|
||||||
mpd_connection_clear_error(self.connection)
|
mpd_connection_clear_error(connection)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
size = Int(MPDPair(sizePair).value)
|
size = Int(MPDPair(sizePair).value)
|
||||||
mpd_return_pair(self.connection, sizePair)
|
mpd_return_pair(connection, sizePair)
|
||||||
|
|
||||||
var data = imageData ?? Data(count: size!)
|
var data = imageData ?? Data(count: size!)
|
||||||
|
|
||||||
let binaryPair = MPDPair(mpd_recv_pair(self.connection))
|
let binaryPair = MPDPair(mpd_recv_pair(connection))
|
||||||
let chunkSize = Int(binaryPair.value)!
|
let chunkSize = Int(binaryPair.value)!
|
||||||
mpd_return_pair(self.connection, binaryPair.pair)
|
mpd_return_pair(connection, binaryPair.pair)
|
||||||
|
|
||||||
_ = data[offset...].withUnsafeMutableBytes { (pointer) in
|
_ = data[offset...].withUnsafeMutableBytes { (pointer) in
|
||||||
mpd_recv_binary(self.connection, pointer.baseAddress, chunkSize)
|
mpd_recv_binary(connection, pointer.baseAddress, chunkSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
guard mpd_response_finish(self.connection) else { return }
|
guard mpd_response_finish(connection) else { return }
|
||||||
|
|
||||||
let newOffset = offset + Int32(chunkSize)
|
let newOffset = offset + Int32(chunkSize)
|
||||||
|
|
||||||
if newOffset < size! {
|
if newOffset < size! {
|
||||||
self.fetchAlbumArt(
|
fetchAlbumArt(
|
||||||
songUri: songUri,
|
songUri: songUri,
|
||||||
imageData: data,
|
imageData: data,
|
||||||
offset: newOffset,
|
offset: newOffset,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user