Posts: 14,134
Threads: 323
Joined: Mar 2018
Reputation:
578
(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: (03-03-2025, 05:49 PM)Tim Curtis Wrote: That could work.
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']));
}
Posts: 14,134
Threads: 323
Joined: Mar 2018
Reputation:
578
Can you provide some sample mediainfo output for a couple UPnP files? thanks
Code: mediainfo --Inform="Audio;file:///var/www/util/mediainfo.tpl" "http://FILE"
Posts: 189
Threads: 20
Joined: Mar 2020
Reputation:
3
(03-04-2025, 12:44 PM)Tim Curtis Wrote: Can you provide some sample mediainfo output for a couple UPnP files? thanks
Code: mediainfo --Inform="Audio;file:///var/www/util/mediainfo.tpl" "http://FILE"
Sure, a bit later today when I'm back home
Posts: 189
Threads: 20
Joined: Mar 2020
Reputation:
3
03-04-2025, 01:25 PM
(This post was last modified: 03-04-2025, 01:27 PM by romain.)
(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: (03-03-2025, 05:49 PM)Tim Curtis Wrote: That could work.
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 ?
Posts: 14,134
Threads: 323
Joined: Mar 2018
Reputation:
578
(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.
Posts: 189
Threads: 20
Joined: Mar 2020
Reputation:
3
(03-04-2025, 01:58 PM)Tim Curtis Wrote: (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: 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.
Ah yes, thanks @ Tim Curtis
Posts: 14,134
Threads: 323
Joined: Mar 2018
Reputation:
578
03-04-2025, 03:05 PM
(This post was last modified: 03-04-2025, 03:05 PM by Tim Curtis.)
You might not need to get into the JS.
Have a look at function enhanceMetadata() in /inc/mpd.php
Theres a code block at the bottom that handles the badges and its not considering http:// files
Code: // Determine badging
// NOTE: This is modeled after the code in getEncodedAt()
if (!(substr($song['file'], 0, 4) == 'http' && !isset($current['duration']))) { // Not a radio station
sendMpdCmd($sock, 'lsinfo "' . $song['file'] . '"');
$songData = parseDelimFile(readMpdResp($sock), ': ');
$mpdFormatTag = explode(':', $songData['Format']);
if ($ext == 'mp3' || ($mpdFormatTag[1] == 'f' && $mpdFormatTag[2] <= 2)) {
// Lossy
$current['hidef'] = 'no';
} else if ($ext == 'dsf' || $ext == 'dff') {
// DSD
$current['hidef'] = 'yes';
} else if ($ext == 'wv') {
// WavPack DSD
$current['hidef'] = 'yes';
} else {
// PCM or Multichannel PCM
$current['hidef'] = ($mpdFormatTag[1] == 'f' || $mpdFormatTag[1] > ALBUM_BIT_DEPTH_THRESHOLD ||
$mpdFormatTag[0] > ALBUM_SAMPLE_RATE_THRESHOLD) ? 'yes' : 'no';
}
}
Maybe adding an else at the end and having that code block determine if its a UPnP file and then if yes, adding a badge if needed.
A UPnP file would have these attributes
Code: substr($song['file'], 0, 4) == 'http' && isset($current['duration'])
Posts: 14,134
Threads: 323
Joined: Mar 2018
Reputation:
578
Posts: 189
Threads: 20
Joined: Mar 2020
Reputation:
3
03-05-2025, 01:43 PM
(This post was last modified: 03-05-2025, 01:54 PM by romain.)
(03-05-2025, 12:50 PM)Tim Curtis Wrote: Try the 2 files from this commit
https://github.com/moode-player/moode/co...1cb4e8b951
HD
Non-HD
I was just about to send you mine, got the same result
However, when playing UPnP stream and in library view, I've noticed that the cover art is not displayed in the bottom left corner, would it possible to replace it by the generic moOde picture ?
Posts: 14,134
Threads: 323
Joined: Mar 2018
Reputation:
578
(03-05-2025, 01:43 PM)romain Wrote: (03-05-2025, 12:50 PM)Tim Curtis Wrote: Try the 2 files from this commit
https://github.com/moode-player/moode/co...1cb4e8b951
HD
Non-HD
I was just about to send you mine, got the same result 
However, when playing UPnP stream and in library view, I've noticed that the cover art is not displayed in the bottom left corner, would it possible to replace it by the generic moOde picture ?
That would prolly be a JS thing because that particular image comes from the thumbnail cache thats created during Library generation. Same for the small thumbnails in the Queue.
|