Hi,
I currently use an app for this which works fine but I am trying to automate the process and run this script within a folder action workflow.
I want to take some information from the file name of an mp3 file, and tag the ID3 with "a song title", "an artist" and "an album" (constant).
Songs are saved as;
%artist% - %title% %ConstantTextIgnore%.extension
for example
Ed Sheeran - Sing [constant text to ignore].mp3
and then set the album as as "NewMusic"
Could anyone do this please?
p.s. I found something close to what I want I think online, except it runs using iTunes rather than as part of a folder action workflow, and it also is specifically for setting the year only.
I currently use an app for this which works fine but I am trying to automate the process and run this script within a folder action workflow.
I want to take some information from the file name of an mp3 file, and tag the ID3 with "a song title", "an artist" and "an album" (constant).
Songs are saved as;
%artist% - %title% %ConstantTextIgnore%.extension
for example
Ed Sheeran - Sing [constant text to ignore].mp3
and then set the album as as "NewMusic"
Could anyone do this please?
p.s. I found something close to what I want I think online, except it runs using iTunes rather than as part of a folder action workflow, and it also is specifically for setting the year only.
Code:
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