Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically add songs to iTunes

Is it possible to add songs to iTunes on OS X programmatically? I.e. say I have a directory of songs I'd like to add to iTunes from a Python script. What is the easiest way to achieve that?

like image 977
houbysoft Avatar asked Jan 19 '26 09:01

houbysoft


1 Answers

iTunes has a special folder where it looks for music files to add it automatically to its library:

/Users/<your_username>/Music/iTunes/iTunes Media/Automatically Add to iTunes

(move to this folder by

cd /Users/<your_username>/Music/iTunes/iTunes\ Media/Automatically\ Add\ to\ iTunes)

All you have to do is to write a python or shell script that copies your music into this folder. e.g., for python

import commands
commands.getoutput("cp file.mp3 /Users/<your_username>/Music/iTunes/iTunes Media/Automatically Add to iTunes")

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!