mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Compare commits
No commits in common. "9e5e0e38e52348d6c4ac415bf9c6c33ce26722a8" and "e2ce88e67e128987bd70c6fa441d3865da51ae07" have entirely different histories.
9e5e0e38e5
...
e2ce88e67e
@ -46,7 +46,8 @@ class AlbumViewController: NSViewController,
|
||||
guard let albumItem = item as? AlbumItem else { return item }
|
||||
|
||||
albumItem.view.wantsLayer = true
|
||||
albumItem.setAlbum(albums[indexPath.item])
|
||||
albumItem.setAlbumTitle(albums[indexPath.item].title)
|
||||
albumItem.setAlbumArtist(albums[indexPath.item].artist)
|
||||
|
||||
return albumItem
|
||||
}
|
||||
|
||||
@ -182,18 +182,19 @@ class MPDClient {
|
||||
mpd_search_add_group_tag(self.connection, MPD_TAG_ALBUM_ARTIST)
|
||||
mpd_search_commit(self.connection)
|
||||
while let mpdPair = mpd_recv_pair(self.connection) {
|
||||
let pair = Pair(mpdPair)
|
||||
let name = String(cString: mpdPair.pointee.name)
|
||||
let value = String(cString: mpdPair.pointee.value)
|
||||
|
||||
switch pair.name {
|
||||
switch name {
|
||||
case "AlbumArtist":
|
||||
artist = pair.value
|
||||
artist = value
|
||||
case "Album":
|
||||
albums.append(Album(title: pair.value, artist: artist))
|
||||
albums.append(Album(title: value, artist: artist))
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
mpd_return_pair(self.connection, pair.mpdPair)
|
||||
|
||||
mpd_return_pair(self.connection, mpdPair)
|
||||
}
|
||||
|
||||
delegate?.didLoadAlbums(mpdClient: self, albums: albums)
|
||||
|
||||
@ -15,12 +15,4 @@ class Pair {
|
||||
init(_ mpdPair: UnsafeMutablePointer<mpd_pair>) {
|
||||
self.mpdPair = mpdPair
|
||||
}
|
||||
|
||||
var name: String {
|
||||
get { return String(cString: mpdPair.pointee.name) }
|
||||
}
|
||||
|
||||
var value: String {
|
||||
get { return String(cString: mpdPair.pointee.value) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,9 +14,12 @@ class AlbumItem: NSCollectionViewItem {
|
||||
// Do view setup here.
|
||||
}
|
||||
|
||||
func setAlbum(_ album: MPDClient.Album) {
|
||||
albumTitle.stringValue = album.title
|
||||
albumArtist.stringValue = album.artist
|
||||
func setAlbumTitle(_ title: String) {
|
||||
albumTitle.stringValue = title
|
||||
}
|
||||
|
||||
func setAlbumArtist(_ artist: String) {
|
||||
albumArtist.stringValue = artist
|
||||
}
|
||||
|
||||
@IBOutlet var albumTitle: NSTextField!
|
||||
|
||||
@ -16,43 +16,41 @@
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customView id="Hz6-mo-xeY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="160" height="207"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="206" height="248"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<imageView identifier="albumArtwork" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Kfb-8f-ean">
|
||||
<rect key="frame" x="0.0" y="45" width="160" height="162"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="blankAlbum" id="FsA-JX-BFh"/>
|
||||
</imageView>
|
||||
<textField identifier="albumTitle" horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="206" translatesAutoresizingMaskIntoConstraints="NO" id="KEh-NL-c2W">
|
||||
<rect key="frame" x="-2" y="20" width="164" height="17"/>
|
||||
<textField identifier="albumTitle" horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" preferredMaxLayoutWidth="206" translatesAutoresizingMaskIntoConstraints="NO" id="KEh-NL-c2W">
|
||||
<rect key="frame" x="-2" y="20" width="210" height="17"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="pDs-0t-e1j">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField identifier="albumArtist" horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="206" translatesAutoresizingMaskIntoConstraints="NO" id="5Uu-j1-qyT">
|
||||
<rect key="frame" x="-2" y="0.0" width="164" height="17"/>
|
||||
<textField identifier="albumArtist" horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" preferredMaxLayoutWidth="206" translatesAutoresizingMaskIntoConstraints="NO" id="5Uu-j1-qyT">
|
||||
<rect key="frame" x="-2" y="0.0" width="210" height="17"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="yZn-e9-zyP">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<imageView identifier="albumArtwork" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Kfb-8f-ean">
|
||||
<rect key="frame" x="0.0" y="42" width="206" height="206"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="blankAlbum" id="FsA-JX-BFh"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="5Uu-j1-qyT" firstAttribute="trailing" secondItem="KEh-NL-c2W" secondAttribute="trailing" id="64z-uz-4nY"/>
|
||||
<constraint firstAttribute="bottom" secondItem="KEh-NL-c2W" secondAttribute="bottom" constant="20" symbolic="YES" id="8Kg-1r-wNp"/>
|
||||
<constraint firstItem="KEh-NL-c2W" firstAttribute="leading" secondItem="5Uu-j1-qyT" secondAttribute="leading" id="Iji-NN-ju3"/>
|
||||
<constraint firstItem="Kfb-8f-ean" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="JMi-4i-dgs"/>
|
||||
<constraint firstItem="KEh-NL-c2W" firstAttribute="top" secondItem="Kfb-8f-ean" secondAttribute="bottom" constant="5" id="Jdb-sY-lnB"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Kfb-8f-ean" secondAttribute="trailing" id="KQC-Wz-Bsg"/>
|
||||
<constraint firstItem="5Uu-j1-qyT" firstAttribute="leading" secondItem="KEh-NL-c2W" secondAttribute="leading" id="MUo-0i-fX9"/>
|
||||
<constraint firstItem="Kfb-8f-ean" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="Qbk-jx-zAi"/>
|
||||
<constraint firstItem="KEh-NL-c2W" firstAttribute="trailing" secondItem="Kfb-8f-ean" secondAttribute="trailing" id="U0w-G4-ggX"/>
|
||||
<constraint firstItem="KEh-NL-c2W" firstAttribute="leading" secondItem="Kfb-8f-ean" secondAttribute="leading" id="V8r-Rc-Dx7"/>
|
||||
<constraint firstItem="KEh-NL-c2W" firstAttribute="top" secondItem="Kfb-8f-ean" secondAttribute="bottom" constant="8" symbolic="YES" id="XFx-sv-dpF"/>
|
||||
<constraint firstAttribute="bottom" secondItem="5Uu-j1-qyT" secondAttribute="bottom" id="gci-4h-pDZ"/>
|
||||
<constraint firstItem="Kfb-8f-ean" firstAttribute="leading" secondItem="KEh-NL-c2W" secondAttribute="leading" id="diY-bi-0Yg"/>
|
||||
<constraint firstAttribute="bottom" secondItem="5Uu-j1-qyT" secondAttribute="bottom" id="puG-ym-5hh"/>
|
||||
<constraint firstAttribute="bottom" secondItem="KEh-NL-c2W" secondAttribute="bottom" constant="20" symbolic="YES" id="yIJ-L1-2c5"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="-22" y="139.5"/>
|
||||
<point key="canvasLocation" x="3" y="142"/>
|
||||
</customView>
|
||||
<collectionViewItem id="Qgu-aI-55A" customClass="AlbumItem" customModule="Persephone" customModuleProvider="target"/>
|
||||
</objects>
|
||||
|
||||
@ -926,7 +926,7 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="450" height="158"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="20" minimumLineSpacing="20" id="K0l-P8-OW0">
|
||||
<size key="itemSize" width="159" height="207"/>
|
||||
<size key="itemSize" width="206" height="248"/>
|
||||
<edgeInsets key="sectionInset" left="40" right="40" top="20" bottom="60"/>
|
||||
</collectionViewFlowLayout>
|
||||
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 73 KiB |
Loading…
Reference in New Issue
Block a user