mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Compare commits
No commits in common. "123f9c1e4accbf20e2a09799ed7fa69fb88feaf4" and "f22b5b022cf29e6c287e0cd3687a640ac0f72a4b" have entirely different histories.
123f9c1e4a
...
f22b5b022c
@ -1201,7 +1201,7 @@
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/libmpdclient/output",
|
||||
);
|
||||
MARKETING_VERSION = "0.16.0-prealpha";
|
||||
MARKETING_VERSION = "0.15.2-alpha";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = me.danbarber.Persephone;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -1233,7 +1233,7 @@
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/libmpdclient/output",
|
||||
);
|
||||
MARKETING_VERSION = "0.16.0-prealpha";
|
||||
MARKETING_VERSION = "0.15.2-alpha";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = me.danbarber.Persephone;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
||||
@ -71,34 +71,7 @@ class AlbumViewItem: NSCollectionViewItem {
|
||||
.processor(DownsamplingImageProcessor(size: .albumListCoverSize)),
|
||||
.scaleFactor(2),
|
||||
]
|
||||
) { result in
|
||||
switch result {
|
||||
case .success(let imageResult):
|
||||
guard let imageData = imageResult.image.tiffRepresentation
|
||||
else { return }
|
||||
|
||||
let rawProvider = RawImageDataProvider(
|
||||
data: imageData,
|
||||
cacheKey: album.hash
|
||||
)
|
||||
|
||||
self.cacheSmallCover(provider: rawProvider)
|
||||
|
||||
case .failure(_):
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func cacheSmallCover(provider: ImageDataProvider) {
|
||||
_ = KingfisherManager.shared.retrieveImage(
|
||||
with: .provider(provider),
|
||||
options: [
|
||||
.memoryCacheExpiration(.never),
|
||||
.processor(DownsamplingImageProcessor(size: .queueSongCoverSize)),
|
||||
.scaleFactor(2),
|
||||
]
|
||||
) { result in }
|
||||
)
|
||||
}
|
||||
|
||||
func setAppearance(selected isSelected: Bool) {
|
||||
|
||||
@ -145,6 +145,19 @@ class AlbumDetailView: NSViewController {
|
||||
.scaleFactor(2),
|
||||
]
|
||||
)
|
||||
|
||||
cacheSmallCover(provider: provider)
|
||||
}
|
||||
|
||||
func cacheSmallCover(provider: MPDAlbumArtImageDataProvider) {
|
||||
_ = KingfisherManager.shared.retrieveImage(
|
||||
with: .provider(provider),
|
||||
options: [
|
||||
.memoryCacheExpiration(.never),
|
||||
.processor(DownsamplingImageProcessor(size: .queueSongCoverSize)),
|
||||
.scaleFactor(2),
|
||||
]
|
||||
) { result in }
|
||||
}
|
||||
|
||||
func setAppearance() {
|
||||
|
||||
@ -154,7 +154,6 @@ extension MPDClient {
|
||||
|
||||
self.idle(forceIdle)
|
||||
}
|
||||
|
||||
commandOperation.queuePriority = priority
|
||||
commandQueue.addOperation(commandOperation)
|
||||
}
|
||||
|
||||
@ -42,48 +42,48 @@ extension MPDClient {
|
||||
|
||||
func handleIdleResult(_ result: mpd_idle) {
|
||||
let mpdIdle = MPDIdle(rawValue: result.rawValue)
|
||||
let wasIdle: Bool
|
||||
|
||||
do {
|
||||
idleLock.lock()
|
||||
defer { idleLock.unlock() }
|
||||
wasIdle = isIdle
|
||||
isIdle = false
|
||||
|
||||
if isIdle {
|
||||
isIdle = false
|
||||
|
||||
if mpdIdle.contains(.database) {
|
||||
self.fetchAllAlbums()
|
||||
}
|
||||
if mpdIdle.contains(.queue) {
|
||||
self.fetchQueue()
|
||||
self.fetchStatus()
|
||||
|
||||
self.delegate?.didUpdateQueue(mpdClient: self, queue: self.queue)
|
||||
if let status = self.status {
|
||||
self.delegate?.didUpdateQueuePos(mpdClient: self, song: status.song)
|
||||
}
|
||||
}
|
||||
if mpdIdle.contains(.player) || mpdIdle.contains(.options) {
|
||||
self.fetchStatus()
|
||||
|
||||
if let status = self.status {
|
||||
self.delegate?.didUpdateStatus(mpdClient: self, status: status)
|
||||
self.delegate?.didUpdateQueuePos(mpdClient: self, song: status.song)
|
||||
}
|
||||
}
|
||||
if mpdIdle.contains(.update) {
|
||||
self.fetchStatus()
|
||||
|
||||
if self.status?.updating ?? false {
|
||||
self.delegate?.willStartDatabaseUpdate(mpdClient: self)
|
||||
} else {
|
||||
self.delegate?.didFinishDatabaseUpdate(mpdClient: self)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if wasIdle {
|
||||
if mpdIdle.contains(.database) {
|
||||
self.fetchAllAlbums()
|
||||
}
|
||||
if mpdIdle.contains(.queue) {
|
||||
self.fetchQueue()
|
||||
self.fetchStatus()
|
||||
|
||||
self.delegate?.didUpdateQueue(mpdClient: self, queue: self.queue)
|
||||
if let status = self.status {
|
||||
self.delegate?.didUpdateQueuePos(mpdClient: self, song: status.song)
|
||||
}
|
||||
}
|
||||
if mpdIdle.contains(.player) || mpdIdle.contains(.options) {
|
||||
self.fetchStatus()
|
||||
|
||||
if let status = self.status {
|
||||
self.delegate?.didUpdateStatus(mpdClient: self, status: status)
|
||||
self.delegate?.didUpdateQueuePos(mpdClient: self, song: status.song)
|
||||
}
|
||||
}
|
||||
if mpdIdle.contains(.update) {
|
||||
self.fetchStatus()
|
||||
|
||||
if self.status?.updating ?? false {
|
||||
self.delegate?.willStartDatabaseUpdate(mpdClient: self)
|
||||
} else {
|
||||
self.delegate?.didFinishDatabaseUpdate(mpdClient: self)
|
||||
}
|
||||
}
|
||||
if !mpdIdle.isEmpty {
|
||||
self.idle()
|
||||
}
|
||||
if !mpdIdle.isEmpty {
|
||||
self.idle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,51 +19,27 @@ extension MPDClient {
|
||||
}
|
||||
|
||||
func playTrack(at queuePos: Int) {
|
||||
enqueueCommand(
|
||||
command: .playTrack,
|
||||
forceIdle: true,
|
||||
userData: ["queuePos": queuePos]
|
||||
)
|
||||
enqueueCommand(command: .playTrack, userData: ["queuePos": queuePos])
|
||||
}
|
||||
|
||||
func appendSong(_ song: MPDSong) {
|
||||
enqueueCommand(
|
||||
command: .appendSong,
|
||||
forceIdle: true,
|
||||
userData: ["song": song]
|
||||
)
|
||||
enqueueCommand(command: .appendSong, userData: ["song": song])
|
||||
}
|
||||
|
||||
func removeSong(at queuePos: Int) {
|
||||
enqueueCommand(
|
||||
command: .removeSong,
|
||||
forceIdle: true,
|
||||
userData: ["queuePos": queuePos]
|
||||
)
|
||||
enqueueCommand(command: .removeSong, userData: ["queuePos": queuePos])
|
||||
}
|
||||
|
||||
func moveSongInQueue(at queuePos: Int, to newQueuePos: Int) {
|
||||
enqueueCommand(
|
||||
command: .moveSongInQueue,
|
||||
forceIdle: true,
|
||||
userData: ["oldQueuePos": queuePos, "newQueuePos": newQueuePos]
|
||||
)
|
||||
enqueueCommand(command: .moveSongInQueue, userData: ["oldQueuePos": queuePos, "newQueuePos": newQueuePos])
|
||||
}
|
||||
|
||||
func addSongToQueue(songUri: String, at queuePos: Int) {
|
||||
enqueueCommand(
|
||||
command: .addSongToQueue,
|
||||
forceIdle: true,
|
||||
userData: ["uri": songUri, "queuePos": queuePos]
|
||||
)
|
||||
enqueueCommand(command: .addSongToQueue, userData: ["uri": songUri, "queuePos": queuePos])
|
||||
}
|
||||
|
||||
func addAlbumToQueue(album: MPDAlbum, at queuePos: Int) {
|
||||
enqueueCommand(
|
||||
command: .addAlbumToQueue,
|
||||
forceIdle: true,
|
||||
userData: ["album": album, "queuePos": queuePos]
|
||||
)
|
||||
enqueueCommand(command: .addAlbumToQueue, userData: ["album": album, "queuePos": queuePos])
|
||||
}
|
||||
|
||||
func sendPlayTrack(at queuePos: Int) {
|
||||
|
||||
@ -18,7 +18,6 @@ extension MPDClient {
|
||||
) {
|
||||
enqueueCommand(
|
||||
command: .fetchAlbumArt,
|
||||
priority: .low,
|
||||
userData: [
|
||||
"songUri": songUri,
|
||||
"callback": callback,
|
||||
|
||||
@ -11,41 +11,25 @@ import mpdclient
|
||||
|
||||
extension MPDClient {
|
||||
func playPause() {
|
||||
enqueueCommand(
|
||||
command: .playPause,
|
||||
priority: .high,
|
||||
forceIdle: true
|
||||
)
|
||||
enqueueCommand(command: .playPause, priority: .veryHigh, forceIdle: true)
|
||||
}
|
||||
|
||||
func stop() {
|
||||
enqueueCommand(
|
||||
command: .stop,
|
||||
priority: .high,
|
||||
forceIdle: true
|
||||
)
|
||||
enqueueCommand(command: .stop, priority: .veryHigh, forceIdle: true)
|
||||
}
|
||||
|
||||
func prevTrack() {
|
||||
enqueueCommand(
|
||||
command: .prevTrack,
|
||||
priority: .high,
|
||||
forceIdle: true
|
||||
)
|
||||
enqueueCommand(command: .prevTrack, priority: .veryHigh, forceIdle: true)
|
||||
}
|
||||
|
||||
func nextTrack() {
|
||||
enqueueCommand(
|
||||
command: .nextTrack,
|
||||
priority: .high,
|
||||
forceIdle: true
|
||||
)
|
||||
enqueueCommand(command: .nextTrack, priority: .veryHigh, forceIdle: true)
|
||||
}
|
||||
|
||||
func seekCurrentSong(timeInSeconds: Float) {
|
||||
enqueueCommand(
|
||||
command: .seekCurrentSong,
|
||||
priority: .high,
|
||||
priority: .veryHigh,
|
||||
forceIdle: true,
|
||||
userData: ["timeInSeconds": timeInSeconds]
|
||||
)
|
||||
@ -54,7 +38,7 @@ extension MPDClient {
|
||||
func setShuffleState(shuffleState: Bool) {
|
||||
enqueueCommand(
|
||||
command: .setShuffleState,
|
||||
priority: .high,
|
||||
priority: .veryHigh,
|
||||
forceIdle: true,
|
||||
userData: ["shuffleState": shuffleState]
|
||||
)
|
||||
@ -63,7 +47,7 @@ extension MPDClient {
|
||||
func setRepeatState(repeatState: Bool) {
|
||||
enqueueCommand(
|
||||
command: .setRepeatState,
|
||||
priority: .high,
|
||||
priority: .veryHigh,
|
||||
forceIdle: true,
|
||||
userData: ["repeatState": repeatState]
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user