Re: reference by location in iTunes
Re: reference by location in iTunes
- Subject: Re: reference by location in iTunes
- From: Allan Hise <email@hidden>
- Date: Wed, 26 Jan 2005 11:56:46 -0800 (PST)
Hi Romy,
Thanks for taking the time to respond.
I guess I wasn't clear enough about what I am trying to do.
I am using a squeezebox from slim devices (www.slimdevices.com) to play
mp3s to my stereo. It uses the same iTunes library, including playlists
and such, but it will not uptade the library when songs are played. The
slimserver is an application written in perl, and I want to have perl call
an applecript to update the iTunes library when the songs have played.
So, I cannot do any operations on a selected song in iTunes, since there
may not be one, and even if it were, there is only a 1 in 20505 chance
that it is the right one.
There is a "location" property in the iTunes class "file track". So that
is my first mistake - I should use "file track" instead of "track". But,
unfortunately, the problem still remains.
So, what I really want, is for iTunes to search the entire library until
it finds a match on the location, then use that match to update the play
count and play date properties.
Thanks!
Allan
On Wed, 26 Jan 2005, Romy Opena wrote:
> Hi,
>
> I am not sure if I understood your problem but I hope this might help
> in a way.
>
> I could do what you want to do, set the currently active track to
> your variable mySong, get the played count, the played date and the
> file track id.
>
> Here's the simple iTunes script for that:
>
> tell application "iTunes"
> activate
> play
> set mysong to the current track
> -->gives the file track id
> get played count of mysong
> -->gives the total play count in integer
> get the played date of mysong
> -->gives you the date and time the current track has been
> played
>
> ....and so on.
>
>
> end tell
>
> It would be advisable to refer to the iTunes dictionary to look at
> the properties and elements of any class that you can target with
> your script. For example, I did not see anything about "location"
> when I checked the class: track so I can't see how your script would
> work. I might have missed it so I will check the entire dictionary
> again.
>
> Good luck.
>
> Romeo Opena
> --- Allan Hise <email@hidden> wrote:
>
> >
> > I am trying to come up with a way to update the play count and last
> > played
> > information in iTunes. This applescript will be executed by a perl,
> > which
> > will fill in the "XXX" "YYY" and "ZZZ" information, below.
> >
> > At this time, I am having a problem getting iTunes to understand
> > which
> > track I am referring to. I am attempting to use the location of the
> > track
> > since that is the easiest unique identifier that this perl
> > application knows.
> >
> > Unfortunately, I couldn't find anything that was quite right on
> > Doug
> > Adams' excellent iTunes scripts web site, nor was a ton of googlng
> > successful in helping me.
> >
> > Maybe there is a better way to do what I am trying to do, but,
> > here's what
> > I have got... The problem is with the "set mysong" line.
> >
> > tell application "iTunes"
> > -- play "XXX" -- this works, why won't the next line
> > set mysong to the track whose location is "XXX"
> > tell mysong
> > set played count to "YYY"
> > -- even better would be to merely increment by 1
> > set played date to "ZZZ"
> > end tell
> > end tell
> >
> > Any ideas?
> >
> > thanks!
> >
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Applescript-users mailing list
> > (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
> >
> > This email sent to email@hidden
> >
>
>
> =====
> Romeo T. Opena, PhD
> Managing Director/Plant Breeder
> ARCH Seed (Thailand) Co., Ltd.
> 138 Moo 2, Tambon Samrongmai
> Lahansai, Buriram
> THAILAND 31170
> Mobile phone: 66-1-881-2374
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden