> I can do this in AppleScript:
>
[quoted text clipped - 8 lines]
> I tried using a string and a timestamp in place of the date, but to no
> avail. What should I be doing?
Not sure what you tried, but basically, you use track whose(played_date =>
g_t => $date). The question is how to construct $date. AppleScript can
afford to make more assumptions than we can, so param_type() helps us
defined types when necessary.
For dates there's two steps: get the epoch time (with timelocal here), and
then pass it to param_type to define it as typeLongDateTime.
use Mac::Glue ':all';
use Time::Local;
my $itunes = new Mac::Glue 'iTunes';
my $library = $itunes->obj(playlist => 'Local Library');
my $time = timelocal(0, 0, 0, 1, 0, 105); # jan 1 2005
my @tracks = $library->obj(track =>
whose(played_date => g_t => param_type(typeLongDateTime, $time)),
)->get;
# check our work
for (@tracks) {
print $_->prop('name')->get, ": ";
print scalar localtime $_->prop('played date')->get, "\n";
}

Signature
Chris Nandor pudge@pobox.com http://pudge.net/
Open Source Technology Group pudge@ostg.com http://ostg.com/