diff --git a/Persephone/Components/Window/Base.lproj/Main.storyboard b/Persephone/Components/Window/Base.lproj/Main.storyboard
index 9692c77..6ed6054 100644
--- a/Persephone/Components/Window/Base.lproj/Main.storyboard
+++ b/Persephone/Components/Window/Base.lproj/Main.storyboard
@@ -302,6 +302,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -314,6 +329,7 @@
+
@@ -543,9 +559,6 @@
-
-
-
diff --git a/Persephone/Components/Window/WindowController.swift b/Persephone/Components/Window/WindowController.swift
index d573fe9..38c745b 100644
--- a/Persephone/Components/Window/WindowController.swift
+++ b/Persephone/Components/Window/WindowController.swift
@@ -27,8 +27,6 @@ class WindowController: NSWindowController {
@IBOutlet var shuffleState: NSButton!
@IBOutlet var repeatState: NSButton!
- @IBOutlet var browseViewControls: NSSegmentedControl!
-
override func windowDidLoad() {
super.windowDidLoad()
window?.titleVisibility = .hidden
@@ -161,6 +159,10 @@ class WindowController: NSWindowController {
@IBAction func handleRepeatButton(_ sender: NSButton) {
App.mpdClient.setRepeatState(repeatState: sender.state == .on)
}
+
+ @IBAction func handleSearchQuery(_ sender: NSSearchField) {
+ App.store.dispatch(SetSearchQuery(searchQuery: sender.stringValue))
+ }
}
extension WindowController: NSWindowDelegate {
diff --git a/Persephone/MPDClient/Extensions/MPDClient+Album.swift b/Persephone/MPDClient/Extensions/MPDClient+Album.swift
index 9a909f9..a5ab99d 100644
--- a/Persephone/MPDClient/Extensions/MPDClient+Album.swift
+++ b/Persephone/MPDClient/Extensions/MPDClient+Album.swift
@@ -49,11 +49,17 @@ extension MPDClient {
}
}
- func allAlbums() {
+ func allAlbums(filter: String) {
var albums: [MPDAlbum] = []
var artist: String = ""
mpd_search_db_tags(self.connection, MPD_TAG_ALBUM)
+ if filter != "" {
+ mpd_search_add_expression(
+ self.connection,
+ "(any =~ 'alanis')"
+ )
+ }
mpd_search_add_group_tag(self.connection, MPD_TAG_ALBUM_ARTIST)
mpd_search_commit(self.connection)
@@ -72,6 +78,8 @@ extension MPDClient {
mpd_return_pair(self.connection, pair.pair)
}
+ print(getLastErrorMessage())
+
self.delegate?.didLoadAlbums(mpdClient: self, albums: albums)
}
diff --git a/Persephone/MPDClient/Extensions/MPDClient+Command.swift b/Persephone/MPDClient/Extensions/MPDClient+Command.swift
index 65845d4..d286471 100644
--- a/Persephone/MPDClient/Extensions/MPDClient+Command.swift
+++ b/Persephone/MPDClient/Extensions/MPDClient+Command.swift
@@ -93,7 +93,7 @@ extension MPDClient {
// Album commands
case .fetchAllAlbums:
- allAlbums()
+ allAlbums(filter: "Alanis")
case .playAlbum:
guard let album = userData["album"] as? MPDAlbum else { return }
sendPlayAlbum(album)
diff --git a/Persephone/State/Actions/UIActions.swift b/Persephone/State/Actions/UIActions.swift
index 7cc2135..1d3cedc 100644
--- a/Persephone/State/Actions/UIActions.swift
+++ b/Persephone/State/Actions/UIActions.swift
@@ -25,3 +25,7 @@ struct SetSelectedQueueItem: Action {
struct SetSelectedSong: Action {
let selectedSong: Song?
}
+
+struct SetSearchQuery: Action {
+ let searchQuery: String
+}
diff --git a/Persephone/State/Reducers/UIReducer.swift b/Persephone/State/Reducers/UIReducer.swift
index c7dc494..1ce0e33 100644
--- a/Persephone/State/Reducers/UIReducer.swift
+++ b/Persephone/State/Reducers/UIReducer.swift
@@ -33,6 +33,9 @@ func uiReducer(action: Action, state: UIState?) -> UIState {
case let action as SetSelectedQueueItem:
state.selectedQueueItem = action.selectedQueueItem
+ case let action as SetSearchQuery:
+ state.searchQuery = action.searchQuery
+
default:
break
}
diff --git a/Persephone/State/UIState.swift b/Persephone/State/UIState.swift
index 16ef4a6..49bd8f0 100644
--- a/Persephone/State/UIState.swift
+++ b/Persephone/State/UIState.swift
@@ -22,4 +22,6 @@ struct UIState: StateType {
var selectedSong: Song?
var selectedQueueItem: QueueItem?
+
+ var searchQuery: String = ""
}