what do you mean add the image twice? unless you include the lines I was trying that I commented out there.
what's irritating is you have download and save to disk as a jpg, read it back, write it back to a pict, read the pict, and finally write (a portion of the pict) out to the id3 tags.
it should be possible to do all, or almost all, of that in memory, don't you think?
regarding the sloth radio, the benefit is indeed to avoid the subscription. I'm not so sure that it would be within the terms of the AWS license to use their images in this way. Clearly they are aiming to get people to put their content on their web pages for click-through sales. Now whether it is technically illegal or not, or violates their license, or whatever, I don't know without a lawyer. But I did scan the agreement enough to get that "sense". I'm sure a lot of people use it for "other purposes" but I don't know what it would take to get them to notice. My guess is it would depend on how "popular" your application (that you included your AWS tolkein in) became.
Thus, I think if possible to bypass that it would be better. Nothing says you can't access their publicly accessable URLs, no matter how you get them.
ANyway, I don't intend to tear my hair out over it, but I took a couple of brief stabs--so far unsuccessful at parsing the sloth stuff.
reading the source does not seem to work unless you download the URL and then open it in safari first (getting the source from the document window and not the file).
if you use url access scripting to download the file, then I thought you could use read ... using delimiters to get the records, then it would be a simple matter of getting the first record that had "amazon" in it and extracting the URL (don't know how to do that either... just wanted to get the record first...)
but for some reason, this doesn't do anything like what I expect:
(to test, download the results of a slothradio seach and save on desktop with name "sloth.html" (as .html source of course)
set tempdir to (path to desktop) as string
set theFile to open for access (tempdir & "sloth.html") as alias
set therecs to read theFile using delimiter {("<!-- RESULT ITEM START -->" & return), ("<!-- RESULT ITEM END -->" & return)}
--{"RESULT ITEM START", "RESULT ITEM END"}
--{"start", "end"}
close access theFile
return therecs
as for the stuttering playback, yes, if you add art to a file playing, or for that matter even change the ID3 tags, it will tend to do that.
For that reason it might be prudent to get the index of the track, and do the operation of the next track to play.
my idea at this point is to do something like that and save the image in either a) a cache file location compatible with "Clutter" (whose cache files my salling clicker app is already using), or b) the album folder. I'm inclined to do the latter, but I don't know how many people would object to having a script populate their music folders with .jpgs. for me it would be desirable and would save more space in the end than adding artwork.
at some point i need to post my geek tool script that puts track info and a picture on the desktop, but it is sort of a pro-user sorta thing, but works really well for me.
PS: anyone know off hand how to test whether we have an internet connection and how fast it is?
PPS: my console log is showing URL Access Scripting repeatedly crashing when running this script (or my version of it which is almost the same -- I think I commented out the Try..quit..end try part in that routine; why would you want to quit URL Access Scripting each call?)
PPPS:
there's are a couple of threads about artwork going on on macscripter:
http://bbs.applescript.net/viewtopic.php?id=13020