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

Compare commits

..

8 Commits

Author SHA1 Message Date
11d49a0351 We don't need self here 2020-01-17 18:03:05 -05:00
d445ea197d
✂️ stray space
Co-Authored-By: louis-antonopoulos <louis@thoughtbot.com>
2020-01-17 17:56:38 -05:00
ee1262376f ✂️ 2020-01-17 17:50:19 -05:00
9702a15052 Something something storyboard editor 2020-01-17 17:49:02 -05:00
87110cae0f We can simplify this 2020-01-17 17:48:35 -05:00
fd51fa7356 We don't need this at the moment 2020-01-17 17:48:12 -05:00
c364deb24c Clear search field on disconnect 2020-01-17 14:35:47 -05:00
3b68577b93 Fix connection bug
TODO: We really should do something better about informing the user of
connection errors and the like.
2020-01-17 14:11:33 -05:00
5 changed files with 29 additions and 17 deletions

View File

@ -11,8 +11,6 @@ import ReSwift
import Kingfisher import Kingfisher
class UserNotificationsController { class UserNotificationsController {
let cache = ImageCache.default
init() { init() {
App.store.subscribe(self) { App.store.subscribe(self) {
$0.select { $0.playerState.currentSong } $0.select { $0.playerState.currentSong }

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS"> <document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14868"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15702"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
@ -339,6 +339,7 @@
<connections> <connections>
<outlet property="databaseUpdatingIndicator" destination="LpV-iM-o6t" id="y0T-eR-ygY"/> <outlet property="databaseUpdatingIndicator" destination="LpV-iM-o6t" id="y0T-eR-ygY"/>
<outlet property="repeatState" destination="OqH-lV-sAg" id="DPC-Ff-Srr"/> <outlet property="repeatState" destination="OqH-lV-sAg" id="DPC-Ff-Srr"/>
<outlet property="searchQuery" destination="xfU-Xe-eno" id="d8u-sH-13V"/>
<outlet property="shuffleState" destination="E8L-uK-XT0" id="dCF-hm-dBs"/> <outlet property="shuffleState" destination="E8L-uK-XT0" id="dCF-hm-dBs"/>
<outlet property="trackProgress" destination="kx6-xm-TAN" id="XDv-Th-Agj"/> <outlet property="trackProgress" destination="kx6-xm-TAN" id="XDv-Th-Agj"/>
<outlet property="trackProgressBar" destination="KMy-xf-rmN" id="a67-JU-cyQ"/> <outlet property="trackProgressBar" destination="KMy-xf-rmN" id="a67-JU-cyQ"/>
@ -408,7 +409,7 @@
<tabView key="tabView" type="noTabsNoBorder" id="6dC-M0-oC5"> <tabView key="tabView" type="noTabsNoBorder" id="6dC-M0-oC5">
<rect key="frame" x="0.0" y="0.0" width="418" height="300"/> <rect key="frame" x="0.0" y="0.0" width="418" height="300"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<font key="font" metaFont="message"/> <font key="font" metaFont="system"/>
<connections> <connections>
<outlet property="delegate" destination="zhe-qh-Mal" id="LUL-qN-JlP"/> <outlet property="delegate" destination="zhe-qh-Mal" id="LUL-qN-JlP"/>
</connections> </connections>
@ -646,26 +647,26 @@
<objects> <objects>
<viewController id="KIP-rq-4dM" customClass="QueueViewController" customModule="Persephone" customModuleProvider="target" sceneMemberID="viewController"> <viewController id="KIP-rq-4dM" customClass="QueueViewController" customModule="Persephone" customModuleProvider="target" sceneMemberID="viewController">
<splitView key="view" dividerStyle="thin" id="84I-w3-Mxl"> <splitView key="view" dividerStyle="thin" id="84I-w3-Mxl">
<rect key="frame" x="0.0" y="0.0" width="328" height="548"/> <rect key="frame" x="0.0" y="0.0" width="328" height="547"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews> <subviews>
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="17" horizontalPageScroll="10" verticalLineScroll="17" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="S3o-nF-NN7"> <scrollView misplaced="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="17" horizontalPageScroll="10" verticalLineScroll="17" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="S3o-nF-NN7">
<rect key="frame" x="0.0" y="0.0" width="328" height="219"/> <rect key="frame" x="0.0" y="0.0" width="328" height="219"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<clipView key="contentView" drawsBackground="NO" id="WI8-Pw-03L"> <clipView key="contentView" drawsBackground="NO" id="WI8-Pw-03L">
<rect key="frame" x="0.0" y="0.0" width="328" height="219"/> <rect key="frame" x="0.0" y="0.0" width="328" height="219"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="14" outlineTableColumn="0Co-uF-CCB" id="jEJ-jg-fll" customClass="QueueView" customModule="Persephone" customModuleProvider="target"> <outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="14" outlineTableColumn="0Co-uF-CCB" id="jEJ-jg-fll" customClass="QueueView" customModule="Persephone" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="328" height="219"/> <rect key="frame" x="0.0" y="0.0" width="328" height="219"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="0.0"/> <size key="intercellSpacing" width="3" height="0.0"/>
<color key="backgroundColor" name="_sourceListBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="_sourceListBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/> <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns> <tableColumns>
<tableColumn identifier="songTitleColumn" width="200" minWidth="128" maxWidth="1000" id="0Co-uF-CCB"> <tableColumn identifier="songTitleColumn" width="200" minWidth="128" maxWidth="1000" id="0Co-uF-CCB">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Title"> <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Title">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="message" size="11"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell> </tableHeaderCell>
@ -746,7 +747,7 @@
</tableColumn> </tableColumn>
<tableColumn identifier="songArtistColumn" width="122" minWidth="64" maxWidth="1000" id="SPM-QP-DX8"> <tableColumn identifier="songArtistColumn" width="122" minWidth="64" maxWidth="1000" id="SPM-QP-DX8">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Artist"> <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Artist">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="message" size="11"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell> </tableHeaderCell>
@ -804,8 +805,8 @@
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
</scroller> </scroller>
</scrollView> </scrollView>
<customView id="iUb-eV-Qws"> <customView misplaced="YES" id="iUb-eV-Qws">
<rect key="frame" x="0.0" y="220" width="328" height="328"/> <rect key="frame" x="0.0" y="220" width="328" height="327"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Dw3-M5-tWY" customClass="CurrentCoverArtView" customModule="Persephone" customModuleProvider="target"> <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Dw3-M5-tWY" customClass="CurrentCoverArtView" customModule="Persephone" customModuleProvider="target">

View File

@ -27,6 +27,8 @@ class WindowController: NSWindowController {
@IBOutlet var shuffleState: NSButton! @IBOutlet var shuffleState: NSButton!
@IBOutlet var repeatState: NSButton! @IBOutlet var repeatState: NSButton!
@IBOutlet weak var searchQuery: NSSearchField!
override func windowDidLoad() { override func windowDidLoad() {
super.windowDidLoad() super.windowDidLoad()
window?.titleVisibility = .hidden window?.titleVisibility = .hidden
@ -39,6 +41,8 @@ class WindowController: NSWindowController {
} }
App.store.dispatch(MainWindowDidOpenAction()) App.store.dispatch(MainWindowDidOpenAction())
NotificationCenter.default.addObserver(self, selector: #selector(willDisconnect), name: .willDisconnect, object: nil)
trackProgress.font = .timerFont trackProgress.font = .timerFont
trackRemaining.font = .timerFont trackRemaining.font = .timerFont
@ -116,6 +120,13 @@ class WindowController: NSWindowController {
trackRemaining.stringValue = time.formattedTime trackRemaining.stringValue = time.formattedTime
} }
@objc func willDisconnect() {
DispatchQueue.main.async {
App.store.dispatch(SetSearchQuery(searchQuery: ""))
self.searchQuery.stringValue = ""
}
}
// TODO: Refactor this using a gesture recognizer // TODO: Refactor this using a gesture recognizer
@IBAction func changeTrackProgress(_ sender: NSSlider) { @IBAction func changeTrackProgress(_ sender: NSSlider) {

View File

@ -23,8 +23,8 @@ extension MPDClient {
self.connection = connection self.connection = connection
self.status = MPDStatus(status) self.status = MPDStatus(status)
self.delegate?.didConnect(mpdClient: self) delegate?.didConnect(mpdClient: self)
self.delegate?.didUpdateStatus(mpdClient: self, status: self.status!) delegate?.didUpdateStatus(mpdClient: self, status: self.status!)
} }
func freeConnection() { func freeConnection() {
@ -40,7 +40,9 @@ extension MPDClient {
let commandOperation = BlockOperation() { [unowned self] in let commandOperation = BlockOperation() { [unowned self] in
self.sendCommand(command: .connect, userData: ["host": host, "port": port]) self.sendCommand(command: .connect, userData: ["host": host, "port": port])
self.idle() if self.isConnected {
self.idle()
}
} }
commandQueue.addOperation(commandOperation) commandQueue.addOperation(commandOperation)
} }

View File

@ -37,7 +37,7 @@ struct Album {
return [ return [
"cover.jpg", "cover.jpg",
"folder.jpg", "folder.jpg",
"\(artist) - \(title ).jpg", "\(artist) - \(title).jpg",
"cover.png", "cover.png",
"folder.png", "folder.png",
"\(artist) - \(title ).png", "\(artist) - \(title ).png",