Thanx Dano ... your advice was quite helpful in resolving that issue. But I am still not getting the results I would expect. I have limited my JSON response string to 2 entries for testing purposes but I can not find a way for the script to loop through those entries and populate the results for user selection. Basically, all the script is doing is reading the first JSON object and searching for that in iTunes. I have tried to do...while loop to no avail. Is there a way to define an array and iterate through it in the scripting?
Also, since the JSON only captures specific information I need a way to capture the Artist ID from JSON and then use that to dynamically alter the IndexURL for the artist specific page. Is that possible?
Clearly, I am confused here and appreciate all that you can do to direct me to a solution.
Here is the script I have so far.....
[Name]=iTunes JSON Parser
[BasedOn]=http://itunes.apple.com
[IndexUrl]=http://itunes.apple.com/search?term=%s&entity=album&attribute=artistTerm&limit=2
[AlbumUrl]=http://itunes.apple.com
[WordSeperator]=+
[IndexFormat]=%_url%|%Artist%|%Album%
[SearchBy]=%artist%
[Encoding]=utf-8
[ParserScriptIndex]=...
############################
# SEARCH RESULTS DIALOG #
############################
debug "on" "appdata\roaming\mp3tag\itunes.txt"
# ARTIST URL
findline "wrapperType\""
findinline "\"artistViewUrl\":\""
sayuntil ","
say "|"
#Artist
findline "wrapperType\""
findinline "\"artistName\":\""
sayuntil "\""
say "|"
# Album
findline "wrapperType\""
findinline "\"collectionName\":\""
sayuntil "\""
say "|"
# saynewline
[ParserScriptAlbum]=...
############################
# ALBUM/TAG CONFIRMATION DIALOG #
############################
debug "on" "appdata\roaming\mp3tag\itunes.txt"
#Artist
outputto "Artist"
findline "wrapperType\""
findinline "\"artistName\":\""
sayuntil "\""
#Album
outputto "Album"
findline "wrapperType\""
findinline "\"collectionName\":\""
sayuntil "\""
writeoutput "appdata\roaming\mp3tag\itunes.txt"
And here is the JSON response info that I am using for the testing (I sent it through a validator for readability):
{
"resultCount":2,
"results":[
{
"wrapperType":"collection",
"collectionType":"Compilation",
"artistId":32317,
"collectionId":391453,
"amgArtistId":64591,
"artistName":"Cinderella",
"collectionName":"20th Century Masters - The Millennium Collection: The Best of Cinderella",
"collectionCensoredName":"20th Century Masters - The Millennium Collection: The Best of Cinderella",
"artistViewUrl":"http://itunes.apple.com/us/artist/cinderella/id32317?uo=4",
"collectionViewUrl":"http://itunes.apple.com/us/album/20th-century-masters-the-millennium/id391453?uo=4",
"artworkUrl60":"http://a5.mzstatic.com/us/r1000/057/Features/a9/a5/3c/dj.rjjqxwcu.60x60-50.jpg",
"artworkUrl100":"http://a3.mzstatic.com/us/r1000/057/Features/a9/a5/3c/dj.rjjqxwcu.100x100-75.jpg",
"collectionPrice":9.99,
"collectionExplicitness":"notExplicit",
"trackCount":12,
"copyright":"2000 The Island Def Jam Music Group",
"country":"USA",
"currency":"USD",
"releaseDate":"2000-08-15T07:00:00Z",
"primaryGenreName":"Rock"
},
{
"wrapperType":"collection",
"collectionType":"Album",
"artistId":32317,
"collectionId":41419707,
"amgArtistId":64591,
"artistName":"Cinderella",
"collectionName":"Rocked, Wired & Bluesed: The Greatest Hits",
"collectionCensoredName":"Rocked, Wired & Bluesed: The Greatest Hits",
"artistViewUrl":"http://itunes.apple.com/us/artist/cinderella/id32317?uo=4",
"collectionViewUrl":"http://itunes.apple.com/us/album/rocked-wired-bluesed-the-greatest/id41419707?uo=4",
"artworkUrl60":"http://a4.mzstatic.com/us/r1000/002/Features/c6/f9/aa/dj.brpwqede.60x60-50.jpg",
"artworkUrl100":"http://a4.mzstatic.com/us/r1000/002/Features/c6/f9/aa/dj.brpwqede.100x100-75.jpg",
"collectionPrice":9.99,
"collectionExplicitness":"notExplicit",
"trackCount":17,
"copyright":"2005 The Island Def Jam Music Group",
"country":"USA",
"currency":"USD",
"releaseDate":"2005-01-25T08:00:00Z",
"primaryGenreName":"Rock"
}
]
}