Re: Performance assistance please
Re: Performance assistance please
- Subject: Re: Performance assistance please
- From: Jake Pietrykowski <email@hidden>
- Date: Tue, 01 Feb 2005 15:39:42 -0600
Hi Drew,
Your performance decreases as the size of your list 'L' grows too large as
the script progresses.
Perhaps you could do something that as the totalsize reaches the size of the
DVD, a new list is created.:
--Didn't test this, but maybe useful as a conceptual aid
set L to {}
set photoCounter to 0
tell application "iPhoto" to set theCount to the count of every photo
repeat with i from 1 to theCount
set photoCounter to photoCounter + 1
tell application "iPhoto"
set thePhoto to photo i
set thePath to the image path of thePhoto
end tell
tell application "Finder"
set theSize to the size of ((thePath as POSIX file) as alias)
set the end of L to {iindex:i, ipath:thePath, isize:theSize}
set totalsize to totalsize + theSize
if totalsize > 4.0E+9 then
--exit repeat and/or create album,then start new list
end if
end tell
end repeat
Use the photoCounter to keep track of which photo you're on.
WAIT...as I'm writing this (I'm not an iPhoto user) but if in mid-stride a
new album is created and add photos to it, does that muck up theCount of
total photos? I'd guess it does, so then this is null and void then. Maybe
perhaps some insight on how you can alter your script to avoid the
performance decrease as the size of your list 'L' increases in size. Use
multiple lists. (40GB / 4.4GB = only about 10 lists ;-)
Best Regards,
Jake
On 2/1/05 10:31 AM, "Andrew T. Lynch" <email@hidden> wrote:
> Hi All,
> I'm a long time software developer and mac user, but new to
> applescript. I wrote the following to create albums in iphoto which
> could be easily burned to dvd. I have over 22,000 photos in my
> library, totalling about 40Gb. It works fine when I test it on a
> smaller library, but on a larger one, it just bogs down. I turned in
> event tracking, and you can see the first thousand or so images zip by,
> but by about 5000 or so they take a second or two each, and this is
> just the first phase where collecting the image paths. BTW, this is
> running on my new 2.5Ghz DP with 1.5G of ram. (happy birthday to me!).
> Thanks in advance for any assistance.
>
> Cheers,
> Drew
>
>
> set L to {}
> tell application "iPhoto"
> set theCount to the count of every photo
> repeat with i from 1 to theCount
> set thePhoto to photo i
> set thePath to the image path of thePhoto
> set the end of L to {iindex:i, ipath:thePath, isize:0}
> end repeat
> end tell
> tell application "Finder"
> repeat with i in (a reference to L)
> set thePath to the ipath of i
> set the isize of i to the size of ((thePath as POSIX file) as alias)
> end repeat
> end tell
> tell application "iPhoto"
> set L2 to {}
> set dvdcount to 1
> set totalsize to 0
> set albumname to "dvd_" & dvdcount
> new album name albumname
> set theAlbum to album albumname
> repeat with i in (a reference to L)
> set totalsize to totalsize + (isize of i)
> set the end of L2 to the iindex of i
> if totalsize > 4.0E+9 then
> repeat with j in (a reference to L2)
> add photo j to theAlbum
> end repeat
> set L2 to {}
> set totalsize to 0
> set dvdcount to dvdcount + 1
> set albumname to "dvd_" & dvdcount
> new album name albumname
> set theAlbum to album albumname
> end if
> end repeat
> repeat with j in (a reference to L2)
> add photo j to theAlbum
> end repeat
> end tell
>
>
> - Andrew T. Lynch
> - Chief Zymurgist
> - Verisity Design Inc.
> - (650)934-6875
>
> _______________________________________________
> 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
_______________________________________________
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