Monday 29 August 2011

iPhoto 9 のバグ

2004 とかいう smart album を作っているんですが、なんか、
どれもこれも全部入っている
なんだぁ? 試行錯誤の結果、
Date is before 12/31/2004
とかがダメならしいです。
Date is before 1/1/2005
は通る。情けないバグだなぁ。
Unix time に変換すれば良いんですが、AppleScript/Apple Event が月日を別々に扱う仕様なので、そのせいでしょう。Unix time に変換しないで年月日の計算をする時にバグが出ないようにするのは意外に難しい。変態多倍長計算になるからね。
なぜ、Date is before 12/31/2004 だったかと言うと、bofore 1/1 and after 1/1 にすると、1/1 が抜けるというバグがあるから。(何故、重複でなく抜けるのかは僕に聞くな) = とか <= とか書かせろってな感じですね。and/or を自由に組み合わせられるわけではないので、ここまでだな。
自分で AppleScript で smart でない album を作るのが良さそう。iPhone では smart album は同期時に計算してしまっているので同じことだしね。

なんだけど、
set y to 2002
-- repeat while y < 2011
set b to date ("1/1/" & (y as string))
set e to date ("1/1/" & ((y + 1) as string))
tell application "iPhoto"
set a to every photo whose date>  b and date < e
set b to some album whose name is (y as string)
if true then
repeat with p in a
add p to b
end repeat
-- add a to b
end if
count of a
end tell
-- set y to y + 1
-- end repeat
このあたりで諦め。add a to b が動かないので、激遅でだめみたい。まぁ、そんなものだよね。つうか、それも iPhoto 9 のバグだな。
消しちゃった smart album を復帰させないと。まぁ、いいか、しばらくなしで。

No comments: