mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Compare commits
4 Commits
11d49a0351
...
16584b82ed
| Author | SHA1 | Date | |
|---|---|---|---|
| 16584b82ed | |||
| 837dc979c7 | |||
| eeed671156 | |||
| 472a1b227c |
@ -104,6 +104,7 @@
|
|||||||
E4C8B53C22342005009A20F3 /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */; };
|
E4C8B53C22342005009A20F3 /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */; };
|
||||||
E4C8B53E22349002009A20F3 /* MPDIdle.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53D22349002009A20F3 /* MPDIdle.swift */; };
|
E4C8B53E22349002009A20F3 /* MPDIdle.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53D22349002009A20F3 /* MPDIdle.swift */; };
|
||||||
E4D3BFA622B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */; };
|
E4D3BFA622B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */; };
|
||||||
|
E4DA820623D6236200C1EE58 /* NSSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4DA820523D6236200C1EE58 /* NSSize.swift */; };
|
||||||
E4E7A6AD22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E7A6AC22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift */; };
|
E4E7A6AD22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E7A6AC22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift */; };
|
||||||
E4E8CC902204EC7F0024217A /* Delegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E8CC8F2204EC7F0024217A /* Delegate.swift */; };
|
E4E8CC902204EC7F0024217A /* Delegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E8CC8F2204EC7F0024217A /* Delegate.swift */; };
|
||||||
E4E8CC922204F4B80024217A /* QueueViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E8CC912204F4B80024217A /* QueueViewController.swift */; };
|
E4E8CC922204F4B80024217A /* QueueViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E8CC912204F4B80024217A /* QueueViewController.swift */; };
|
||||||
@ -297,6 +298,7 @@
|
|||||||
E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesWindowController.swift; sourceTree = "<group>"; };
|
E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesWindowController.swift; sourceTree = "<group>"; };
|
||||||
E4C8B53D22349002009A20F3 /* MPDIdle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDIdle.swift; sourceTree = "<group>"; };
|
E4C8B53D22349002009A20F3 /* MPDIdle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDIdle.swift; sourceTree = "<group>"; };
|
||||||
E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "QueueViewController+NSOutlineViewDelegate.swift"; sourceTree = "<group>"; };
|
E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "QueueViewController+NSOutlineViewDelegate.swift"; sourceTree = "<group>"; };
|
||||||
|
E4DA820523D6236200C1EE58 /* NSSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSSize.swift; sourceTree = "<group>"; };
|
||||||
E4E7A6AC22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AlbumDetailView+NSTableViewDelegate.swift"; sourceTree = "<group>"; };
|
E4E7A6AC22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AlbumDetailView+NSTableViewDelegate.swift"; sourceTree = "<group>"; };
|
||||||
E4E8CC8F2204EC7F0024217A /* Delegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Delegate.swift; sourceTree = "<group>"; };
|
E4E8CC8F2204EC7F0024217A /* Delegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Delegate.swift; sourceTree = "<group>"; };
|
||||||
E4E8CC912204F4B80024217A /* QueueViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueViewController.swift; sourceTree = "<group>"; };
|
E4E8CC912204F4B80024217A /* QueueViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueViewController.swift; sourceTree = "<group>"; };
|
||||||
@ -424,6 +426,7 @@
|
|||||||
E489E39822B85D0400CA8CBD /* NSPasteboard.swift */,
|
E489E39822B85D0400CA8CBD /* NSPasteboard.swift */,
|
||||||
E489E39C22B9CF0000CA8CBD /* NSView.swift */,
|
E489E39C22B9CF0000CA8CBD /* NSView.swift */,
|
||||||
E43AC1F022C68E6A001E483C /* NSPasteboardItem.swift */,
|
E43AC1F022C68E6A001E483C /* NSPasteboardItem.swift */,
|
||||||
|
E4DA820523D6236200C1EE58 /* NSSize.swift */,
|
||||||
);
|
);
|
||||||
path = Extensions;
|
path = Extensions;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -940,6 +943,7 @@
|
|||||||
E43B67AD229194CD007DCF55 /* AlbumTracksDataSource.swift in Sources */,
|
E43B67AD229194CD007DCF55 /* AlbumTracksDataSource.swift in Sources */,
|
||||||
E41E52FD223BF87300173814 /* MPDClient+Connection.swift in Sources */,
|
E41E52FD223BF87300173814 /* MPDClient+Connection.swift in Sources */,
|
||||||
E450AD7E222620A10091BED3 /* Album.swift in Sources */,
|
E450AD7E222620A10091BED3 /* Album.swift in Sources */,
|
||||||
|
E4DA820623D6236200C1EE58 /* NSSize.swift in Sources */,
|
||||||
E408D3B6220DD8970006D9BE /* Notification.swift in Sources */,
|
E408D3B6220DD8970006D9BE /* Notification.swift in Sources */,
|
||||||
E43AC1F822C7065A001E483C /* AlbumCoverButton.swift in Sources */,
|
E43AC1F822C7065A001E483C /* AlbumCoverButton.swift in Sources */,
|
||||||
E45962C62241A78500FC1A1E /* MPDCommand.swift in Sources */,
|
E45962C62241A78500FC1A1E /* MPDCommand.swift in Sources */,
|
||||||
|
|||||||
@ -32,16 +32,9 @@ class AppDelegate: NSObject,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instantiateControllers()
|
|
||||||
connectToMPDServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
func connectToMPDServer() {
|
|
||||||
App.mpdServerController.connect()
|
|
||||||
}
|
|
||||||
|
|
||||||
func instantiateControllers() {
|
|
||||||
_ = App.userNotificationsController
|
_ = App.userNotificationsController
|
||||||
|
|
||||||
|
App.mpdServerController.connect()
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationWillTerminate(_ aNotification: Notification) {
|
func applicationWillTerminate(_ aNotification: Notification) {
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class AlbumViewItem: NSCollectionViewItem {
|
|||||||
with: .provider(provider),
|
with: .provider(provider),
|
||||||
placeholder: NSImage.defaultCoverArt,
|
placeholder: NSImage.defaultCoverArt,
|
||||||
options: [
|
options: [
|
||||||
.processor(DownsamplingImageProcessor(size: NSSize(width: 180, height: 180))),
|
.processor(DownsamplingImageProcessor(size: .albumListCoverSize)),
|
||||||
.scaleFactor(2),
|
.scaleFactor(2),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@ -141,7 +141,7 @@ class AlbumDetailView: NSViewController {
|
|||||||
with: .provider(provider),
|
with: .provider(provider),
|
||||||
placeholder: NSImage.defaultCoverArt,
|
placeholder: NSImage.defaultCoverArt,
|
||||||
options: [
|
options: [
|
||||||
.processor(DownsamplingImageProcessor(size: NSSize(width: 500, height: 500))),
|
.processor(DownsamplingImageProcessor(size: .albumDetailCoverSize)),
|
||||||
.scaleFactor(2),
|
.scaleFactor(2),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@ -24,11 +24,11 @@ class CurrentCoverArtView: NSImageView {
|
|||||||
|
|
||||||
let imageURL = URL(fileURLWithPath: imagePath)
|
let imageURL = URL(fileURLWithPath: imagePath)
|
||||||
let provider = LocalFileImageDataProvider(fileURL: imageURL)
|
let provider = LocalFileImageDataProvider(fileURL: imageURL)
|
||||||
self.kf.setImage(
|
kf.setImage(
|
||||||
with: .provider(provider),
|
with: .provider(provider),
|
||||||
placeholder: NSImage.defaultCoverArt,
|
placeholder: NSImage.defaultCoverArt,
|
||||||
options: [
|
options: [
|
||||||
.processor(DownsamplingImageProcessor(size: NSSize(width: 500, height: 500))),
|
.processor(DownsamplingImageProcessor(size: .currentlyPlayingCoverSize)),
|
||||||
.scaleFactor(2),
|
.scaleFactor(2),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -39,10 +39,11 @@ extension CurrentCoverArtView: StoreSubscriber {
|
|||||||
typealias StoreSubscriberStateType = Song?
|
typealias StoreSubscriberStateType = Song?
|
||||||
|
|
||||||
func newState(state: Song?) {
|
func newState(state: Song?) {
|
||||||
if let song = state {
|
guard let song = state else {
|
||||||
setAlbumImage(song.album)
|
|
||||||
} else {
|
|
||||||
image = .defaultCoverArt
|
image = .defaultCoverArt
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setAlbumImage(song.album)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
Persephone/Components/Shared/Extensions/NSSize.swift
Normal file
16
Persephone/Components/Shared/Extensions/NSSize.swift
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// NSSize.swift
|
||||||
|
// Persephone
|
||||||
|
//
|
||||||
|
// Created by Daniel Barber on 1/20/20.
|
||||||
|
// Copyright © 2020 Dan Barber. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import AppKit
|
||||||
|
|
||||||
|
extension NSSize {
|
||||||
|
static let albumListCoverSize = NSSize(width: 180, height: 180)
|
||||||
|
static let albumDetailCoverSize = NSSize(width: 500, height: 500)
|
||||||
|
static let currentlyPlayingCoverSize = albumDetailCoverSize
|
||||||
|
static let notificationCoverSize = albumListCoverSize
|
||||||
|
}
|
||||||
@ -29,7 +29,7 @@ class UserNotificationsController {
|
|||||||
_ = KingfisherManager.shared.retrieveImage(
|
_ = KingfisherManager.shared.retrieveImage(
|
||||||
with: .provider(provider),
|
with: .provider(provider),
|
||||||
options: [
|
options: [
|
||||||
.processor(DownsamplingImageProcessor(size: NSSize(width: 180, height: 180))),
|
.processor(DownsamplingImageProcessor(size: .notificationCoverSize)),
|
||||||
.scaleFactor(2),
|
.scaleFactor(2),
|
||||||
]
|
]
|
||||||
) { result in
|
) { result in
|
||||||
|
|||||||
@ -16,9 +16,9 @@ extension MPDClient {
|
|||||||
var path: String?
|
var path: String?
|
||||||
|
|
||||||
static func == (lhs: MPDAlbum, rhs: MPDAlbum) -> Bool {
|
static func == (lhs: MPDAlbum, rhs: MPDAlbum) -> Bool {
|
||||||
return (lhs.title == rhs.title) &&
|
return lhs.title == rhs.title &&
|
||||||
(lhs.artist == rhs.artist) &&
|
lhs.artist == rhs.artist &&
|
||||||
(lhs.date == rhs.date)
|
lhs.date == rhs.date
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,10 +55,8 @@ extension MPDClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var path: String {
|
var path: String {
|
||||||
return uriString
|
return NSString(string: uriString)
|
||||||
.split(separator: "/")
|
.deletingLastPathComponent
|
||||||
.dropLast()
|
|
||||||
.joined(separator: "/")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTag(_ tagType: MPDTag) -> String {
|
func getTag(_ tagType: MPDTag) -> String {
|
||||||
|
|||||||
@ -59,6 +59,6 @@ struct Album {
|
|||||||
|
|
||||||
extension Album: Equatable {
|
extension Album: Equatable {
|
||||||
static func == (lhs: Album, rhs: Album) -> Bool {
|
static func == (lhs: Album, rhs: Album) -> Bool {
|
||||||
return (lhs.mpdAlbum == rhs.mpdAlbum)
|
return lhs.mpdAlbum == rhs.mpdAlbum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,6 @@ struct Artist {
|
|||||||
|
|
||||||
extension Artist: Equatable {
|
extension Artist: Equatable {
|
||||||
static func == (lhs: Artist, rhs: Artist) -> Bool {
|
static func == (lhs: Artist, rhs: Artist) -> Bool {
|
||||||
return (lhs.name == rhs.name)
|
return lhs.name == rhs.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ struct MPDServer {
|
|||||||
|
|
||||||
extension MPDServer: Equatable {
|
extension MPDServer: Equatable {
|
||||||
static func == (lhs: MPDServer, rhs: MPDServer) -> Bool {
|
static func == (lhs: MPDServer, rhs: MPDServer) -> Bool {
|
||||||
return (lhs.host == rhs.host) &&
|
return lhs.host == rhs.host &&
|
||||||
(lhs.port == rhs.port)
|
lhs.port == rhs.port
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user