Ecco la mia piccola sceneggiatura per fare ciò che stai chiedendo. Testato su un paio di tracce sul mio iTunes 11 con Snow Leopard e funziona perfettamente.
tell application "iTunes"
set myMusicLib to some playlist whose special kind is Music
log "Debug: Count of library items: " & (count of tracks of myMusicLib)
set myNewTracks to (get tracks in myMusicLib whose bit rate is greater than 256)
log "Debug: Count hi bit rate tracks: " & (count of myNewTracks)
repeat with newTrack in myNewTracks
-- Try to match it with a low bit rate track
set trackName to name of newTrack
set albumName to album of newTrack
--log "Debug: Hi Rate Track Name: " & (get name of newTrack)
--log "Debug: Rate: " & (get bit rate of newTrack)
set oldTracks to {}
try
set oldTracks to (get tracks in myMusicLib ¬
whose bit rate is less than 256 ¬
and name is trackName ¬
and album is albumName)
end try
if (count of oldTracks) is 1 then
log "Debug: Dup Name: " & trackName
log "Debug: BitRate: " & (get bit rate of item 1 of oldTracks)
set oldPlayCount to (get played count of item 1 of oldTracks)
set played count of newTrack to oldPlayCount
log "Debug: Reset Play Count to: " & oldPlayCount
set oldRating to (get rating of item 1 of oldTracks)
set rating of newTrack to oldRating
log "Debug: Reset rating to: " & oldRating
end if
if (count of oldTracks) is greater than 1 then
log "ERROR: Found more than 1 duplicate. Not doing anything."
end if
end repeat
end tell
Modifica
Puoi dare un'occhiata a quello che sta succedendo guardando l'output che si trova nel riquadro Eventi. Basta eseguirlo all'interno di Applescript Editor e fare clic su Eventi & Rispondi ai pulsanti per renderli non visibili.
EDIT2:
Perlimitareloscript,puoicambiarelalinea
setmyNewTracksto(gettracksinmyMusicLibwhosebitrateisgreaterthan256)
a
setmyNewTracksto(gettracksinmyMusicLibwhosebitrateisgreaterthan256andAlbumis"My Album Name")