Last active
September 6, 2015 05:36
-
-
Save ytkhs/c201b44a95b0ffab6500 to your computer and use it in GitHub Desktop.
javascript(JAX)でiTunesの曲をランダムに一曲取得して通知に渡してみる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = Application.currentApplication(), | |
iTunes = Application('iTunes'); | |
app.includeStandardAdditions = true; | |
var allTracks = iTunes.playlists[0].tracks(); | |
var randomTrack = allTracks[Math.floor(Math.random() * allTracks.length)]; | |
app.displayNotification(randomTrack.artist(), { | |
withTitle: randomTrack.name(), | |
subtitle: randomTrack.album(), | |
soundName: 'Glass' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment