1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00

Address some PR feedback

This commit is contained in:
Daniel Barber 2020-02-15 12:23:51 -05:00
parent a7e7620f68
commit fa338ee790
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
3 changed files with 7 additions and 11 deletions

View File

@ -123,12 +123,10 @@ class AlbumDetailView: NSViewController {
self.albumTracksView.reloadData() self.albumTracksView.reloadData()
guard !self.dataSource.albumSongs.isEmpty, guard let mpdSong = album.mpdAlbum.firstSong
let song = self.dataSource.albumSongs.first?.song ??
self.dataSource.albumSongs[1].song
else { return } else { return }
self.getBigCoverArt(song: song, album: album) self.getBigCoverArt(song: Song(mpdSong: mpdSong), album: album)
} }
} }
} }

View File

@ -12,9 +12,9 @@ import Kingfisher
public struct MPDAlbumArtImageDataProvider: ImageDataProvider { public struct MPDAlbumArtImageDataProvider: ImageDataProvider {
let songUri: String let songUri: String
init(songUri: String, cacheKey: String? = nil) { init(songUri: String, cacheKey: String) {
self.songUri = songUri self.songUri = songUri
self.cacheKey = cacheKey ?? songUri self.cacheKey = cacheKey
} }
public var cacheKey: String public var cacheKey: String

View File

@ -74,17 +74,15 @@ extension MPDClient {
let newOffset = offset + Int32(chunkSize) let newOffset = offset + Int32(chunkSize)
if newOffset < size! { DispatchQueue.main.async {
DispatchQueue.main.async { if newOffset < size! {
self.fetchAlbumArt( self.fetchAlbumArt(
songUri: songUri, songUri: songUri,
imageData: data, imageData: data,
offset: newOffset, offset: newOffset,
callback: callback callback: callback
) )
} } else {
} else {
DispatchQueue.main.async {
callback(data) callback(data)
} }
} }