Skip to content

Instantly share code, notes, and snippets.

@taiyoslime
Last active May 15, 2020 19:34
Show Gist options
  • Save taiyoslime/9a81eb77fccc1454d5d43f7ea611db82 to your computer and use it in GitHub Desktop.
Save taiyoslime/9a81eb77fccc1454d5d43f7ea611db82 to your computer and use it in GitHub Desktop.
iTunesで再生されてる曲を取得するやつ(Mac)
#!/usr/bin/osascript -l JavaScript
app = Application("com.apple.iTunes");
name = app.currentTrack().name()
artist = app.currentTrack().artist()
album = app.currentTrack().album()
duration = app.currentTrack().duration()
sec = duration / 60 | 0
min = duration % 60 | 0
if(min < 10) min = "0" + min
result = `${name} - ${artist}/${album} [${sec}:${min}]`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment