Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Idea: Coverview improvements
#31
(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']));
       }
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#32
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"
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#33
(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
Reply
#34
(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 ?
Reply
#35
(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.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#36
(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  Smile
Reply
#37
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'])
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#38
Try the 2 files from this commit
https://github.com/moode-player/moode/co...1cb4e8b951

HD
   

Non-HD
   
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#39
(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 Wink

   

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 ?

   
Reply
#40
(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 Wink



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.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: