Some issues / suggestions for Websource Scripts.
- JSON. Impossible to know if complex structure not found. Last version 2.66 added new command json_select_object and its sibling json_unselect_object. All is good except when queried object does not exist in JSON structure. A kind of check returncode command (json_found) is needed. Hopefully this is already fixed in v2.67 (I missed the chance to test it).
- JSON "ON" command reads the original stream. I have build a generic WS script can convert all kind of input XML stream to JSON (see this post for example). I would expect JSON "ON" command parses the current (modified) stream. XML-to-JSON script would help many WS scripts to be improved and/or simplified.
- Impossible to show a value in multiple output items in '['ParserScriptIndex']' section. Many sites (discogs, musicbrainz, etc) return certain header info: nr of items found, nr of items per page, current page. User is not able to know whether other "hidden" records exist.
- In aspect of paging info, smth must be foreseeing so user can "navigate" to different pages of found results.
- Ability to format collected tags within WS.
Tag tmpTracks has current value "1|2|3|4|5" (| is track separator) during WS execution.
Now, let's say we want to apply a WS command (replace, regexp, etc) to tmpTracks (add leading zeroes, etc). That's not possible.
That could be possible with a new command, smth like SelectTag.
E.g. just a sample script.
outputto "tmpTrack" say "1" say "|" ... outputto "tmpTrack" say "2" say "|" ... outputto "tmpTrack" say "3" say "|" .... selectTrack "tmpTrack" set "tmpTrack" outputto "tmpTrack" RegexpReplace "(^|\|)]" "0"
- Re-usable code. Many scripts build for same site share the same album parser (e.g. 6 Amazon scripts). Instead of copy/paste the same code into many various scripts, wouldn't it be better to use the "Include file" logic? This way we work only in one "include" file (those cannot be .src of course) and re-used in the real .src files (one time entry). Similar idea stands for all other sites when we create many scripts variations. Not a must, only a nice to have since it affects only us, the "scriptwriters".
- Introduce statements to add/change/(re)move/copy json elements. Currently can be possible (not always good result) by using complex regexp. Having the ability to "change" json structure on the fly would simplify a lot json scripts and let us cover more complex cases.
To be continued...