mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Compare commits
7 Commits
c7ea8f34d0
...
ad7994ce14
| Author | SHA1 | Date | |
|---|---|---|---|
| ad7994ce14 | |||
| c5bb5935e9 | |||
|
|
ab3bd561f2 | ||
|
|
53a9b38a9a | ||
|
|
1fd8e23f64 | ||
|
|
c1181fa283 | ||
|
|
32a4e38bd1 |
@ -0,0 +1,24 @@
|
||||
//
|
||||
// AlbumDetailSongTitleView.swift
|
||||
// Persephone
|
||||
//
|
||||
// Created by Nemo157 on 20200619...
|
||||
// Copyright © 2020 Dan Barber. All rights reserved.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
|
||||
class AlbumDetailSongTitleView: NSTableCellView {
|
||||
@IBOutlet var songTitle: NSTextField!
|
||||
@IBOutlet var songArtist: NSTextField!
|
||||
|
||||
func setShowArtist(_ show: Bool) {
|
||||
songArtist.isHidden = !show
|
||||
}
|
||||
|
||||
func setSong(_ song: Song) {
|
||||
songTitle?.stringValue = song.title
|
||||
songArtist?.stringValue = song.artist
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ extension AlbumDetailView: NSTableViewDelegate {
|
||||
let cellView = tableView.makeView(
|
||||
withIdentifier: .discNumber,
|
||||
owner: self
|
||||
) as! NSTableCellView
|
||||
) as! NSTableCellView
|
||||
|
||||
cellView.textField?.stringValue = "Disc \(disc)"
|
||||
|
||||
@ -70,7 +70,7 @@ extension AlbumDetailView: NSTableViewDelegate {
|
||||
let cellView = tableView.makeView(
|
||||
withIdentifier: .trackNumber,
|
||||
owner: self
|
||||
) as! NSTableCellView
|
||||
) as! NSTableCellView
|
||||
|
||||
cellView.textField?.stringValue = "\(song.trackNumber)."
|
||||
|
||||
@ -81,9 +81,10 @@ extension AlbumDetailView: NSTableViewDelegate {
|
||||
let cellView = tableView.makeView(
|
||||
withIdentifier: .songTitle,
|
||||
owner: self
|
||||
) as! NSTableCellView
|
||||
) as! AlbumDetailSongTitleView
|
||||
|
||||
cellView.textField?.stringValue = song.title
|
||||
cellView.setShowArtist(dataSource.showSongArtist)
|
||||
cellView.setSong(song)
|
||||
|
||||
return cellView
|
||||
}
|
||||
@ -92,7 +93,7 @@ extension AlbumDetailView: NSTableViewDelegate {
|
||||
let cellView = tableView.makeView(
|
||||
withIdentifier: .songDuration,
|
||||
owner: self
|
||||
) as! NSTableCellView
|
||||
) as! NSTableCellView
|
||||
|
||||
cellView.textField?.font = .timerFont
|
||||
cellView.textField?.stringValue = song.duration.formattedTime
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14868" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14868"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097.2"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@ -17,12 +17,12 @@
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customView wantsLayer="YES" id="Hz6-mo-xeY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="823" height="568"/>
|
||||
<customView wantsLayer="YES" misplaced="YES" id="Hz6-mo-xeY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="823" height="567"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="m2v-pR-e9v">
|
||||
<rect key="frame" x="357" y="515" width="448" height="28"/>
|
||||
<rect key="frame" x="357" y="513" width="448" height="28"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="444" id="erC-QS-9hc"/>
|
||||
</constraints>
|
||||
@ -33,7 +33,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4Jx-I5-Nkv">
|
||||
<rect key="frame" x="357" y="488" width="448" height="19"/>
|
||||
<rect key="frame" x="357" y="486" width="448" height="19"/>
|
||||
<textFieldCell key="cell" title="Metadata" id="ztJ-4E-qvI">
|
||||
<font key="font" metaFont="system" size="16"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -41,7 +41,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="FWd-vZ-5CT">
|
||||
<rect key="frame" x="31" y="243" width="300" height="300"/>
|
||||
<rect key="frame" x="31" y="241" width="300" height="300"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="300" id="69o-NQ-qL7"/>
|
||||
<constraint firstAttribute="width" constant="300" id="8XY-bQ-C7X"/>
|
||||
@ -53,22 +53,21 @@
|
||||
</shadow>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="defaultCoverArt" id="scE-kj-gex"/>
|
||||
</imageView>
|
||||
<scrollView horizontalCompressionResistancePriority="250" borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="BOb-Lr-10M">
|
||||
<rect key="frame" x="359" y="33" width="444" height="426"/>
|
||||
<scrollView horizontalCompressionResistancePriority="250" borderType="none" autohidesScrollers="YES" horizontalLineScroll="18" horizontalPageScroll="10" verticalLineScroll="18" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="BOb-Lr-10M">
|
||||
<rect key="frame" x="359" y="33" width="444" height="424"/>
|
||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="9QN-UB-b4l">
|
||||
<rect key="frame" x="0.0" y="0.0" width="444" height="426"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="444" height="424"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="none" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="ehr-qh-87Q" customClass="AlbumDetailSongListView" customModule="Persephone" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="444" height="426"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="none" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="16" rowSizeStyle="automatic" usesAutomaticRowHeights="YES" viewBased="YES" id="ehr-qh-87Q" customClass="AlbumDetailSongListView" customModule="Persephone" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="444" height="424"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
<color key="backgroundColor" red="0.11764705882352941" green="0.11764705882352941" blue="0.11764705882352941" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableColumns>
|
||||
<tableColumn identifier="trackNumberColumn" width="40" minWidth="40" maxWidth="40" id="cwb-jE-CEP">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Track No.">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||
</tableHeaderCell>
|
||||
@ -79,12 +78,11 @@
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="trackNumberCell" id="bVN-zt-KW7">
|
||||
<rect key="frame" x="1" y="1" width="40" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<tableCellView identifier="trackNumberCell" translatesAutoresizingMaskIntoConstraints="NO" id="bVN-zt-KW7">
|
||||
<rect key="frame" x="1" y="1" width="40" height="16"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="6eU-Jx-HDR">
|
||||
<rect key="frame" x="0.0" y="1" width="40" height="16"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="40" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="left" title="1." id="Z5y-oS-Qm8">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -93,20 +91,19 @@
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="6eU-Jx-HDR" firstAttribute="centerY" secondItem="bVN-zt-KW7" secondAttribute="centerY" id="5cb-M0-OIZ"/>
|
||||
<constraint firstItem="6eU-Jx-HDR" firstAttribute="leading" secondItem="bVN-zt-KW7" secondAttribute="leading" constant="2" id="KXb-Ua-LaU"/>
|
||||
<constraint firstItem="6eU-Jx-HDR" firstAttribute="centerX" secondItem="bVN-zt-KW7" secondAttribute="centerX" id="MGU-H7-mAj"/>
|
||||
<constraint firstItem="6eU-Jx-HDR" firstAttribute="top" secondItem="bVN-zt-KW7" secondAttribute="top" id="b71-yc-bdr"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="textField" destination="6eU-Jx-HDR" id="DWy-vj-9Eq"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="discNumberCell" id="MHh-8c-iyL">
|
||||
<rect key="frame" x="1" y="20" width="40" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<tableCellView identifier="discNumberCell" translatesAutoresizingMaskIntoConstraints="NO" id="MHh-8c-iyL">
|
||||
<rect key="frame" x="1" y="19" width="40" height="16"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="nwx-zY-r5o">
|
||||
<rect key="frame" x="0.0" y="1" width="441" height="16"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="441" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="437" id="irN-AG-Pcj"/>
|
||||
</constraints>
|
||||
@ -118,8 +115,9 @@
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="nwx-zY-r5o" firstAttribute="centerY" secondItem="MHh-8c-iyL" secondAttribute="centerY" id="IOV-5t-KTN"/>
|
||||
<constraint firstItem="nwx-zY-r5o" firstAttribute="top" secondItem="MHh-8c-iyL" secondAttribute="top" id="KbM-w9-As3"/>
|
||||
<constraint firstItem="nwx-zY-r5o" firstAttribute="leading" secondItem="MHh-8c-iyL" secondAttribute="leading" constant="2" id="nw0-ya-Pwt"/>
|
||||
<constraint firstAttribute="bottom" secondItem="nwx-zY-r5o" secondAttribute="bottom" id="z6c-sM-3fK"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="textField" destination="nwx-zY-r5o" id="NFl-7o-wmK"/>
|
||||
@ -129,7 +127,6 @@
|
||||
</tableColumn>
|
||||
<tableColumn identifier="trackTitleColumn" width="353" minWidth="40" maxWidth="1000" id="7yp-QQ-EzC">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Song Title">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||
</tableHeaderCell>
|
||||
@ -140,33 +137,60 @@
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="songTitleCell" id="41U-5i-Oot">
|
||||
<rect key="frame" x="44" y="1" width="353" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<tableCellView identifier="songTitleCell" translatesAutoresizingMaskIntoConstraints="NO" id="41U-5i-Oot" customClass="AlbumDetailSongTitleView" customModule="Persephone" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="353" height="31"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="R8t-bV-9LI">
|
||||
<rect key="frame" x="0.0" y="1" width="353" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="left" title="My Song Title" id="Sdi-jJ-EOM">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<stackView distribution="fill" orientation="vertical" alignment="leading" spacing="0.0" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FJy-NN-WaB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="353" height="31"/>
|
||||
<subviews>
|
||||
<textField autoresizesSubviews="NO" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="R8t-bV-9LI">
|
||||
<rect key="frame" x="-2" y="15" width="349" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="left" title="My Song Title" id="Sdi-jJ-EOM">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField autoresizesSubviews="NO" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="tQ2-xw-nh6">
|
||||
<rect key="frame" x="-2" y="0.0" width="349" height="15"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="left" title="Song Artist" id="1XN-kG-CWb">
|
||||
<font key="font" metaFont="cellTitle"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="R8t-bV-9LI" secondAttribute="trailing" constant="8" id="2JM-VY-eK8"/>
|
||||
<constraint firstItem="R8t-bV-9LI" firstAttribute="leading" secondItem="FJy-NN-WaB" secondAttribute="leading" id="6DN-qh-z3m"/>
|
||||
<constraint firstAttribute="trailing" secondItem="tQ2-xw-nh6" secondAttribute="trailing" constant="8" id="ad7-zz-zbp"/>
|
||||
<constraint firstItem="tQ2-xw-nh6" firstAttribute="leading" secondItem="FJy-NN-WaB" secondAttribute="leading" id="n9L-fM-JWy"/>
|
||||
</constraints>
|
||||
<visibilityPriorities>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
</visibilityPriorities>
|
||||
<customSpacing>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
</customSpacing>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="R8t-bV-9LI" firstAttribute="centerX" secondItem="41U-5i-Oot" secondAttribute="centerX" id="0Hz-cI-Y32"/>
|
||||
<constraint firstItem="R8t-bV-9LI" firstAttribute="centerY" secondItem="41U-5i-Oot" secondAttribute="centerY" id="7iv-Qw-o7d"/>
|
||||
<constraint firstItem="R8t-bV-9LI" firstAttribute="leading" secondItem="41U-5i-Oot" secondAttribute="leading" constant="2" id="UzY-kH-q4q"/>
|
||||
<constraint firstAttribute="trailing" secondItem="FJy-NN-WaB" secondAttribute="trailing" id="Cs2-fX-Bfs"/>
|
||||
<constraint firstItem="FJy-NN-WaB" firstAttribute="top" secondItem="41U-5i-Oot" secondAttribute="top" id="N8E-Gq-gHp"/>
|
||||
<constraint firstItem="FJy-NN-WaB" firstAttribute="leading" secondItem="41U-5i-Oot" secondAttribute="leading" id="XZh-lV-rXN"/>
|
||||
<constraint firstAttribute="bottom" secondItem="FJy-NN-WaB" secondAttribute="bottom" id="aLa-by-ri5"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="textField" destination="R8t-bV-9LI" id="b79-el-ZAY"/>
|
||||
<outlet property="songArtist" destination="tQ2-xw-nh6" id="5pJ-77-key"/>
|
||||
<outlet property="songTitle" destination="R8t-bV-9LI" id="9rC-ff-9B9"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="trackDurationColumn" width="42" minWidth="42" maxWidth="42" id="ha5-ff-2az">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Duration">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||
</tableHeaderCell>
|
||||
@ -220,7 +244,7 @@
|
||||
</scroller>
|
||||
</scrollView>
|
||||
<button verticalHuggingPriority="750" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jMU-bv-TNF">
|
||||
<rect key="frame" x="31" y="184" width="119" height="35"/>
|
||||
<rect key="frame" x="31" y="182" width="119" height="35"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="33" id="2uQ-mC-4QY"/>
|
||||
<constraint firstAttribute="width" constant="119" id="h2n-ZB-Ufr"/>
|
||||
|
||||
@ -25,15 +25,24 @@ class AlbumTracksDataSource: NSObject, NSTableViewDataSource {
|
||||
}
|
||||
|
||||
var albumSongs: [AlbumSongItem] = []
|
||||
var showSongArtist: Bool = false
|
||||
|
||||
func setAlbumSongs(_ songs: [Song]) {
|
||||
var disc: String? = ""
|
||||
var albumArtist: String?
|
||||
|
||||
showSongArtist = false
|
||||
songs.forEach { song in
|
||||
if song.disc != disc && song.disc != "0" {
|
||||
disc = song.disc
|
||||
albumSongs.append(AlbumSongItem(disc: song.disc))
|
||||
}
|
||||
if albumArtist == nil {
|
||||
albumArtist = song.albumArtist
|
||||
}
|
||||
if song.artist != albumArtist {
|
||||
showSongArtist = true
|
||||
}
|
||||
|
||||
albumSongs.append(AlbumSongItem(song: song))
|
||||
}
|
||||
@ -50,6 +59,7 @@ class AlbumTracksDataSource: NSObject, NSTableViewDataSource {
|
||||
type: .albumSongItem(song.mpdSong.uriString),
|
||||
title: song.title,
|
||||
artist: song.artist,
|
||||
albumArtist: song.albumArtist,
|
||||
album: song.album.title,
|
||||
uri: song.mpdSong.uriString
|
||||
),
|
||||
@ -70,10 +80,11 @@ class AlbumTracksDataSource: NSObject, NSTableViewDataSource {
|
||||
) { draggingItem, index, stop in
|
||||
guard let item = draggingItem.item as? NSPasteboardItem,
|
||||
let draggedSong = item.draggedSong(forType: .songPasteboardType),
|
||||
case let (title, artist, album, uri) = (
|
||||
case let (title, artist, album, albumArtist, uri) = (
|
||||
draggedSong.title,
|
||||
draggedSong.artist,
|
||||
draggedSong.album,
|
||||
draggedSong.albumArtist,
|
||||
draggedSong.uri
|
||||
)
|
||||
else { return }
|
||||
@ -83,6 +94,7 @@ class AlbumTracksDataSource: NSObject, NSTableViewDataSource {
|
||||
let draggedSongView = DraggedSongView(
|
||||
title: title,
|
||||
artist: artist,
|
||||
albumArtist: albumArtist,
|
||||
album: album,
|
||||
uri: uri
|
||||
)
|
||||
|
||||
@ -44,6 +44,7 @@ class QueueDataSource: NSObject, NSOutlineViewDataSource {
|
||||
type: .queueItem(queueItem.queuePos),
|
||||
title: queueItem.song.title,
|
||||
artist: queueItem.song.artist,
|
||||
albumArtist: queueItem.song.albumArtist,
|
||||
album: queueItem.song.album.title,
|
||||
uri: queueItem.song.mpdSong.uriString
|
||||
),
|
||||
@ -129,10 +130,11 @@ class QueueDataSource: NSObject, NSOutlineViewDataSource {
|
||||
guard let item = draggingItem.item as? NSPasteboardItem,
|
||||
let data = item.data(forType: .songPasteboardType),
|
||||
let draggedSong = try? PropertyListDecoder().decode(DraggedSong.self, from: data),
|
||||
case let (title, artist, album, uri) = (
|
||||
case let (title, artist, album, albumArtist, uri) = (
|
||||
draggedSong.title,
|
||||
draggedSong.artist,
|
||||
draggedSong.album,
|
||||
draggedSong.albumArtist,
|
||||
draggedSong.uri
|
||||
)
|
||||
else { return }
|
||||
@ -142,6 +144,7 @@ class QueueDataSource: NSObject, NSOutlineViewDataSource {
|
||||
let draggedSongView = DraggedSongView(
|
||||
title: title,
|
||||
artist: artist,
|
||||
albumArtist: albumArtist,
|
||||
album: album,
|
||||
uri: uri
|
||||
)
|
||||
|
||||
@ -16,12 +16,14 @@ class DraggedSongView: NSViewController {
|
||||
|
||||
private let songTitle: String
|
||||
private let songArtist: String
|
||||
private let songAlbumArtist: String
|
||||
private let songAlbum: String
|
||||
private let songUri: String
|
||||
|
||||
init(title: String, artist: String, album: String, uri: String) {
|
||||
init(title: String, artist: String, albumArtist: String, album: String, uri: String) {
|
||||
songTitle = title
|
||||
songArtist = artist
|
||||
songAlbumArtist = albumArtist
|
||||
songAlbum = album
|
||||
songUri = uri
|
||||
|
||||
@ -60,7 +62,7 @@ class DraggedSongView: NSViewController {
|
||||
}
|
||||
|
||||
func setCoverArt() {
|
||||
let mpdAlbum = MPDClient.MPDAlbum(title: songAlbum, artist: songArtist)
|
||||
let mpdAlbum = MPDClient.MPDAlbum(title: songAlbum, artist: songAlbumArtist)
|
||||
|
||||
let provider = MPDAlbumArtImageDataProvider(
|
||||
songUri: songUri,
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
38BAC36B249CB1A7004BAEA4 /* AlbumDetailSongTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BAC36A249CB1A6004BAEA4 /* AlbumDetailSongTitleView.swift */; };
|
||||
E407861C2110CE6E006887B1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E407861B2110CE6E006887B1 /* AppDelegate.swift */; };
|
||||
E40786202110CE70006887B1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E407861F2110CE70006887B1 /* Assets.xcassets */; };
|
||||
E40786232110CE70006887B1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E40786212110CE70006887B1 /* Main.storyboard */; };
|
||||
@ -368,6 +369,7 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
38BAC36A249CB1A6004BAEA4 /* AlbumDetailSongTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumDetailSongTitleView.swift; sourceTree = "<group>"; };
|
||||
E40786182110CE6E006887B1 /* Persephone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Persephone.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E407861B2110CE6E006887B1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
E407861F2110CE70006887B1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
@ -933,6 +935,7 @@
|
||||
E43B67A822909793007DCF55 /* AlbumDetailView.swift */,
|
||||
E4E7A6AC22AAAF98006D566C /* AlbumDetailView+NSTableViewDelegate.swift */,
|
||||
E43B67AC229194CD007DCF55 /* AlbumTracksDataSource.swift */,
|
||||
38BAC36A249CB1A6004BAEA4 /* AlbumDetailSongTitleView.swift */,
|
||||
);
|
||||
path = "Album Detail";
|
||||
sourceTree = "<group>";
|
||||
@ -1714,6 +1717,7 @@
|
||||
E480510F2423BD7100362CF3 /* MachTime.swift in Sources */,
|
||||
E47E2FD5222071FD00F747E6 /* AlbumViewItem.swift in Sources */,
|
||||
E4805A142426D73600362CF3 /* response.c in Sources */,
|
||||
38BAC36B249CB1A7004BAEA4 /* AlbumDetailSongTitleView.swift in Sources */,
|
||||
E4F2EFF024076B0900198159 /* ServerActions.swift in Sources */,
|
||||
E408D3BE220E03EE0006D9BE /* RawRepresentable.swift in Sources */,
|
||||
E4B11B66226A4F830075461B /* PlayerState.swift in Sources */,
|
||||
|
||||
@ -73,7 +73,7 @@ extension MPDClient {
|
||||
|
||||
let mpdAlbum = MPDAlbum(
|
||||
title: mpdSong.album.title,
|
||||
artist: mpdSong.artist,
|
||||
artist: mpdSong.albumArtist,
|
||||
firstSong: mpdSong,
|
||||
date: mpdSong.date
|
||||
)
|
||||
|
||||
@ -36,16 +36,21 @@ extension MPDClient {
|
||||
var album: MPDAlbum {
|
||||
return MPDAlbum(
|
||||
title: getTag(.album),
|
||||
artist: artist,
|
||||
artist: albumArtist,
|
||||
date: date
|
||||
)
|
||||
}
|
||||
|
||||
var artist: String {
|
||||
if getTag(.albumArtist) != "" {
|
||||
return getTag(.albumArtist)
|
||||
return getTag(.artist)
|
||||
}
|
||||
|
||||
var albumArtist: String {
|
||||
let albumArtist = getTag(.albumArtist);
|
||||
if albumArtist != "" {
|
||||
return albumArtist
|
||||
} else {
|
||||
return getTag(.artist)
|
||||
return artist
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ struct DraggedSong: Codable {
|
||||
var type: DraggedSongType
|
||||
var title: String
|
||||
var artist: String
|
||||
var albumArtist: String
|
||||
var album: String
|
||||
var uri: String
|
||||
}
|
||||
|
||||
@ -25,6 +25,10 @@ struct Song {
|
||||
return mpdSong.getTag(.artist)
|
||||
}
|
||||
|
||||
var albumArtist: String {
|
||||
return mpdSong.getTag(.albumArtist)
|
||||
}
|
||||
|
||||
var duration: Time {
|
||||
return Time(timeInSeconds: mpdSong.duration)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user