Mac::iTunes::AppleScript - control iTunes from Perl
use Mac::iTunes; my $itunes = Mac::iTunes->controller; $itunes->activate; $itunes->play; $itunes->quit;
Returns a singleton object that can control iTunes.
Start playing the current selection
Pause playback.
Toggle the play-pause button. If it's on play, it will pause, and if it's on pause, it will play.
Skip to the next track
Skip to the previous track
Go back to the start of the current track
Stop playback.
Fast forward through the current selection.
Rewind through the current selection.
Start playing after fast forward or rewind
Quit iTunes
Open an item from the given URL
Add the unix style path FILE to the user playlist with name PLAYLIST_NAME. Relative paths are resolved according to the current working directory.
add_track( 'mp3/song.mp3', 'Favorites' )
This function will create the playlist if it does not exist.
This function does not check if the track already exists in the playlist. If it does, you end up with duplicates.
BROKEN!
Returns true if the file is already in the iTunes library.
The library actually stores aliases to the real files, so I can't simply check the file names---very frustrating.
Return an anonymous array of the names of the tracks in playlist PLAYLIST.
Uses the currently set playlist if you don't specify one.
Return an anonymous array of the names of the playlists.
Set the current controller playlist.
Returns true if it succeeds, and false otherwise (for instance, if the playlist does not exist.
Add a playlist with the name NAME. Any double-quotes in NAME become single quotes.
Delete all playlists with the name NAME.
Returns the number of playlists with name NAME.
Returns the value of the visible property of the window. A window is visible if it is not minimized.
The tell() method runs a simple applescript.
If the ITUNES_TELL environment variable is set to a true value, it prints the script to SDTERR before it runs it.
Returns the state of the iTunes application, represented by one of the following symbolic constants:
STOPPED PLAYING PAUSED FAST_FORWARDING REWINDING
This source is part of a SourceForge project which always has the latest sources in CVS, as well as all of the previous releases.
http://sourceforge.net/projects/brian-d-foy/
If, for some reason, I disappear from the world, one of the other members of the project can shepherd this module appropriately.
brian d foy, <bdfoy@cpan.org>
<bdfoy@cpan.org>
Copyright (c) 2002-2007 brian d foy. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mac::iTunes, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mac::iTunes
CPAN shell
perl -MCPAN -e shell install Mac::iTunes
For more information on module installation, please visit the detailed CPAN module installation guide.