Ho creato per te un AppleScript che analizzerà i nomi file di tutte le tracce iTunes selezionate e imposterà il tag dell'anno di conseguenza.
Incolla questo in AppleScript Editor ed eseguilo (o salvalo come applicazione):
tell application "iTunes"
repeat with theTrack in selection
set theFile to location of theTrack
tell application "Finder" to set theName to name of theFile
set theYear to my parse_year(theName)
if theYear is not "" then
set the year of theTrack to theYear
end if
end repeat
end tell
on parse_year(filenameText)
-- returns the year if it exists in filename with form song-1965.mp3, else returns empty string
try
set yearResult to do shell script "echo " & quoted form of filenameText & " | perl -ne 'print $1 if s/(?<=-)(\d+)(?=(\..*|$))/$1/'"
on error
set yearResult to ""
end try
return yearResult
end parse_year
Alcune note: