mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Merge 5cd67c5007 into db463252d4
This commit is contained in:
commit
1add581a49
@ -59,7 +59,7 @@ class AlbumViewItem: NSCollectionViewItem {
|
|||||||
guard let song = album.mpdAlbum.firstSong
|
guard let song = album.mpdAlbum.firstSong
|
||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
let provider = MPDAlbumArtImageDataProvider(
|
let provider = AlbumArtImageDataProvider(
|
||||||
songUri: song.uriString,
|
songUri: song.uriString,
|
||||||
cacheKey: album.hash
|
cacheKey: album.hash
|
||||||
)
|
)
|
||||||
|
|||||||
@ -132,7 +132,7 @@ class AlbumDetailView: NSViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getBigCoverArt(song: Song, album: Album) {
|
func getBigCoverArt(song: Song, album: Album) {
|
||||||
let provider = MPDAlbumArtImageDataProvider(
|
let provider = AlbumArtImageDataProvider(
|
||||||
songUri: song.mpdSong.uriString,
|
songUri: song.mpdSong.uriString,
|
||||||
cacheKey: album.hash
|
cacheKey: album.hash
|
||||||
)
|
)
|
||||||
|
|||||||
@ -18,6 +18,16 @@ class CoverArtPrefsController: NSViewController {
|
|||||||
} else {
|
} else {
|
||||||
fetchMissingArtworkFromInternet.state = .off
|
fetchMissingArtworkFromInternet.state = .off
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if App.store.state.preferencesState.fetchArtworkFromCustomURL {
|
||||||
|
customArtworkURLButton.state = .on
|
||||||
|
} else {
|
||||||
|
customArtworkURLButton.state = .off
|
||||||
|
}
|
||||||
|
|
||||||
|
if let urlString = App.store.state.preferencesState.customArtworkURL?.absoluteString {
|
||||||
|
customArtworkURLTextField.stringValue = urlString
|
||||||
|
}
|
||||||
|
|
||||||
preferredContentSize = NSMakeSize(view.frame.size.width, view.frame.size.height)
|
preferredContentSize = NSMakeSize(view.frame.size.width, view.frame.size.height)
|
||||||
}
|
}
|
||||||
@ -37,6 +47,18 @@ class CoverArtPrefsController: NSViewController {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IBAction func updateCustomArtworkURLToggle(_ sender: NSButton) {
|
||||||
|
App.store.dispatch(
|
||||||
|
UpdateCustomArtworkURLToggle(useCustomArtworkURL: sender.state == .on)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func updateCustomArtworkURL(_ sender: NSTextField) {
|
||||||
|
App.store.dispatch(
|
||||||
|
UpdateCustomArtworkURL(customArtworkURL: sender.stringValue)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@IBAction func clearAlbumArtCache(_ sender: NSButton) {
|
@IBAction func clearAlbumArtCache(_ sender: NSButton) {
|
||||||
KingfisherManager.shared.cache.clearDiskCache()
|
KingfisherManager.shared.cache.clearDiskCache()
|
||||||
@ -44,4 +66,6 @@ class CoverArtPrefsController: NSViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@IBOutlet var fetchMissingArtworkFromInternet: NSButton!
|
@IBOutlet var fetchMissingArtworkFromInternet: NSButton!
|
||||||
|
@IBOutlet var customArtworkURLTextField: NSTextField!
|
||||||
|
@IBOutlet var customArtworkURLButton: NSButton!
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class CurrentCoverArtView: NSImageView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setSongImage(_ song: Song) {
|
func setSongImage(_ song: Song) {
|
||||||
let provider = MPDAlbumArtImageDataProvider(
|
let provider = AlbumArtImageDataProvider(
|
||||||
songUri: song.mpdSong.uriString,
|
songUri: song.mpdSong.uriString,
|
||||||
cacheKey: song.album.hash
|
cacheKey: song.album.hash
|
||||||
)
|
)
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class QueueSongCoverView: NSTableCellView {
|
|||||||
|
|
||||||
isPlaying = queueItem.isPlaying
|
isPlaying = queueItem.isPlaying
|
||||||
|
|
||||||
let provider = MPDAlbumArtImageDataProvider(
|
let provider = AlbumArtImageDataProvider(
|
||||||
songUri: song.mpdSong.uriString,
|
songUri: song.mpdSong.uriString,
|
||||||
cacheKey: song.album.hash
|
cacheKey: song.album.hash
|
||||||
)
|
)
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class DraggedSongView: NSViewController {
|
|||||||
func setCoverArt() {
|
func setCoverArt() {
|
||||||
let mpdAlbum = MPDClient.MPDAlbum(title: songAlbum, artist: songAlbumArtist)
|
let mpdAlbum = MPDClient.MPDAlbum(title: songAlbum, artist: songAlbumArtist)
|
||||||
|
|
||||||
let provider = MPDAlbumArtImageDataProvider(
|
let provider = AlbumArtImageDataProvider(
|
||||||
songUri: songUri,
|
songUri: songUri,
|
||||||
cacheKey: Album(mpdAlbum: mpdAlbum).hash
|
cacheKey: Album(mpdAlbum: mpdAlbum).hash
|
||||||
)
|
)
|
||||||
|
|||||||
@ -0,0 +1,39 @@
|
|||||||
|
//
|
||||||
|
// CustomURLAlbumArtImageDataProvider.swift
|
||||||
|
// Persephone
|
||||||
|
//
|
||||||
|
// Created by Diego Torres on 07.11.20.
|
||||||
|
// Copyright © 2020 Dan Barber. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Kingfisher
|
||||||
|
|
||||||
|
public struct CustomURLAlbumArtImageDataProvider: ImageDataProvider {
|
||||||
|
let songUri: String
|
||||||
|
let baseURL: URL
|
||||||
|
|
||||||
|
init(baseURL: URL, songUri: String, cacheKey: String) {
|
||||||
|
self.songUri = songUri
|
||||||
|
self.cacheKey = cacheKey
|
||||||
|
self.baseURL = baseURL
|
||||||
|
}
|
||||||
|
|
||||||
|
public var cacheKey: String
|
||||||
|
|
||||||
|
public func data(handler: @escaping (Result<Data, Error>) -> Void) {
|
||||||
|
let task = URLSession.shared.dataTask(with: baseURL.appendingPathComponent(songUri)) { (data, response, error) in
|
||||||
|
let result = Result<Data, Error> {
|
||||||
|
if let error = error { throw error }
|
||||||
|
guard let data = data else { throw URLError(.badServerResponse) }
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
handler(result)
|
||||||
|
}
|
||||||
|
task.resume()
|
||||||
|
}
|
||||||
|
|
||||||
|
public var contentURL: String? {
|
||||||
|
return songUri
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -32,3 +32,11 @@ public struct MPDAlbumArtImageDataProvider: ImageDataProvider {
|
|||||||
return songUri
|
return songUri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func AlbumArtImageDataProvider(songUri: String, cacheKey: String) -> ImageDataProvider {
|
||||||
|
if App.store.state.preferencesState.fetchArtworkFromCustomURL, let url = App.store.state.preferencesState.customArtworkURL {
|
||||||
|
return CustomURLAlbumArtImageDataProvider(baseURL: url, songUri: songUri, cacheKey: cacheKey)
|
||||||
|
} else {
|
||||||
|
return MPDAlbumArtImageDataProvider(songUri: songUri, cacheKey: cacheKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class UserNotificationsController {
|
|||||||
status.state == .playing
|
status.state == .playing
|
||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
let provider = MPDAlbumArtImageDataProvider(
|
let provider = AlbumArtImageDataProvider(
|
||||||
songUri: song.mpdSong.uriString,
|
songUri: song.mpdSong.uriString,
|
||||||
cacheKey: song.album.hash
|
cacheKey: song.album.hash
|
||||||
)
|
)
|
||||||
|
|||||||
@ -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="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16097.3" 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="15705"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097.3"/>
|
||||||
<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>
|
||||||
@ -536,13 +536,15 @@
|
|||||||
<objects>
|
<objects>
|
||||||
<viewController title="Cover Art" id="3C9-vU-zjZ" userLabel="Cover Art" customClass="CoverArtPrefsController" customModule="Persephone" customModuleProvider="target" sceneMemberID="viewController">
|
<viewController title="Cover Art" id="3C9-vU-zjZ" userLabel="Cover Art" customClass="CoverArtPrefsController" customModule="Persephone" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<view key="view" id="PyK-v2-kus">
|
<view key="view" id="PyK-v2-kus">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="427" height="95"/>
|
<rect key="frame" x="0.0" y="0.0" width="427" height="158"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<gridView horizontalHuggingPriority="750" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" xPlacement="leading" yPlacement="center" rowAlignment="none" rowSpacing="14" translatesAutoresizingMaskIntoConstraints="NO" id="M8L-ne-ZhL">
|
<gridView horizontalHuggingPriority="750" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" xPlacement="leading" yPlacement="center" rowAlignment="none" rowSpacing="14" translatesAutoresizingMaskIntoConstraints="NO" id="M8L-ne-ZhL">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="427" height="95"/>
|
<rect key="frame" x="0.0" y="0.0" width="427" height="158"/>
|
||||||
<rows>
|
<rows>
|
||||||
<gridRow topPadding="20" id="jo0-w7-CZu"/>
|
<gridRow topPadding="20" id="jo0-w7-CZu"/>
|
||||||
|
<gridRow id="AZA-jX-c6l"/>
|
||||||
|
<gridRow id="16Y-Re-bkN"/>
|
||||||
<gridRow bottomPadding="26" id="g4x-Bc-qT7"/>
|
<gridRow bottomPadding="26" id="g4x-Bc-qT7"/>
|
||||||
</rows>
|
</rows>
|
||||||
<columns>
|
<columns>
|
||||||
@ -551,7 +553,7 @@
|
|||||||
<gridCells>
|
<gridCells>
|
||||||
<gridCell row="jo0-w7-CZu" column="y6E-R8-zfP" id="NAC-x2-Qyh">
|
<gridCell row="jo0-w7-CZu" column="y6E-R8-zfP" id="NAC-x2-Qyh">
|
||||||
<button key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pRL-MG-1Be">
|
<button key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pRL-MG-1Be">
|
||||||
<rect key="frame" x="78" y="59" width="271" height="18"/>
|
<rect key="frame" x="78" y="122" width="271" height="18"/>
|
||||||
<buttonCell key="cell" type="check" title="Fetch missing artwork from MusicBrainz" bezelStyle="regularSquare" imagePosition="left" enabled="NO" inset="2" id="LpD-Ew-HMd">
|
<buttonCell key="cell" type="check" title="Fetch missing artwork from MusicBrainz" bezelStyle="regularSquare" imagePosition="left" enabled="NO" inset="2" id="LpD-Ew-HMd">
|
||||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@ -561,6 +563,28 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</gridCell>
|
</gridCell>
|
||||||
|
<gridCell row="AZA-jX-c6l" column="y6E-R8-zfP" id="nIu-Aa-5ov">
|
||||||
|
<button key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iPP-w1-R8G">
|
||||||
|
<rect key="frame" x="78" y="94" width="271" height="18"/>
|
||||||
|
<buttonCell key="cell" type="check" title="Fetch from URL:" bezelStyle="regularSquare" imagePosition="left" inset="2" id="jbS-Rs-0ED">
|
||||||
|
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||||
|
<font key="font" metaFont="system"/>
|
||||||
|
</buttonCell>
|
||||||
|
</button>
|
||||||
|
</gridCell>
|
||||||
|
<gridCell row="16Y-Re-bkN" column="y6E-R8-zfP" id="Kno-Fk-238">
|
||||||
|
<textField key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="T3H-Cf-Rh3">
|
||||||
|
<rect key="frame" x="80" y="61" width="267" height="21"/>
|
||||||
|
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="https://a.base.url" drawsBackground="YES" id="RiO-X6-KZA">
|
||||||
|
<font key="font" usesAppearanceFont="YES"/>
|
||||||
|
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
</textFieldCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="updateCustomArtworkURL:" target="3C9-vU-zjZ" id="I5e-oc-cN6"/>
|
||||||
|
</connections>
|
||||||
|
</textField>
|
||||||
|
</gridCell>
|
||||||
<gridCell row="g4x-Bc-qT7" column="y6E-R8-zfP" id="LTx-vQ-fTR">
|
<gridCell row="g4x-Bc-qT7" column="y6E-R8-zfP" id="LTx-vQ-fTR">
|
||||||
<button key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mXh-kY-tMC">
|
<button key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mXh-kY-tMC">
|
||||||
<rect key="frame" x="74" y="19" width="279" height="32"/>
|
<rect key="frame" x="74" y="19" width="279" height="32"/>
|
||||||
@ -584,12 +608,14 @@
|
|||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="customArtworkURLButton" destination="iPP-w1-R8G" id="w5V-Pn-iNI"/>
|
||||||
|
<outlet property="customArtworkURLTextField" destination="T3H-Cf-Rh3" id="Erb-cy-PSf"/>
|
||||||
<outlet property="fetchMissingArtworkFromInternet" destination="pRL-MG-1Be" id="Xcp-sb-iZm"/>
|
<outlet property="fetchMissingArtworkFromInternet" destination="pRL-MG-1Be" id="Xcp-sb-iZm"/>
|
||||||
</connections>
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<customObject id="KzD-E3-lpA" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
<customObject id="KzD-E3-lpA" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1411" y="-420"/>
|
<point key="canvasLocation" x="1410.5" y="-421"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--General-->
|
<!--General-->
|
||||||
<scene sceneID="xTC-Y5-Agk">
|
<scene sceneID="xTC-Y5-Agk">
|
||||||
|
|||||||
@ -24,6 +24,11 @@
|
|||||||
<string>public.app-category.music</string>
|
<string>public.app-category.music</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
|
<key>NSAppTransportSecurity</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSAllowsLocalNetworking</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Copyright © 2020 Dan Barber. All rights reserved.</string>
|
<string>Copyright © 2020 Dan Barber. All rights reserved.</string>
|
||||||
<key>NSMainStoryboardFile</key>
|
<key>NSMainStoryboardFile</key>
|
||||||
|
|||||||
@ -12,12 +12,12 @@ import Kingfisher
|
|||||||
|
|
||||||
struct CoverArtService {
|
struct CoverArtService {
|
||||||
let song: Song
|
let song: Song
|
||||||
let provider: MPDAlbumArtImageDataProvider
|
let provider: ImageDataProvider
|
||||||
|
|
||||||
init(song: Song) {
|
init(song: Song) {
|
||||||
self.song = song
|
self.song = song
|
||||||
|
|
||||||
provider = MPDAlbumArtImageDataProvider(
|
provider = AlbumArtImageDataProvider(
|
||||||
songUri: song.mpdSong.uriString,
|
songUri: song.mpdSong.uriString,
|
||||||
cacheKey: song.album.hash
|
cacheKey: song.album.hash
|
||||||
)
|
)
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
2F2EBD8425570D49002CAB57 /* CustomURLAlbumArtImageDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F2EBD8325570D49002CAB57 /* CustomURLAlbumArtImageDataProvider.swift */; };
|
||||||
38BAC36B249CB1A7004BAEA4 /* AlbumDetailSongTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BAC36A249CB1A6004BAEA4 /* AlbumDetailSongTitleView.swift */; };
|
38BAC36B249CB1A7004BAEA4 /* AlbumDetailSongTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BAC36A249CB1A6004BAEA4 /* AlbumDetailSongTitleView.swift */; };
|
||||||
E407861C2110CE6E006887B1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E407861B2110CE6E006887B1 /* AppDelegate.swift */; };
|
E407861C2110CE6E006887B1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E407861B2110CE6E006887B1 /* AppDelegate.swift */; };
|
||||||
E40786202110CE70006887B1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E407861F2110CE70006887B1 /* Assets.xcassets */; };
|
E40786202110CE70006887B1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E407861F2110CE70006887B1 /* Assets.xcassets */; };
|
||||||
@ -369,6 +370,7 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
2F2EBD8325570D49002CAB57 /* CustomURLAlbumArtImageDataProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomURLAlbumArtImageDataProvider.swift; sourceTree = "<group>"; };
|
||||||
38BAC36A249CB1A6004BAEA4 /* AlbumDetailSongTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumDetailSongTitleView.swift; sourceTree = "<group>"; };
|
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; };
|
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>"; };
|
E407861B2110CE6E006887B1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
@ -1247,6 +1249,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
E4BB7F8E23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift */,
|
E4BB7F8E23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift */,
|
||||||
|
2F2EBD8325570D49002CAB57 /* CustomURLAlbumArtImageDataProvider.swift */,
|
||||||
);
|
);
|
||||||
path = ImageDataProviders;
|
path = ImageDataProviders;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1647,6 +1650,7 @@
|
|||||||
E43AC1F822C7065A001E483C /* AlbumCoverButton.swift in Sources */,
|
E43AC1F822C7065A001E483C /* AlbumCoverButton.swift in Sources */,
|
||||||
E45962C62241A78500FC1A1E /* MPDCommand.swift in Sources */,
|
E45962C62241A78500FC1A1E /* MPDCommand.swift in Sources */,
|
||||||
E408D3B9220DE98F0006D9BE /* NSUserInterfaceItemIdentifier.swift in Sources */,
|
E408D3B9220DE98F0006D9BE /* NSUserInterfaceItemIdentifier.swift in Sources */,
|
||||||
|
2F2EBD8425570D49002CAB57 /* CustomURLAlbumArtImageDataProvider.swift in Sources */,
|
||||||
E48059C62426D73600362CF3 /* cplaylist.c in Sources */,
|
E48059C62426D73600362CF3 /* cplaylist.c in Sources */,
|
||||||
E4EB2379220F10B8008C70C0 /* MPDPair.swift in Sources */,
|
E4EB2379220F10B8008C70C0 /* MPDPair.swift in Sources */,
|
||||||
E489E3A422B9D31800CA8CBD /* DraggedSongView.swift in Sources */,
|
E489E3A422B9D31800CA8CBD /* DraggedSongView.swift in Sources */,
|
||||||
|
|||||||
@ -20,4 +20,12 @@ struct UpdateFetchMissingArtworkFromInternet: Action {
|
|||||||
var fetchMissingArtworkFromInternet: Bool
|
var fetchMissingArtworkFromInternet: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct UpdateCustomArtworkURLToggle: Action {
|
||||||
|
var useCustomArtworkURL: Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UpdateCustomArtworkURL: Action {
|
||||||
|
var customArtworkURL: String
|
||||||
|
}
|
||||||
|
|
||||||
struct SavePreferences: Action {}
|
struct SavePreferences: Action {}
|
||||||
|
|||||||
@ -15,6 +15,8 @@ struct PreferencesState: StateType, Equatable {
|
|||||||
var mpdServer: MPDServer
|
var mpdServer: MPDServer
|
||||||
|
|
||||||
var fetchMissingArtworkFromInternet: Bool
|
var fetchMissingArtworkFromInternet: Bool
|
||||||
|
var fetchArtworkFromCustomURL: Bool
|
||||||
|
var customArtworkURL: URL?
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
self.mpdServer = MPDServer(
|
self.mpdServer = MPDServer(
|
||||||
@ -24,6 +26,8 @@ struct PreferencesState: StateType, Equatable {
|
|||||||
self.fetchMissingArtworkFromInternet = preferences.bool(
|
self.fetchMissingArtworkFromInternet = preferences.bool(
|
||||||
forKey: "fetchMissingArtworkFromInternet"
|
forKey: "fetchMissingArtworkFromInternet"
|
||||||
)
|
)
|
||||||
|
self.fetchArtworkFromCustomURL = preferences.bool(forKey: "fetchArtworkFromCustomURL")
|
||||||
|
self.customArtworkURL = preferences.url(forKey: "customArtworkURL")
|
||||||
}
|
}
|
||||||
|
|
||||||
func save() {
|
func save() {
|
||||||
@ -34,5 +38,7 @@ struct PreferencesState: StateType, Equatable {
|
|||||||
preferences.removeObject(forKey: "mpdPort")
|
preferences.removeObject(forKey: "mpdPort")
|
||||||
}
|
}
|
||||||
preferences.set(fetchMissingArtworkFromInternet, forKey: "fetchMissingArtworkFromInternet")
|
preferences.set(fetchMissingArtworkFromInternet, forKey: "fetchMissingArtworkFromInternet")
|
||||||
|
preferences.set(fetchArtworkFromCustomURL, forKey: "fetchArtworkFromCustomURL")
|
||||||
|
preferences.set(customArtworkURL, forKey: "customArtworkURL")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,12 @@ func preferencesReducer(action: Action, state: PreferencesState?) -> Preferences
|
|||||||
|
|
||||||
case let action as UpdateServerPort:
|
case let action as UpdateServerPort:
|
||||||
state.mpdServer.port = action.port
|
state.mpdServer.port = action.port
|
||||||
|
|
||||||
|
case let action as UpdateCustomArtworkURLToggle:
|
||||||
|
state.fetchArtworkFromCustomURL = action.useCustomArtworkURL
|
||||||
|
|
||||||
|
case let action as UpdateCustomArtworkURL:
|
||||||
|
state.customArtworkURL = URL(string: action.customArtworkURL)
|
||||||
|
|
||||||
case is SavePreferences:
|
case is SavePreferences:
|
||||||
state.save()
|
state.save()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user