Created
November 28, 2015 14:31
-
-
Save mveinot/3ae635f50693d38fde99 to your computer and use it in GitHub Desktop.
Send commands to a connected LCD over serial
This file contains 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
#!/usr/bin/perl -w | |
use strict; | |
use warnings; | |
chomp(my $status = `osascript -e 'tell application "iTunes" to player state as string'`); | |
if ($status eq 'playing') | |
{ | |
chomp(my $artist = `osascript -e 'tell application "iTunes" to artist of current track as string'`); | |
chomp(my $track = `osascript -e 'tell application "iTunes" to name of current track as string'`); | |
chomp(my $album = `osascript -e 'tell application "iTunes" to album of current track as string'`); | |
print "\1$track\2$artist\n\0"; | |
} else | |
{ | |
print "\1Stopped\2\n\0"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment