03-04-2025, 01:58 PM
(03-04-2025, 01:25 PM)romain Wrote:(03-03-2025, 11:18 PM)Tim Curtis Wrote:(03-03-2025, 11:00 PM)romain Wrote:(03-03-2025, 10:14 PM)Tim Curtis Wrote:(03-03-2025, 05:59 PM)romain Wrote: On the other hand I have no idea how the HD badge is displayed
Have a look at the } else { block around line 685
I can determine if the stream is HD by comparing bit depth and sample rate and tried this
PHP Code:$result = sysCmd('mediainfo --Inform="Audio;file:///var/www/util/mediainfo.tpl" ' . '"' . $songData['file'] . '"');
$bitDepth = $result[0];
$sampleRate = $result[1];
$channels = $result[2];
$format = $result[3];
$hiDef = ($bitDepth > ALBUM_BIT_DEPTH_THRESHOLD ||
$sampleRate > ALBUM_SAMPLE_RATE_THRESHOLD) ? 'h' : 's';
$encodedAt = 'UPnP ' . $format . ' ' . $bitDepth . '/' . formatRate($sampleRate) . ' kHz'. ',' . $hiDef . ',' . $channels . 'ch';
/* $encodedAt = 'UPnP ' . $format . ' ' . ($bitDepth == '?' ?
formatRate($sampleRate) . 'kHz' :
$bitDepth . '/' . formatRate($sampleRate) . ' kHz, ' . $channels . 'ch'); */
of course I miss something to get the HD badge displayed because as a result I get this
Ok, yes of course. That code was from the section that handles only tracks in the MPD database.
The badge display code is in playerlib.js
Code:// Set HD badge text
if (MPD.json['artist'] == 'Radio station') {
$('.playback-hd-badge, #playbar-hd-badge, #ss-hd-badge').text(RADIO_HD_BADGE_TEXT);
} else {
$('.playback-hd-badge, #playbar-hd-badge, #ss-hd-badge').text(albumHDBadge(MPD.json['audio_format']));
}
A few tests made me figure out that there's no relation between HD badge display and the $encodedAt variable in music-library.php because, with local files, even if $encodedAt is not populated, the HD badge is displayed.
As for the playerlib.js file, I took a look at it on github but I don't have the development environment to modify and recompile it into lib.min.js ; is there a guide somewhere on how to do that please ?
Sure, visit moodeaudio.org and click "Developer". That will get you to all the dev documentation.