mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Compare commits
5 Commits
f22b5b022c
...
123f9c1e4a
| Author | SHA1 | Date | |
|---|---|---|---|
| 123f9c1e4a | |||
| cd2e5efc95 | |||
| a663315013 | |||
| 6236884195 | |||
| cff3e7bfc6 |
@ -1201,7 +1201,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/libmpdclient/output",
|
"$(PROJECT_DIR)/libmpdclient/output",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = "0.15.2-alpha";
|
MARKETING_VERSION = "0.16.0-prealpha";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = me.danbarber.Persephone;
|
PRODUCT_BUNDLE_IDENTIFIER = me.danbarber.Persephone;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
@ -1233,7 +1233,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/libmpdclient/output",
|
"$(PROJECT_DIR)/libmpdclient/output",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = "0.15.2-alpha";
|
MARKETING_VERSION = "0.16.0-prealpha";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = me.danbarber.Persephone;
|
PRODUCT_BUNDLE_IDENTIFIER = me.danbarber.Persephone;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
|||||||
@ -71,7 +71,34 @@ class AlbumViewItem: NSCollectionViewItem {
|
|||||||
.processor(DownsamplingImageProcessor(size: .albumListCoverSize)),
|
.processor(DownsamplingImageProcessor(size: .albumListCoverSize)),
|
||||||
.scaleFactor(2),
|
.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) {
|
func setAppearance(selected isSelected: Bool) {
|
||||||
|
|||||||
@ -145,19 +145,6 @@ class AlbumDetailView: NSViewController {
|
|||||||
.scaleFactor(2),
|
.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() {
|
func setAppearance() {
|
||||||
|
|||||||
@ -154,6 +154,7 @@ extension MPDClient {
|
|||||||
|
|
||||||
self.idle(forceIdle)
|
self.idle(forceIdle)
|
||||||
}
|
}
|
||||||
|
|
||||||
commandOperation.queuePriority = priority
|
commandOperation.queuePriority = priority
|
||||||
commandQueue.addOperation(commandOperation)
|
commandQueue.addOperation(commandOperation)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,14 +42,16 @@ extension MPDClient {
|
|||||||
|
|
||||||
func handleIdleResult(_ result: mpd_idle) {
|
func handleIdleResult(_ result: mpd_idle) {
|
||||||
let mpdIdle = MPDIdle(rawValue: result.rawValue)
|
let mpdIdle = MPDIdle(rawValue: result.rawValue)
|
||||||
|
let wasIdle: Bool
|
||||||
|
|
||||||
do {
|
do {
|
||||||
idleLock.lock()
|
idleLock.lock()
|
||||||
defer { idleLock.unlock() }
|
defer { idleLock.unlock() }
|
||||||
|
wasIdle = isIdle
|
||||||
if isIdle {
|
|
||||||
isIdle = false
|
isIdle = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if wasIdle {
|
||||||
if mpdIdle.contains(.database) {
|
if mpdIdle.contains(.database) {
|
||||||
self.fetchAllAlbums()
|
self.fetchAllAlbums()
|
||||||
}
|
}
|
||||||
@ -79,11 +81,9 @@ extension MPDClient {
|
|||||||
self.delegate?.didFinishDatabaseUpdate(mpdClient: self)
|
self.delegate?.didFinishDatabaseUpdate(mpdClient: self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !mpdIdle.isEmpty {
|
if !mpdIdle.isEmpty {
|
||||||
self.idle()
|
self.idle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -19,27 +19,51 @@ extension MPDClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func playTrack(at queuePos: Int) {
|
func playTrack(at queuePos: Int) {
|
||||||
enqueueCommand(command: .playTrack, userData: ["queuePos": queuePos])
|
enqueueCommand(
|
||||||
|
command: .playTrack,
|
||||||
|
forceIdle: true,
|
||||||
|
userData: ["queuePos": queuePos]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendSong(_ song: MPDSong) {
|
func appendSong(_ song: MPDSong) {
|
||||||
enqueueCommand(command: .appendSong, userData: ["song": song])
|
enqueueCommand(
|
||||||
|
command: .appendSong,
|
||||||
|
forceIdle: true,
|
||||||
|
userData: ["song": song]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeSong(at queuePos: Int) {
|
func removeSong(at queuePos: Int) {
|
||||||
enqueueCommand(command: .removeSong, userData: ["queuePos": queuePos])
|
enqueueCommand(
|
||||||
|
command: .removeSong,
|
||||||
|
forceIdle: true,
|
||||||
|
userData: ["queuePos": queuePos]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func moveSongInQueue(at queuePos: Int, to newQueuePos: Int) {
|
func moveSongInQueue(at queuePos: Int, to newQueuePos: Int) {
|
||||||
enqueueCommand(command: .moveSongInQueue, userData: ["oldQueuePos": queuePos, "newQueuePos": newQueuePos])
|
enqueueCommand(
|
||||||
|
command: .moveSongInQueue,
|
||||||
|
forceIdle: true,
|
||||||
|
userData: ["oldQueuePos": queuePos, "newQueuePos": newQueuePos]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func addSongToQueue(songUri: String, at queuePos: Int) {
|
func addSongToQueue(songUri: String, at queuePos: Int) {
|
||||||
enqueueCommand(command: .addSongToQueue, userData: ["uri": songUri, "queuePos": queuePos])
|
enqueueCommand(
|
||||||
|
command: .addSongToQueue,
|
||||||
|
forceIdle: true,
|
||||||
|
userData: ["uri": songUri, "queuePos": queuePos]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func addAlbumToQueue(album: MPDAlbum, at queuePos: Int) {
|
func addAlbumToQueue(album: MPDAlbum, at queuePos: Int) {
|
||||||
enqueueCommand(command: .addAlbumToQueue, userData: ["album": album, "queuePos": queuePos])
|
enqueueCommand(
|
||||||
|
command: .addAlbumToQueue,
|
||||||
|
forceIdle: true,
|
||||||
|
userData: ["album": album, "queuePos": queuePos]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendPlayTrack(at queuePos: Int) {
|
func sendPlayTrack(at queuePos: Int) {
|
||||||
|
|||||||
@ -18,6 +18,7 @@ extension MPDClient {
|
|||||||
) {
|
) {
|
||||||
enqueueCommand(
|
enqueueCommand(
|
||||||
command: .fetchAlbumArt,
|
command: .fetchAlbumArt,
|
||||||
|
priority: .low,
|
||||||
userData: [
|
userData: [
|
||||||
"songUri": songUri,
|
"songUri": songUri,
|
||||||
"callback": callback,
|
"callback": callback,
|
||||||
|
|||||||
@ -11,25 +11,41 @@ import mpdclient
|
|||||||
|
|
||||||
extension MPDClient {
|
extension MPDClient {
|
||||||
func playPause() {
|
func playPause() {
|
||||||
enqueueCommand(command: .playPause, priority: .veryHigh, forceIdle: true)
|
enqueueCommand(
|
||||||
|
command: .playPause,
|
||||||
|
priority: .high,
|
||||||
|
forceIdle: true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func stop() {
|
func stop() {
|
||||||
enqueueCommand(command: .stop, priority: .veryHigh, forceIdle: true)
|
enqueueCommand(
|
||||||
|
command: .stop,
|
||||||
|
priority: .high,
|
||||||
|
forceIdle: true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func prevTrack() {
|
func prevTrack() {
|
||||||
enqueueCommand(command: .prevTrack, priority: .veryHigh, forceIdle: true)
|
enqueueCommand(
|
||||||
|
command: .prevTrack,
|
||||||
|
priority: .high,
|
||||||
|
forceIdle: true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func nextTrack() {
|
func nextTrack() {
|
||||||
enqueueCommand(command: .nextTrack, priority: .veryHigh, forceIdle: true)
|
enqueueCommand(
|
||||||
|
command: .nextTrack,
|
||||||
|
priority: .high,
|
||||||
|
forceIdle: true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func seekCurrentSong(timeInSeconds: Float) {
|
func seekCurrentSong(timeInSeconds: Float) {
|
||||||
enqueueCommand(
|
enqueueCommand(
|
||||||
command: .seekCurrentSong,
|
command: .seekCurrentSong,
|
||||||
priority: .veryHigh,
|
priority: .high,
|
||||||
forceIdle: true,
|
forceIdle: true,
|
||||||
userData: ["timeInSeconds": timeInSeconds]
|
userData: ["timeInSeconds": timeInSeconds]
|
||||||
)
|
)
|
||||||
@ -38,7 +54,7 @@ extension MPDClient {
|
|||||||
func setShuffleState(shuffleState: Bool) {
|
func setShuffleState(shuffleState: Bool) {
|
||||||
enqueueCommand(
|
enqueueCommand(
|
||||||
command: .setShuffleState,
|
command: .setShuffleState,
|
||||||
priority: .veryHigh,
|
priority: .high,
|
||||||
forceIdle: true,
|
forceIdle: true,
|
||||||
userData: ["shuffleState": shuffleState]
|
userData: ["shuffleState": shuffleState]
|
||||||
)
|
)
|
||||||
@ -47,7 +63,7 @@ extension MPDClient {
|
|||||||
func setRepeatState(repeatState: Bool) {
|
func setRepeatState(repeatState: Bool) {
|
||||||
enqueueCommand(
|
enqueueCommand(
|
||||||
command: .setRepeatState,
|
command: .setRepeatState,
|
||||||
priority: .veryHigh,
|
priority: .high,
|
||||||
forceIdle: true,
|
forceIdle: true,
|
||||||
userData: ["repeatState": repeatState]
|
userData: ["repeatState": repeatState]
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user