mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Compare commits
4 Commits
01371db6cb
...
87dafef15a
| Author | SHA1 | Date | |
|---|---|---|---|
| 87dafef15a | |||
| f1c9f25296 | |||
| 50e58f7cac | |||
| f014c4f929 |
3
Cartfile
3
Cartfile
@ -1,3 +1,4 @@
|
||||
github "SwiftyJSON/SwiftyJSON" ~> 4.0
|
||||
github "PromiseKit/Foundation" ~> 3.0
|
||||
github "nhurden/MediaKeyTap" "fix-tis-tsm-error"
|
||||
github "nhurden/MediaKeyTap"
|
||||
github "krzyzanowskim/CryptoSwift"
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
github "PromiseKit/Foundation" "3.3.2"
|
||||
github "SwiftyJSON/SwiftyJSON" "4.2.0"
|
||||
github "krzyzanowskim/CryptoSwift" "1.0.0"
|
||||
github "mxcl/PromiseKit" "6.8.4"
|
||||
github "nhurden/MediaKeyTap" "355d346c56243e6d56487fa46fcad945251e16ae"
|
||||
github "nhurden/MediaKeyTap" "2.2.1"
|
||||
|
||||
@ -51,11 +51,17 @@
|
||||
E450AD9322262C970091BED3 /* PromiseKit.framework in Embed Libraries */ = {isa = PBXBuildFile; fileRef = E450AD8C22262C590091BED3 /* PromiseKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
E450AD9522262DF10091BED3 /* AlbumArtQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = E450AD9422262DF10091BED3 /* AlbumArtQueue.swift */; };
|
||||
E450AD98222633920091BED3 /* Alamofire.framework.dSYM in Resources */ = {isa = PBXBuildFile; fileRef = E450AD96222633920091BED3 /* Alamofire.framework.dSYM */; };
|
||||
E450AD9D2229B9050091BED3 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = E450AD9C2229B9050091BED3 /* String.swift */; };
|
||||
E450ADA12229E7C90091BED3 /* PMKFoundation.framework.dSYM in Resources */ = {isa = PBXBuildFile; fileRef = E450AD9F2229E7C90091BED3 /* PMKFoundation.framework.dSYM */; };
|
||||
E450ADA32229E7E00091BED3 /* PMKFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E450ADA02229E7C90091BED3 /* PMKFoundation.framework */; };
|
||||
E450ADA42229E7E00091BED3 /* PMKFoundation.framework in Embed Libraries */ = {isa = PBXBuildFile; fileRef = E450ADA02229E7C90091BED3 /* PMKFoundation.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
E45962C62241A78500FC1A1E /* MPDCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = E45962C52241A78500FC1A1E /* MPDCommand.swift */; };
|
||||
E45E4FDA22515D87004B537F /* CHANGELOG.md in Resources */ = {isa = PBXBuildFile; fileRef = E45E4FD722515D87004B537F /* CHANGELOG.md */; };
|
||||
E45E4FDB22515D87004B537F /* Brewfile in Resources */ = {isa = PBXBuildFile; fileRef = E45E4FD822515D87004B537F /* Brewfile */; };
|
||||
E45E4FDC22515D87004B537F /* Cartfile in Resources */ = {isa = PBXBuildFile; fileRef = E45E4FD922515D87004B537F /* Cartfile */; };
|
||||
E45E4FDF225168DA004B537F /* CryptoSwift.framework.dSYM in Resources */ = {isa = PBXBuildFile; fileRef = E45E4FDD225168DA004B537F /* CryptoSwift.framework.dSYM */; };
|
||||
E45E4FE0225168DA004B537F /* CryptoSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45E4FDE225168DA004B537F /* CryptoSwift.framework */; };
|
||||
E45E4FE122516953004B537F /* CryptoSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45E4FDE225168DA004B537F /* CryptoSwift.framework */; };
|
||||
E45E4FE222516953004B537F /* CryptoSwift.framework in Embed Libraries */ = {isa = PBXBuildFile; fileRef = E45E4FDE225168DA004B537F /* CryptoSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
E465049A21E94DF500A70F4C /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E465049921E94DF500A70F4C /* WindowController.swift */; };
|
||||
E47E2FCC2220573500F747E6 /* MediaKeyTap.framework.dSYM in Resources */ = {isa = PBXBuildFile; fileRef = E47E2FCB2220573500F747E6 /* MediaKeyTap.framework.dSYM */; };
|
||||
E47E2FD122205C4600F747E6 /* MainSplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E47E2FD022205C4600F747E6 /* MainSplitViewController.swift */; };
|
||||
@ -109,6 +115,7 @@
|
||||
E41B22C121FB6C3300D544F6 /* libmpdclient.2.dylib in Embed Libraries */,
|
||||
E450ADA42229E7E00091BED3 /* PMKFoundation.framework in Embed Libraries */,
|
||||
E421ACA4221F73C4008B2449 /* MediaKeyTap.framework in Embed Libraries */,
|
||||
E45E4FE222516953004B537F /* CryptoSwift.framework in Embed Libraries */,
|
||||
E450AD8822262AEC0091BED3 /* SwiftyJSON.framework in Embed Libraries */,
|
||||
E450AD9322262C970091BED3 /* PromiseKit.framework in Embed Libraries */,
|
||||
);
|
||||
@ -211,11 +218,15 @@
|
||||
E450AD9422262DF10091BED3 /* AlbumArtQueue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumArtQueue.swift; sourceTree = "<group>"; };
|
||||
E450AD96222633920091BED3 /* Alamofire.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = Alamofire.framework.dSYM; path = Carthage/Build/Mac/Alamofire.framework.dSYM; sourceTree = "<group>"; };
|
||||
E450AD97222633920091BED3 /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/Mac/Alamofire.framework; sourceTree = "<group>"; };
|
||||
E450AD9C2229B9050091BED3 /* String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = "<group>"; };
|
||||
E450AD9E2229B9BC0091BED3 /* PersephoneBridgingHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PersephoneBridgingHeader.h; sourceTree = "<group>"; };
|
||||
E450AD9F2229E7C90091BED3 /* PMKFoundation.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = PMKFoundation.framework.dSYM; path = Carthage/Build/Mac/PMKFoundation.framework.dSYM; sourceTree = "<group>"; };
|
||||
E450ADA02229E7C90091BED3 /* PMKFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PMKFoundation.framework; path = Carthage/Build/Mac/PMKFoundation.framework; sourceTree = "<group>"; };
|
||||
E45962C52241A78500FC1A1E /* MPDCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDCommand.swift; sourceTree = "<group>"; };
|
||||
E45E4FD722515D87004B537F /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = SOURCE_ROOT; };
|
||||
E45E4FD822515D87004B537F /* Brewfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Brewfile; sourceTree = SOURCE_ROOT; };
|
||||
E45E4FD922515D87004B537F /* Cartfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cartfile; sourceTree = SOURCE_ROOT; };
|
||||
E45E4FDD225168DA004B537F /* CryptoSwift.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = CryptoSwift.framework.dSYM; path = Carthage/Build/Mac/CryptoSwift.framework.dSYM; sourceTree = "<group>"; };
|
||||
E45E4FDE225168DA004B537F /* CryptoSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CryptoSwift.framework; path = Carthage/Build/Mac/CryptoSwift.framework; sourceTree = "<group>"; };
|
||||
E465049921E94DF500A70F4C /* WindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowController.swift; sourceTree = "<group>"; };
|
||||
E47E2FCB2220573500F747E6 /* MediaKeyTap.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = MediaKeyTap.framework.dSYM; path = Carthage/Build/Mac/MediaKeyTap.framework.dSYM; sourceTree = "<group>"; };
|
||||
E47E2FD022205C4600F747E6 /* MainSplitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainSplitViewController.swift; sourceTree = "<group>"; };
|
||||
@ -247,9 +258,11 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E45E4FE122516953004B537F /* CryptoSwift.framework in Frameworks */,
|
||||
E41B22C021FB6BBA00D544F6 /* libmpdclient.2.dylib in Frameworks */,
|
||||
E421ACA3221F73C4008B2449 /* MediaKeyTap.framework in Frameworks */,
|
||||
E450AD8622262AE60091BED3 /* SwiftyJSON.framework in Frameworks */,
|
||||
E45E4FE0225168DA004B537F /* CryptoSwift.framework in Frameworks */,
|
||||
E450ADA32229E7E00091BED3 /* PMKFoundation.framework in Frameworks */,
|
||||
E450AD9222262C970091BED3 /* PromiseKit.framework in Frameworks */,
|
||||
);
|
||||
@ -275,11 +288,14 @@
|
||||
E407860F2110CE6E006887B1 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E41B22BE21FB6B3300D544F6 /* Frameworks */,
|
||||
E407861A2110CE6E006887B1 /* Persephone */,
|
||||
E407862D2110CE70006887B1 /* PersephoneTests */,
|
||||
E40786382110CE70006887B1 /* PersephoneUITests */,
|
||||
E40786192110CE6E006887B1 /* Products */,
|
||||
E41B22BE21FB6B3300D544F6 /* Frameworks */,
|
||||
E45E4FD822515D87004B537F /* Brewfile */,
|
||||
E45E4FD922515D87004B537F /* Cartfile */,
|
||||
E45E4FD722515D87004B537F /* CHANGELOG.md */,
|
||||
E42A8F3922176D6400A13ED9 /* LICENSE.md */,
|
||||
E42A8F3A22176D6400A13ED9 /* README.md */,
|
||||
);
|
||||
@ -346,7 +362,6 @@
|
||||
E435E3E1221CD4E200184CFC /* NSFont.swift */,
|
||||
E435E3E3221CD75D00184CFC /* NSImage.swift */,
|
||||
E408D3B8220DE98F0006D9BE /* NSUserInterfaceItemIdentifier.swift */,
|
||||
E450AD9C2229B9050091BED3 /* String.swift */,
|
||||
);
|
||||
path = Extensions;
|
||||
sourceTree = "<group>";
|
||||
@ -380,6 +395,8 @@
|
||||
E41B22BE21FB6B3300D544F6 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E45E4FDE225168DA004B537F /* CryptoSwift.framework */,
|
||||
E45E4FDD225168DA004B537F /* CryptoSwift.framework.dSYM */,
|
||||
E450ADA02229E7C90091BED3 /* PMKFoundation.framework */,
|
||||
E450AD9F2229E7C90091BED3 /* PMKFoundation.framework.dSYM */,
|
||||
E450AD97222633920091BED3 /* Alamofire.framework */,
|
||||
@ -690,10 +707,14 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E45E4FDB22515D87004B537F /* Brewfile in Resources */,
|
||||
E450AD9122262C780091BED3 /* SwiftyJSON.framework.dSYM in Resources */,
|
||||
E42A8F3B22176D6400A13ED9 /* LICENSE.md in Resources */,
|
||||
E45E4FDA22515D87004B537F /* CHANGELOG.md in Resources */,
|
||||
E45E4FDC22515D87004B537F /* Cartfile in Resources */,
|
||||
E450AD98222633920091BED3 /* Alamofire.framework.dSYM in Resources */,
|
||||
E40786202110CE70006887B1 /* Assets.xcassets in Resources */,
|
||||
E45E4FDF225168DA004B537F /* CryptoSwift.framework.dSYM in Resources */,
|
||||
E42A8F3C22176D6400A13ED9 /* README.md in Resources */,
|
||||
E450AD8F22262C620091BED3 /* PromiseKit.framework.dSYM in Resources */,
|
||||
E408D3CB220E341D0006D9BE /* AlbumViewItem.xib in Resources */,
|
||||
@ -790,7 +811,6 @@
|
||||
E41E5312223EF74A00173814 /* AlbumArtService+Filesystem.swift in Sources */,
|
||||
E41E5301223BF99300173814 /* MPDClient+Queue.swift in Sources */,
|
||||
E4EB237B220F7CF1008C70C0 /* MPDAlbum.swift in Sources */,
|
||||
E450AD9D2229B9050091BED3 /* String.swift in Sources */,
|
||||
E41E5303223BF9C300173814 /* MPDClient+Idle.swift in Sources */,
|
||||
E435E3E4221CD75D00184CFC /* NSImage.swift in Sources */,
|
||||
E41E5305223BFB0700173814 /* MPDClient+Error.swift in Sources */,
|
||||
|
||||
@ -40,6 +40,7 @@ class AlbumViewController: NSViewController,
|
||||
albumCollectionView.dataSource = dataSource
|
||||
|
||||
preferences.addObserver(self, forKeyPath: "mpdLibraryDir")
|
||||
preferences.addObserver(self, forKeyPath: "fetchMissingArtworkFromInternet")
|
||||
}
|
||||
|
||||
override func viewWillLayout() {
|
||||
@ -66,6 +67,9 @@ class AlbumViewController: NSViewController,
|
||||
switch keyPath {
|
||||
case "mpdLibraryDir":
|
||||
albumCollectionView.reloadData()
|
||||
case "fetchMissingArtworkFromInternet":
|
||||
dataSource.resetCoverArt()
|
||||
albumCollectionView.reloadData()
|
||||
default:
|
||||
break
|
||||
}
|
||||
@ -75,7 +79,7 @@ class AlbumViewController: NSViewController,
|
||||
guard let albums = notification.userInfo?[Notification.albumsKey] as? [MPDClient.MPDAlbum]
|
||||
else { return }
|
||||
|
||||
dataSource.albums = albums.map { Album(mpdAlbum: $0, coverArt: nil) }
|
||||
dataSource.albums = albums.map { Album(mpdAlbum: $0) }
|
||||
albumCollectionView.reloadData()
|
||||
}
|
||||
|
||||
|
||||
@ -72,11 +72,11 @@ class QueueViewController: NSViewController,
|
||||
|
||||
albumArtService.fetchBigAlbumArt()
|
||||
.done() {
|
||||
guard let image = $0 else { return }
|
||||
|
||||
self.queueAlbumArtImage.image = image.toFitBox(
|
||||
size: NSSize(width: 500, height: 500)
|
||||
)
|
||||
if let image = $0 {
|
||||
self.queueAlbumArtImage.image = image
|
||||
} else {
|
||||
self.queueAlbumArtImage.image = NSImage.defaultCoverArt
|
||||
}
|
||||
}
|
||||
.cauterize()
|
||||
} else {
|
||||
|
||||
@ -16,6 +16,14 @@ class AlbumDataSource: NSObject, NSCollectionViewDataSource {
|
||||
return albums.count
|
||||
}
|
||||
|
||||
func resetCoverArt() {
|
||||
albums = albums.map {
|
||||
var album = $0
|
||||
album.coverArtFetched = false
|
||||
return album
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
|
||||
let item = collectionView.makeItem(withIdentifier: .albumViewItem, for: indexPath)
|
||||
guard let albumViewItem = item as? AlbumViewItem else { return item }
|
||||
@ -23,7 +31,9 @@ class AlbumDataSource: NSObject, NSCollectionViewDataSource {
|
||||
albumViewItem.view.wantsLayer = true
|
||||
albumViewItem.setAlbum(albums[indexPath.item])
|
||||
|
||||
if albums[indexPath.item].coverArt == nil {
|
||||
if albums[indexPath.item].coverArt == nil &&
|
||||
!albums[indexPath.item].coverArtFetched {
|
||||
|
||||
AppDelegate.mpdClient.getAlbumFirstSong(for: albums[indexPath.item].mpdAlbum) {
|
||||
guard let song = $0 else { return }
|
||||
|
||||
@ -31,6 +41,7 @@ class AlbumDataSource: NSObject, NSCollectionViewDataSource {
|
||||
.fetchAlbumArt()
|
||||
.done { image in
|
||||
self.albums[indexPath.item].coverArt = image
|
||||
self.albums[indexPath.item].coverArtFetched = true
|
||||
|
||||
DispatchQueue.main.async {
|
||||
collectionView.reloadItems(at: [indexPath])
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
//
|
||||
// String.swift
|
||||
// Persephone
|
||||
//
|
||||
// Created by Daniel Barber on 2019/3/01.
|
||||
// Copyright © 2019 Dan Barber. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension String {
|
||||
func sha1() -> String {
|
||||
let data = self.data(using: String.Encoding.utf8)!
|
||||
var digest = [UInt8](repeating: 0, count:Int(CC_SHA1_DIGEST_LENGTH))
|
||||
|
||||
data.withUnsafeBytes {
|
||||
_ = CC_SHA1($0, CC_LONG(data.count), &digest)
|
||||
}
|
||||
|
||||
let hexBytes = digest.map { String(format: "%02hhx", $0) }
|
||||
|
||||
return hexBytes.joined()
|
||||
}
|
||||
}
|
||||
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.10.3a</string>
|
||||
<string>0.11.0-alpha</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
|
||||
@ -7,10 +7,16 @@
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import CryptoSwift
|
||||
|
||||
struct Album {
|
||||
var mpdAlbum: MPDClient.MPDAlbum
|
||||
var coverArt: NSImage?
|
||||
var coverArtFetched: Bool = false
|
||||
|
||||
init(mpdAlbum: MPDClient.MPDAlbum) {
|
||||
self.mpdAlbum = mpdAlbum
|
||||
}
|
||||
|
||||
var title: String {
|
||||
return mpdAlbum.title
|
||||
|
||||
@ -20,6 +20,6 @@ struct Song {
|
||||
}
|
||||
|
||||
var album: Album {
|
||||
return Album(mpdAlbum: mpdSong.album, coverArt: nil)
|
||||
return Album(mpdAlbum: mpdSong.album)
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,7 +352,7 @@
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="260" id="gK0-aW-CJy"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="check" title="Save fetched artwork to music directory" bezelStyle="regularSquare" imagePosition="left" inset="2" id="ZeZ-O4-vjS">
|
||||
<buttonCell key="cell" type="check" title="Save fetched artwork to music directory" bezelStyle="regularSquare" imagePosition="left" enabled="NO" inset="2" id="ZeZ-O4-vjS">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
@ -362,7 +362,7 @@
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="144" id="DSX-th-Wn1"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="folder.jpg" drawsBackground="YES" id="nKF-YI-xBL">
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" enabled="NO" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="folder.jpg" drawsBackground="YES" id="nKF-YI-xBL">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -370,9 +370,9 @@
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SmH-w6-5QI">
|
||||
<rect key="frame" x="37" y="30" width="119" height="17"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Cover art filename:" id="b4u-u7-iWD">
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" enabled="NO" alignment="right" title="Cover art filename:" id="b4u-u7-iWD">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
|
||||
@ -32,16 +32,8 @@ class AlbumArtService {
|
||||
self.getArtworkFromFilesystem()
|
||||
}.then { (image: NSImage?) -> Promise<NSImage?> in
|
||||
image.map(Promise.value) ?? self.getRemoteArtwork()
|
||||
}.compactMap(on :artworkQueue) { image in
|
||||
if self.fileSystemArtworkFilePath() != nil {
|
||||
let sizedImage = image?.toFitBox(
|
||||
size: NSSize(width: self.bigArtworkSize, height: self.bigArtworkSize)
|
||||
)
|
||||
self.saveArtworkToFilesystem(data: sizedImage?.jpegData(compressionQuality: self.cachedArtworkQuality))
|
||||
return sizedImage
|
||||
} else {
|
||||
return image
|
||||
}
|
||||
}.recover { (_) -> Guarantee<NSImage?> in
|
||||
return .value(nil)
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,13 +46,7 @@ class AlbumArtService {
|
||||
artwork.map(Promise.value) ?? self.getRemoteArtwork()
|
||||
}.compactMap(on: artworkQueue) {
|
||||
return self.sizeAndCacheImage($0).map(Optional.some)
|
||||
}.recover { error in
|
||||
switch error {
|
||||
case RemoteArtworkError.noArtworkAvailable:
|
||||
self.cacheArtwork(data: Data())
|
||||
default:
|
||||
break
|
||||
}
|
||||
}.recover { _ in
|
||||
return .value(nil)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user