feat: add Search MP3 action to Shazam identification alert

Opens freemp3music.org and copies "title artist" to clipboard for quick paste-and-search.
feat/music-streaming
Laurent 1 month ago
parent 2f1b9b537c
commit 0eaa095bae
  1. 13
      Music/ContentView.swift

@ -257,7 +257,18 @@ struct ContentView: View {
get: { shazam.matchedTitle != nil },
set: { if !$0 { shazam.clearResult() } }
)) {
Button("OK") { shazam.clearResult() }
Button("Search MP3") {
let query = [shazam.matchedTitle, shazam.matchedArtist]
.compactMap { $0 }
.joined(separator: " ")
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(query, forType: .string)
if let url = URL(string: "https://freemp3music.org/") {
NSWorkspace.shared.open(url)
}
shazam.clearResult()
}
Button("Close", role: .cancel) { shazam.clearResult() }
} message: {
if let title = shazam.matchedTitle {
Text("\(title)\(shazam.matchedArtist ?? "Unknown Artist")")

Loading…
Cancel
Save