iTunes (windows) and the Command line...
July 27, 2005 2:16 PM   Subscribe

Does anyone know if there a way to add a file to add an MP3 to my iTunes library, on Windows, using the command line?

I'm trying to automate a process, whereby
1 - Each day, a WAV file ends up in a folder on my computer.
2 - I set a batch file to encode this, using LAME.
3 - This gets added to my iTunes library automatically, and then it gets automatically placed on my iPod next time I sync.

I've tried putting this in the file

START c:\progra~1\iTunes\iTunes.exe "W:\Radio\BBC Radio 1\Zane Lowe\Zane Lowe.mp3"

That will add the file to the library, but also starts playing it. I don't want that to happen, because I might not be at my PC, or I might be playing something else.

Thanks in advance.
posted by ascullion to Computers & Internet (16 answers total) 1 user marked this as a favorite
Automatic play-on-encoding is set on or off via iTunes' preferences window.

Preferences -> Importing -> "Play songs while importing"

Can iPods play LAME-encoded MP3s?
posted by Rothko at 2:33 PM on July 27, 2005

It looks like this app may help.
posted by neckro23 at 2:37 PM on July 27, 2005

Thanks Rothko, but that only applies to file coming from a CD, not to files being added from the file system.

Yes, iPods can play any MP3 file.
posted by ascullion at 2:37 PM on July 27, 2005

Yes, iPods can play any MP3 file.

Thanks, I was aware that iPods could play Fraunhofer MP3s but didn't know Apple had added LAME MP3 support. Very cool.
posted by Rothko at 2:40 PM on July 27, 2005

Some people say that LAME VBR files will skip on an iPod, but I've never noticed it.

Looking into that app now, neckro23, thanks. Could well do the job. Don't know how I've never come across it before..
posted by ascullion at 2:44 PM on July 27, 2005

If you know any programming, you could use iTunes' COM interface (it works with JScript, C#, PHP, C++).
posted by null terminated at 2:49 PM on July 27, 2005

I've only used iTunes a couple times, but...

isn't the iTunes library an xml file? Can't you just write a script to append the new filename (in proper format) to some location within the library xml?
posted by rxrfrx at 3:36 PM on July 27, 2005

why not make a local podcast and add it that way? You'll even be able to set the number of files you want on your ipod at a time and the expiration time for them to be removed automatically.
posted by n9 at 4:16 PM on July 27, 2005

I'd imagine some sort of echo to the library xml file added to your batch file should work... though off the top of my head I can't think how to do it and ensure everything is closed off properly. Personally, I'd probably use VBA, but that's because that's what I know.
posted by pompomtom at 7:22 PM on July 27, 2005

I'd say editing the XML file is the way to go but I'm not sure how often iTunes reads the XML file. I tried manually changing something once (I was bored) and I seem to recall it didn't show up until I had quit/restarted iTunes.
posted by docgonzo at 8:33 PM on July 27, 2005

I wrote this JScript which you can download here.

To run it, download it to your computer and then type

addToPlaylist.js <file> [playlist]

Where file is the path to the file you want to add and playlist is the optional playlist to which you want to add the file. If you don't specify the playlist, it should add the file to the main library.

Let me know if it doesn't work.
posted by null terminated at 8:47 PM on July 27, 2005 [1 favorite]

This is sweet. I have a windows job that calls command line Streamripper to rip KEXP every Thursday night, but then I import it into iTunes by hand. I'll have to check out some of these suggestions.
posted by matildaben at 10:37 PM on July 27, 2005

Thanks for all the brilliant suggestions. I'll check them out tonight and let you know how I get on.
posted by ascullion at 11:38 PM on July 27, 2005

ascullion: Were you able to get that working?
posted by null terminated at 11:04 PM on July 28, 2005

Haven't had time to look at it yet, am doing so right now.. thanks for asking, will come back and report.
posted by ascullion at 7:01 AM on July 29, 2005

It works! Thank you so much!

Initially, it wouldn't work. I had just been giving the filename. I then put the entire path to the file in, like so

addToPlaylist.js "W:\Radio\BBC Radio 1\Zane Lowe\Zane.mp3"

And then it added the file.

Then I tried it while I was playing a song - it added the file, and didn't stop what I had playing.

Then i tried it when iTunes wasn't running - and it opened iTunes and added the file.

So all eventualities are covered.

Great stuff, thanks again. I hope I can answer something for you one day.
posted by ascullion at 7:22 AM on July 29, 2005

« Older How do I invest leftily and lazily?   |   Skinny kitty Newer »
This thread is closed to new comments.