Open tanaynistala opened 4 years ago
Sure! 👍🏼
If you take a look at index.jsx
you have the following code:
# === SPOTIFY === #
# Uses <JSONQuote> to get around weird quote escape error
SPOTIFY=$(
osascript -l JavaScript <<EOD | sed -e 's/<JSONQuote>/\"/g'
if (Application('Spotify').running()) {
var spotify = Application('Spotify')
if (spotify.currentTrack() !== null) {
var song = spotify.currentTrack().name().replace(/\"/g, "\\\'")
var artist = spotify.currentTrack().artist().replace(/\"/g, "\\\'")
var artwork = spotify.currentTrack().artworkUrl()
var duration = spotify.currentTrack().duration()
var position = spotify.playerPosition()
var state = spotify.playerState()
var shuffle = spotify.shuffling()
var repeat = spotify.repeating()
"{<JSONQuote>song<JSONQuote>: <JSONQuote>" + song + "<JSONQuote>, <JSONQuote>artist<JSONQuote>: <JSONQuote>" + artist + "<JSONQuote>, <JSONQuote>artwork<JSONQuote>: <JSONQuote>" + artwork + "<JSONQuote>, <JSONQuote>duration<JSONQuote>: <JSONQuote>" + duration + "<JSONQuote>, <JSONQuote>position<JSONQuote>: <JSONQuote>" + position + "<JSONQuote>, <JSONQuote>state<JSONQuote>: <JSONQuote>" + state + "<JSONQuote>, <JSONQuote>repeat<JSONQuote>: <JSONQuote>" + repeat + "<JSONQuote>, <JSONQuote>shuffle<JSONQuote>: <JSONQuote>" + shuffle + "<JSONQuote>}"
} else {
"{}"
}
} else {
"{}"
}
EOD
)
Here is a link for osascript!
Try to find a way to do the same thing but for Music.app
.
Good luck!
Sorry if this is the wrong place to post this, but is there a way to pull music from the default Music app instead of Spotify?