I agree with the above coments about Apple not being sympathetic to 3rd parties updating the iPhone directly. I think the idea of using iTunes as a staging area before getting to the iPhone works well. Apple have published the COM interface and this does seem to be stable across iTunes and iPhone releases I'd suggest to the MM team that they pursue this as a better way to link to the iPhone.
Following my earlier premature posting of the 1.1 version of my script I went away and did a hefty re-write. This is NOT a mediamonkey script but a standalone VB Script. Edit the file and modify the last line to point to a directory with m3u playlist files. Simply double-click the .vbs file to launch it. As before the script will iterate through the playlists and add them into iTunes along with their associated tracks. As before already present playlists are skipped.
The reason for the change of direction is that I prefer to keep the master copy of my library as files with embedded tags and use MM as an editor. This means maximum compatibility with other family members and use simple backup facilities. It also allows me to edit the library with mediamonkey and download from iTunes on separate machines.
http://rapidshare.com/files/252946994/F ... s.vbs.html
VBS file content follows ....
option explicit
Function readPlaylistList( DirName )
dim fso : set fso = CreateObject( "Scripting.FileSystemObject" )
dim folder : set folder = fso.getFolder( DirName )
dim files : set files = folder.Files
dim list()
dim i : i = 0
dim file : for each file in files
if instr( file.name , ".m3u") > 0 then
'wscript.echo(file.name)
redim preserve list(i)
list(i) = file.name
i = i + 1
end if
next
set files = nothing
set folder = nothing
set fso = nothing
readPlaylistList = list
end function
function readPlaylistFile( FileName )
Const ForReading = 1
dim fso : set fso = CreateObject( "Scripting.FileSystemObject" )
dim list() : redim list(0)
'wscript.echo( "Read from playlist " & filename )
dim ts : set ts = fso.OpenTextFile(FileName, ForReading)
dim i : for i = 0 to 10000
dim t : t = ts.readline()
if ts.AtEndOfStream then exit for
redim preserve list(i)
list(i) = t
next
ts.Close()
set ts = nothing
set fso = nothing
'wscript.echo( "Read " & ubound(list) & " tracks" )
'dim k : k = "<"
'dim j : for each j in list
' k = k +""""+ j + """"+chr(10)+chr(13)
'next
'k = k + ">"
'wscript.echo( k )
readPlaylistFile = list
end function
' Exports the all of the playlists in the given folder to itunes
sub FilesToItunes( sMMName )
dim playlists : playlists = readPlaylistList(sMMName)
'wscript.echo( "playlists" & cstr(ubound(playlists)) )
'wscript.echo( "Last is " playlists.item(ubound(playlists)))
'wscript.echo( "Open iTunes" )
dim iTunesApp : set iTunesApp = CreateObject("iTunes.Application")
if iTunesApp is nothing then
wscript.echo("Cannot open the iTunes Application")
else
dim pl : set pl = iTunesApp.LibraryPlaylist.Source.playlists
' try to reuse a previous playlist folder
dim itFolder : set itFolder = pl.itembyname(sMMName)
if itFolder is nothing then set itFolder = iTunesApp.CreateFolder(sMMName)
if itFolder is nothing then
wscript.echo( "Unable to create folder")
else
dim addPlaylist : addPlaylist = 0
dim addTrack : addTrack = 0
dim playlist: for each playlist in playlists
'wscript.echo("Playlist " + playlist )
' does it exist in iTunes already?
dim new_playlist : set new_playlist = pl.ItemByName(playlist)
' it doesnt so we need to add it
if new_playlist is nothing then
' create the new playlist
set new_playlist = itFolder.CreatePlaylist(playlist)
' get the tracks from the file
dim tracks : tracks = readPlaylistFile( sMMName & "\" & playlist )
dim j : for each j in tracks
'wscript.echo( "Add track " & j & " to " & playlist )
dim operationStatus : set operationStatus = new_playlist.AddFile(sMMName & "\" &j)
if not operationstatus is nothing then
while operationstatus.InProgress
'doevents
wend
end if
addTrack = addTrack + 1
next
addplaylist = addPlaylist + 1
end if
'wscript.echo( "Add Track " & cstr(addTrack) )
next
wscript.echo("Updated " & cstr(AddPlaylist) & " playlists and " & cstr(addTrack) + " tracks" )
end if
end if
end sub
FilesToItunes("k:\Dad\Music\Playlists")