Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / October 2005



Tip: Looking for answers? Try searching our database.

iTunes SDK COM Interfaces

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
david.seruyange@gmail.com - 27 Oct 2005 21:42 GMT
Hey all,

I wrote a simple program that syncs my iTunes playlists with folders on
my machine. Because I download a lot of music (mixes/techno) I organize
by creating folders based on a month's downloads.  I sometimes find a
site with an artist that has multiple tracks, so I'll create a
subfolder for that month's downloads with that artist's name (like
Nullsleep at http://www.nullsleep.com).

Anywho, my very simple VB program clears/creates playlists based on a
root folder.  The following code is for deleting playlists and even
though it's Visual Basic it should make sense:

dim iPlay as IITPlaylist
dim iTunes as New iTunesApp

For Each iPlay in iTunes.LibrarySource.Playlists 'for each playlist
  If Instr(1, iPlay.Name, "::") > 0 Then 'if named w/ "::"
     iPlay.Delete 'get rid of it
  End If
Next

The strange thing here is that in order for it to work I just have to
run it multiple times.  I'm assuming that part of my problem is that
I'm modifying the collection I'm iterating through, but how would one
go about this?

Thanks much.
david.seruyange@gmail.com - 27 Oct 2005 23:03 GMT
Oof.  Don't you hate it when you post and then come up with a fix
*right after* you've posted? I thought about how I was modifying the
collection from my loop and revised the code as such to make it work:

dim iPlay as IITPlaylist
dim iTunes as New iTunesApp

Sub ClearLists
  For Each iPlay in iTunes.LibrarySource.Playlists 'for each playlist
     If Instr(1, iPlay.Name, "::") > 0 Then 'if named w/ "::"
        iPlay.Delete 'get rid of it
        ClearLists
        Exit For
     End If
  Next
End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.