Re: iTunes 4 & Artwork scripting
Re: iTunes 4 & Artwork scripting
- Subject: Re: iTunes 4 & Artwork scripting
- From: "David A. Cox" <email@hidden>
- Date: Fri, 9 May 2003 07:32:39 -0700 (PDT)
That info is interesting, but I have not found a way to use it yet. I have
tried creating a PNG file by hand that works, and then reading in the
"data" from an PNG atrwork file from itunes into that document, but it
create invalid files (same with jpg).
Simply adding the correct .PNG of .JPG name extension to an image pulled
out by a script actually makes it less likely to be opened (by something
like Preview).
DAC
On Thu, 8 May 2003, Doug Adams wrote:
>
Hello David,
>
>
As the day has progressed I have received confirmation from another
>
scripter who comments in his script:
>
>
To do:
>
- find a way to save the artwork data as original jpg or png format.
>
>
I deduce this is also a manifestation of the problem. So perhaps you
>
are correct in that it is not to be currently. I hate to say that,
>
though.
>
>
Is there any help with artwork's "format" property? Does it return the
>
correct format? I note also that the beginning of the raw picture data
>
(as you might see a picture listed in Script Editor's Event Log) always
>
begins with the the type of graphic the file is. Does this help to
>
establish a correct extention?
>
>
Let me know,
>
Doug
>
>
>
>
On Thursday, May 8, 2003, at 04:53 PM, David A. Cox wrote:
>
>
> I had not see that, but it is a very nicely written script.
>
>
>
> It suffers from the same problem that my script has though. It creates
>
> files that are openable by Preview because of the .pict name attached,
>
> but
>
> they do not behave like well formed image files. Photoshop will not
>
> open
>
> them, for example, and they are listed by the finder as being text
>
> icons.
>
> Command line image editing commands fail against these things.
>
>
>
> I am starting to think this may not be possible with the current
>
> version
>
> of ituens/applescript.
>
>
>
> DAC
>
>
>
>
>
> On Thu, 8 May 2003, Doug Adams wrote:
>
>
>
>> Hello David,
>
>>
>
>> Thanks for asking.
>
>>
>
>> I cannot tell from your message if you have had a look at Show Artwork
>
>> in Preview:
>
>>
>
>> <http://www.malcolmadams.com/itunes/scripts/
>
>> scripts03.shtml#showartworkinpreview>
>
>>
>
>> It is able to open the current track's artwork in Preview. It saves
>
>> the
>
>> graphic in a file also, but if I am not mistaken it goes about it
>
>> somewhat differently than your snippet. It might be worth a look.
>
>>
>
>> Let me know how you procede.
>
>>
>
>> Cheers,
>
>> Doug
>
>>
>
>> On Thursday, May 8, 2003, at 10:18 AM, David A. Cox wrote:
>
>>
>
>>> This was very helpful to me in starting to play with some things, but
>
>>> I am
>
>>> still a bit stuck.
>
>>>
>
>>> Basicaly, I want to pull the frontmost artwork from the current track
>
>>> in
>
>>> itunes, and then fiddle with the file. I have it set up so that I can
>
>>> pull
>
>>> the image out of itunes, and save it to a temp location on the disk,
>
>>> but
>
>>> the file still seems "odd" in many ways. If I give the file a *.pict
>
>>> file
>
>>> name, I can always open it in Safari, and it will often open in
>
>>> Preview
>
>>> (but not always). If I try to manipulate the image with any of the
>
>>> command
>
>>> line tool included in a package called imagemagic, it gives me an
>
>>> error to
>
>>> the effect that a file name is missing (this seems to be from parsing
>
>>> the
>
>>> image file itself). The file also reports in the finder as a text
>
>>> file, no
>
>>> matter what extension I put on it.
>
>>>
>
>>> Any thoughts would be of help, as I am rather stuck. The script that
>
>>> I
>
>>> am
>
>>> using to save a copy of the image to a temp file is (but note that
>
>>> Photoshop will not open the same file):
>
>>>
>
>>> tell application "iTunes"
>
>>> if artworks of current track exists then
>
>>> set imgdata to front artwork of current track
>
>>> set img to (data of imgdata) as picture
>
>>>
>
>>> tell application "Finder"
>
>>> set imgfile to "Macintosh HD:Users:dcox:base.pict" as text
>
>>> open for access alias imgfile with write
>
>>> permission
>
>>> write (img as picture) to alias imgfile
>
>>> close access alias imgfile
>
>>>
>
>>> tell application "Safari"
>
>>> open imgfile as alias
>
>>> end tell
>
>>>
>
>>> end tell
>
>>> end if
>
>>> end tell
>
>>>
>
>>> DAC
>
>>>
>
>>> On Thu, 1 May 2003, Doug Adams wrote:
>
>>>
>
>>>> So far, we can grab the art and put it in the clipboard:
>
>>>>
>
>>>> tell application "iTunes"
>
>>>> set myP to view of front window
>
>>>> if selection exists then
>
>>>> set c to (item 1 of index of selection)
>
>>>> tell myP
>
>>>> if artworks of track c exists then
>
>>>> set pic to data of the artworks of track c as picture
>
>>>> set the clipboard to pic
>
>>>> return clipboard info
>
>>>> end if
>
>>>> end tell
>
>>>> end if -- selection
>
>>>> end tell
>
>>>>
>
>>>> A script that copied one track's artwork to all others in the
>
>>>> playlist
>
>>>> would be cool. All help appreciated.
>
>>>> --
>
>>>> Doug Adams
>
>>>> email@hidden
>
>>>>
>
>>>> iTuners! Get Some AppleScripts!
>
>>>> Doug's AppleScripts for iTunes
>
>>>> <malcolmadams.com/itunes/>
>
>>>> RSS feed:
>
>>>> <malcolmadams.com/itunes/dougs.rss>
>
>>>> _______________________________________________
>
>>>> applescript-users mailing list | email@hidden
>
>>>> Help/Unsubscribe/Archives:
>
>>>> http://www.lists.apple.com/mailman/listinfo/applescript-users
>
>>>> Do not post admin requests to the list. They will be ignored.
>
>>>>
>
>>>
>
>>>
>
>> --
>
>> Doug Adams
>
>> email@hidden
>
>>
>
>> iTuners! Get Some AppleScripts!
>
>> Doug's AppleScripts for iTunes
>
>> <malcolmadams.com/itunes/>
>
>> RSS feed:
>
>> <malcolmadams.com/itunes/dougs.rss>
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.