#!/usr/bin/perl -w # Query iTunes (via AppleScript) for a song list. # Optionally change song ratings. # # In short, this is a command-line interface for querying the iTunes # library. Why would you want such a thing when you can just use iTunes? # Answer: when you can't use iTunes. For example, I listen to music at work # on my iPod. If I want to see a playlist, or more importantly, rate a song # (my original purpose for writing this script), I can do so from an SSH # session I have from work to my Mac at home. # # Copyright 2004, Mark T. Abbott use strict; use Getopt::Std; require 'text_table.pm'; require 'tell_itunes.pm'; my $g_default_playlist = 'New Jukebox'; ### Begin main code. ### # Getopt likes its options to be the first thing in @ARGV, so # shift non-option patterns to the end of the list. while ( @ARGV and $ARGV[0] !~ m/^-/ and grep { m/^-/ } @ARGV ) { push @ARGV, shift @ARGV; } # Parse the arguments. our ($opt_h, $opt_P, $opt_a, $opt_p, $opt_r, $opt_v); getopts('hPv' . 'a:p:r:'); if ( $opt_h ) { print <