Here's the code I have, see the bottom of this for the album and selection of the release array and then selecting the name which doesn't work.
In the help file, it doesn't mention whether or they are 0 or 1 based arrays. From my limited knowledge and testing of the JSON methods, I presume they're 1 based.
If anyone knows how to do this without doing a loop on the releases array then I'd greatly appreciate it.
I want to select the first releases array element and get the info from that.
[Name]=beatport.com [v5.0 by steveheroβ’] (β£_β’)
[BasedOn]=https://www.beatport.com
[IndexUrl]=https://www.beatport.com/search/releases?q=%s&per-page=150&sort=release-desc
[AlbumUrl]=
[WordSeparator]=+
[IndexFormat]=% β ID (β£_β’)β’%|% β RELEASE%|% β ARTIST/S%|%_URL%
[Encoding]=url-utf-8
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
[ParserScriptIndex]=...
findline "<!DOCTYPE html>"
findinline "<!DOCTYPE html>"
joinuntil "</html>"
replace "|" "$verticalBar()"
regexpreplace "(?i).*?window\.Playables\s*?=\s*?(\{.+);.*?window\.Sliders\s+=\s+\[.*" "$1"
json "ON" "current"
json_foreach "releases"
json_select "id" # ID
sayrest
say "|"
json_select "name" # RELEASES
sayrest
say "|"
json_select_many "artists" "name" " β " # ARTIST(S)
sayrest
say "|"
say "https://www.beatport.com/release/" # PREVIEW
json_select "slug"
sayrest
json_select "id"
say "/"
sayrest
saynewline
json_foreach_end
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
[ParserScriptAlbum]=...
findline "<!DOCTYPE html>"
findinline "<!DOCTYPE html>"
joinuntil "</html>"
replace "|" "$verticalBar()"
regexpreplace "(?i).*?window\.Playables\s*?=\s*?(\{.+);.*?window\.Sliders\s+=\s+\[.*" "$1"
debug "on" "W:\Apps (Portable)\Music Apps\Mp3tag\data\sources\Beatport Pro\debug album BEATPORT.html" 20 # Place before headings to want to debug
json "ON" "current"
outputto "ALBUM"
json_select_array "releases" 1
json_select "name"
sayrest
With their new website the result is actually a json data packet without the header.
Have you tried reconstructing the full json packet inserting data-json=' in front of the packet ?
Needless to say both main and classic sites are down at the moment, worth working on traxsource nowadays . Beatport behaviour handling their server downtime is baffling . Seeing so many Djs losing profit with those issues will surely create a migrating trend towards tracksource and juno I guess.
Would have help you more with your scripts but I developed my own software to automate all searches and months after months I made it almost fully independent from mp3tag. I am a former hardcore 68k programmer and hate correcting other people's bugs so I get only myself to blame. ( tag reader, json paser and so on..) it tags a track in about 5 seconds on average
Sorry for the late reply. I was looking into the issue and so far json_select_array was assuming string elements. In you example, beatport is returning objects as array elements.
A possible solution would be to automatically select the object to the current input so that json_select would operate on the properties of this object. A call to json_unselect_object would be necessary if you want to continue operating outside of this object.
You can try the latest development build Mp3tag v2.99d where I've changed the behavior of json_select_array as outlined above. A call to json_unselect_object is then necessary if you want to continue operating outside of the selected object.