Can't add list of URL tracks to playlist

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

amix

New member
Joined
Feb 9, 2012
Messages
1
Points
0
Hi,

in order to safe myself from entering plenty of radio-stations manually into a iTunes user-playlist I want to automate that. The station's addresses are being sucked out of a webpage and then stored as a list. However, the way I would assume it should work, doesn't.

I'd assume (please note, that I took out the real HTTP links from the code below, since the forum forbids me to post links, since I am a new member):
Code:
set theList to {¬
	"foo.link1", ¬
	"foo.link2/listen.pls", ¬
	"etc.link"}

tell application "iTunes"
	
	set mypl to make new user playlist with properties {name:"Hungarian Radio"}
	
	repeat with _ix in theList
		set _theTrack to make new URL track with properties {name:_ix, address:_ix}
		add _theTrack to mypl
	end repeat
	
end tell
a) "make new" does not allow for making new URL tracks (crying out loud!)
b) one can "add" only file tracks (even louder!)

So I looked around and found this solution by Doug to a similar problem (again, can't post direct link due to spam protection. The post is in this very forum and named "Topic: add URL Track to Playlist").

However, I can't get it to work. What happens is, that the URL track gets opened, the first few bytes start playing, then it stops but on trying to duplicate to the playlist it errors out. The error is:
Code:
iTunes got an error: Can’t get some URL track of library playlist 1 whose address = "some.host/aktivuj.pls".
Here is what I have done:
Code:
set theList to {¬
	"foo.link1", ¬
	"foo.link2/listen.pls", ¬
	"etc.link"}

tell application "iTunes"

	set _newPlayList to make new user playlist with properties {name:"imported-" & (current date)}
	
	repeat with _streamURL in theList
		set _ut to contents of _streamURL
		open location _ut
		stop -- don't play right away
		set new_stream to (some URL track of library playlist 1 whose address is _ut)
		duplicate new_stream to playlist _newPlayList
	end repeat
end tell

	
end tell
 
Top