python - Using Regex (or simmilar) to change song name (or other tag) in itunes via script -


so have scripting issue (and cannot find specific app in conjunction itunes).

i can script in python, have song title:

beat of heart - original mix

and want change beat of heart (original mix)

in python would:

string = 'beat of heart - original mix' location = string.index(' - ') fixed_string = string[,location] + '(' + string[location+3,] + ')' 

simple right? want batch in itunes (on mac) on tracks have labeled such

any suggestions?

thx

with applescript, can use text item delimiters:

set astid applescript's text item delimiters tell application "itunes"     repeat song in (selection of browser window 1)         set the_name name of song         if the_name contains " - "             set applescript's text item delimiters ("- ")             set the_name text items of the_name             set applescript's text item delimiters ("(")             set the_name (the_name string) & ")"             set name of song the_name         end if     end repeat     set applescript's text item delimiters astid end tell 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -