Skip to content

Instantly share code, notes, and snippets.

@mveinot
Created November 28, 2015 14:31
Show Gist options
  • Save mveinot/3ae635f50693d38fde99 to your computer and use it in GitHub Desktop.
Save mveinot/3ae635f50693d38fde99 to your computer and use it in GitHub Desktop.
Send commands to a connected LCD over serial
#!/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