I'm not an expert in JavaScript development, but sometimes I make some customizations to the tools I generally use.
In this case I have wrote an function to calculate album an track PLR.
function calculate_PLR(gain,gaindb) {
var lufs = -1800 - gain.replace(/[^0-9+-]/g,'') ;
var tpfs = gaindb.replace(/[^0-9+-]/g,'');
var plr = tpfs - lufs
var plr_value = plr.toString().substring(plr.toString().length -2) > 49 ? plr += 100 : plr;
plr_value = plr.toString().substr(0,plr.toString().length -2)
return plr_value;
}
I have add with success this code in Header-->draw_normal_header
if (_tf('[%replaygain_album_gain%]', metadb) && _tf('[%replaygain_album_peak_db%]', metadb)) {
plr_cd = ' | ' + calculate_PLR(_tf('%replaygain_album_gain%', metadb),_tf('%replaygain_album_peak_db%', metadb)) + ' LU'
}
and in row-->draw
if (_tf('[%replaygain_track_gain%]', metadb) && _tf('[%replaygain_track_peak_db%]', metadb)) {
var plr_track = calculate_PLR(_tf('%replaygain_track_gain%', metadb),_tf('%replaygain_album_track_db%', metadb))
}
I have implemented ad entry in "Appearance" in coherence with general theme.
I planning to make a correct use of PLR CD in sub-header option because if have, for example, a 2 disc set album, and sub-header option enabled, i must insert the PLR CD value in sub-header line, and not in Header line.
Will go insert in sub-header (DiskHeader-->draw) but I haven't metaDB variable. There are a way to take this variable? At this time I haven't find it.
Furthermore I noticed that this code It does not work anymore:
disc_number = _tf('$ifgreater(%totaldiscs%,1,[ | Disc: %discnumber%/%totaldiscs%]', metadb);
what is _tf()
Thanks in advance to anyone who can help me.