Using the iTunes SDK to Update Library Info

:apple:

This is a continuing look at what we can accomplish with the  iTunes SDK.   If you have missed the previous articles in this series please take a look at  An introduction to Apple’s iTunes SDK, Removing Duplicate Songs, and Removing Orphaned Songs

The script I am going to introduce tonight is a simple one.   A friend of mine was interested in a script that would update the information in the library from the tags in the file.   He used a separate program to update the MP3 information in his library and needed a way to tell iTunes to update it’s info.  

In this script I really only have one goal, update the song info with what is in the file.

Again.. the first part of the script will look very familiar if you have seen any of the scripts from the previous articles on Removing Duplicate Songs and Removing Orphaned Songs

set objApp = CreateObject("iTunes.Application")
set objLibrary = objApp.LibraryPlaylist
set colTracks = objLibrary.Tracks

We next enter a loop through all the tracks and execute the command to update the library information from the file. 

For Each objTrack in colTracks
	objTrack.UpdateInfoFromFile()
next

After the loop through all the tracks is finished, we destroy our objects and free up memory.

set objApp = nothing
set objLibrary = nothing
set colTracks = nothing

All that is left is to let the user know that the process is done..

WScript.Echo("Finished updating library")

Please leave me a comment if you found this script useful or have any questions.

You can download the commented script using the following link:

UpdateFromFile.zip

Technorati Tags: , ,

StumbleUpon It!

If you found this page useful, consider linking to it.
Simply copy and paste the code below into your web site (Ctrl+C to copy)
It will look like this: Using the iTunes SDK to Update Library Info


Enjoy this post? Please consider leaving a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)