Moode Forum
[IDEA] Coverview improvements - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Feature requests (https://moodeaudio.org/forum/forumdisplay.php?fid=8)
+--- Thread: [IDEA] Coverview improvements (/showthread.php?tid=7452)

Pages: 1 2 3 4 5 6


RE: Coverview improvements - Tim Curtis - 03-03-2025

(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']));
       }



RE: Coverview improvements - Tim Curtis - 03-04-2025

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"



RE: Coverview improvements - romain - 03-04-2025

(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


RE: Coverview improvements - romain - 03-04-2025

(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 ?


RE: Coverview improvements - Tim Curtis - 03-04-2025

(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.


RE: Coverview improvements - romain - 03-04-2025

(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


RE: Coverview improvements - Tim Curtis - 03-04-2025

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'])



RE: Coverview improvements - Tim Curtis - 03-05-2025

Try the 2 files from this commit
https://github.com/moode-player/moode/commit/3edcc0b3fe0c2cc1f9dc59e2f959c01cb4e8b951

HD
[attachment=4443]

Non-HD
[attachment=4444]


RE: Coverview improvements - romain - 03-05-2025

(03-05-2025, 12:50 PM)Tim Curtis Wrote: Try the 2 files from this commit
https://github.com/moode-player/moode/commit/3edcc0b3fe0c2cc1f9dc59e2f959c01cb4e8b951

HD


Non-HD

I was just about to send you mine, got the same result Wink

[attachment=4446]

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 ?

[attachment=4447]


RE: Coverview improvements - Tim Curtis - 03-05-2025

(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/commit/3edcc0b3fe0c2cc1f9dc59e2f959c01cb4e8b951

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.