JSON Files

Is it possible for Mp3tag to …

  1. Save locally the files obtained from the TagSources queries?

  2. Can it read local (not http served) json files within the TagSources process?

I am aware it would need to be scripted, however, is it possible?

  1. Yes, with debugger option (t keeps only the last file though).
  2. No. A workaround is to install php server and to access the stored files from there.


I found a JSON Server on GitHub (https://github.com/typicode/json-server) that may do the trick for #2. I haven't tested it as yet though.

My intention is to use this as a local backup/restore of tags (many many tracks worth over many many years from many disparate sources which I could not easily reconstitute). Mp3tag needs an option to read csv headers or import json files or similar.

Thanks again.

Well, you can backup your tags. Search the forum and you will find info.
You can import tags from text file. Each line contains tags of a single track.

I would like to add a little more specific information to that:
for exports ther is the $list function that outputs the contents of all fields of a file to the report file.

For fields that contain linebreaks you have to devise a special treatment as the linebreaks would violate the csv-format which requires a single line for each record. The linebreak is in fact the end-of-record marker. E.g. UNSYNCEDLYRICS very often has linebreaks.

If you have various sets of fields in the different files, you will have difficutlties with the $list function as you will not get a proper csv file.

You can use Mp3tag export feature to write tag-field content to text file.
For example, create an export script and apply a code line like the following ...

$char(9)'{'$regexp($regexp($regexp($regexp($list('"','": "','",'$char(13)$char(9)$char(10)),'\r\n','U+000DU+000A'),'\r\t\n','\r\n'),'\\\\','\\\\'),',\Z',)'}'

... maybe escaping of the double-apostrophe must be worked in additionally.