nightson / UserScripts

Greasemonkey scripts for my own use.
5 stars 1 forks source link

Upcoming dr_ring_0_mo* fieldname changes #4

Closed JohnVeness closed 2 years ago

JohnVeness commented 2 years ago

See https://github.com/SabreTools/MPF/issues/376. Sorry, I prompted this one!

I'd do a PR for a simple rename, but presumably you'll want to gracefully handle both old and new file formats, so that'll be trickier.

I'm intrigued to hear there's a different "internal" new disc form, though. I don't suppose you know anything about that?

nightson commented 2 years ago

Ha I noticed that a long time ago but thought it was a mistake by iR0B0t :P.

It should be easy to fix.

I didn't know there was a different new disc form for mods but I guess it's just a more comprehensive one.

nightson commented 2 years ago

https://github.com/nightson/UserScripts/commit/767b6e93511451373fb6e4a30abbcf6abceb6cc3

JohnVeness commented 2 years ago

Hi. I'm not sure this code is quite right yet. With the following in the JSON:

    "d_ring_0_ma1": "sonopress arvato<tab>51544170/MCR5CDUK00 CC 21",
    "d_ring_0_ma1_sid": "IFPI LB 46",
    "d_ring_0_ts1": "",
    "d_ring_0_mo1_sid": "IFPI 07D1",
    "dr_ring_0_mo1": "",
    "d_ring_0_ma2": null,
    "d_ring_0_mo2_sid": "",
    "d_ring_0_ma3": null,
    "d_ring_0_ma4": null,
    "d_ring_0_offsets": "1",
    "d_ring_count": "1",

I get the following in the newdisc form:

Mastering Ring: sonopress arvato<tab>51544170/MCR5CDUK00 CC 21
Mastering SID: IFPI LB 46
Toolstamp/Mastering Code: 
Mould SID: IFPI 07D1
Additional Mould: undefined

Note the "undefined" in Additional Mould. I think this is because of the line 'Additional Mould: ' + (ringInfo.dr_ring_0_mo1 || ringInfo.d_ring_0_mo1); but d_ring_0_mo1 doesn't exist in this input file.

JohnVeness commented 2 years ago

Actually, this might just be a general problem. See #6.

nightson commented 2 years ago

d_ring_0_mo1

Actually the problem is that I forgot that ringInfo.dr_ring_0_mo1 would also be converted to false if it's null or empty string. My programming skill is very limited. This should be easy to fix though.