Possible Error in Official Discogs.src v1.06


#1

Hi!

When I use Discogs.src to get the tags for Discogs Release ID 996990, the output to the MEDIATYPE field is "CD". I would expect it to be "CD, Album, Reissue", since the code in Discogs.src explicitly selects the values in descriptions.

# Media Type

outputto "MEDIATYPE"
json_select_many "formats" "name" ", "
sayrest
json_select_many "formats" "descriptions" ", "
ifnot ""
say " "
endif
sayrest

The data structures (as shown in mp3debug.txt) are:

"formats": [{"qty": "1", "descriptions": ["Album", "Reissue"], "name": "CD"}]

So my question is: How do you correctly reference the values in the descriptions array?

Michael


Mp3tag featured Artists von Discogs laden...
#2

Hi Michael,

many thanks for bringing this to my attention — it's indeed not correct. A good way to also output the descriptions (while at the same time making clear that it's not the actual format) would be:

# Media Type
outputto "MEDIATYPE"
json_foreach "formats"
    json_select "name"
    sayrest
    json_select_array "descriptions" -1 ", "
    ifnot ""
        say " ("
        sayrest
        say ")"
    endif
json_foreach_end

What do you think?

Kind regards
– Florian


#3

Hi Florian,

thank you for your reply and the solution.

What do you mean by "... (while at the same time making clear that it's not the actual format) ..."? I just generated a new debug.txt - the format is exactly as displayed in the original post. Or did I get something wrong here?

Your solution works quite nicely and I think, it should become part of the next official discogs.src. I'll keep an eye on the output of the new code while tagging other records.

Many thanks and best regards,
Michael


#4

Hi Michael,

It's just a little bit different, but it's only a minor change: I've but the format descriptions in brackets to distinguish the actual format from the descriptions

CD, Album, Reissue
vs.
CD (Album, Reissue)

Great :slight_smile: Thanks again!

– Florian


#5

Oh, THAT you mean! Yeah, sure ... I thought you were reffering to the format of the input.

I also extended the original script to fill the tag MIXARTIST if present.

In the following discogs release I found interesting info on the musicians that played on an individual track:

https://www.discogs.com/Miles-Davis-Live-Ar.../release/396240

If you would like to adapt the official script, here is my suggestion:

		json_select_many "extraartists" "name" ", "
		ifnot ""
			outputto "MIXARTIST"
			set "tmp_join"
			json_foreach "extraartists"
				sayoutput "tmp_join"
				set "tmp_join"
				json_select "role"
				ifnot ""
					sayrest
				endif
				json_select "anv"
				ifnot ""
					say ": "
					sayrest
					saynewline
				else
					json_select "name"
					say ": "
					sayrest
					saynewline
				endif
			json_foreach_end
			say "|"
		else
			outputto "MIXARTIST"
			say "|"
		endif

I placed this right after the "artists" section in the tracklist loop.

Best regards,
Michael :slight_smile: