ArturSierzant / OMPD

O!MPD is free, opensource MPD client based on PHP and mySQL.
http://ompd.pl
GNU General Public License v3.0
40 stars 13 forks source link

Album format info on cover in library #130

Closed paradix closed 4 years ago

paradix commented 4 years ago

Added a badge showing the album format on the cover in every album library view. It's configurable over the setting $cfg['show_album_format']

The rules probably will have to be clarified for other formats, but I tried to stick to what I have seen in Roon.

image

A nice goal would be also to be able to identify albums that are MQA encoded. Right now getID3() isn't able to determine that encoder.

marcbth commented 4 years ago

Hello paradix,

a very good extension.

now, unfortunately, to my problem:

I would like to add it to my site, but I can see that the changes are more than just your changes and still differ from Artur's? current git version of Artur

i can simply copy your library.inc over Artur's one or Artur has added some new stuff.

I would be grateful for any help.

Cliff

paradix commented 4 years ago

@marcbth you would have to take over all my changes as the without the css files the format badge wouldn't be visible.

marcbth commented 4 years ago

Hello paradix,

i have integrate your changes but

Bildschirmfoto 2020-08-20 um 16 18 56

marcbth commented 4 years ago

Bildschirmfoto 2020-08-20 um 16 20 29 Bildschirmfoto 2020-08-20 um 16 20 10 Bildschirmfoto 2020-08-20 um 16 19 39 Bildschirmfoto 2020-08-20 um 16 19 13

marcbth commented 4 years ago

for FILE FORMAT: 16bit - 44.1kHz FILE TYPE: WAV - Lossless

Output wav/0

FILE FORMAT: 16bit - 44.1kHz FILE TYPE: FLAC - Lossless compression

Output CD

FILE FORMAT: 24bit - 44.1kHz FILE TYPE: WAV - Lossless

Output: 24/44

and dsf

FILE FORMAT: 1bit - 2822.4kHz FILE TYPE: DSF - Lossless

DSF/0

can you change this?

Please

Many Thanks

Cliff

paradix commented 4 years ago

Sure, will have a look ib the evening

marcbth commented 4 years ago

Sorry,

but Flac 24/44 and Wav 24/44 is the same

thanks for your quick response.

is the same ad.

I wish it were:

WAV 24/44 or FLAC 24/44

Cliff

marcbth commented 4 years ago

elseif ($album_information['audio_dataformat'] == 'flac' && $album_information['audio_sample_rate'] == '44100' && $album_information['audio_bits_per_sample'] == '16') {

return $album_information['audio_dataformat'] . ' ' . $album_information['audio_bits_per_sample'] . '/' . round($album_information['audio_sample_rate']/1000,0);
} elseif ($album_information['audio_dataformat'] == 'wav' && $album_information['audio_sample_rate'] == '44100' && $album_information['audio_bits_per_sample'] == '16') {

return $album_information['audio_dataformat'] . ' ' . $album_information['audio_bits_per_sample'] . '/' . round($album_information['audio_sample_rate']/1000,0);
}

DSF its a Problem

marcbth commented 4 years ago

for dsf

elseif ($album_information['audio_dataformat'] == 'dsf' && $album_information['audio_sample_rate'] && $album_information['audio_bits_per_sample']) {

return $album_information['audio_dataformat'] . ' ' . $album_information['audio_bits_per_sample'] . '/' . round($album_information['audio_sample_rate']/1000,0);

marcbth commented 4 years ago

and in the css file

text-transform: uppercase;

I think show better

paradix commented 4 years ago

@marcbth I don't have any WAV or DSF files in my library, so can't be sure what data is there in the database to best present on the library view.

To much info shouldn't be the goal. I like how Roon does it, but I fear there is not enough data in O!MPD to recreate it.

I would rather add further filtering of the library by format, also similar to what Roon does with it's Focus function.

marcbth commented 4 years ago

The code works wonderfully. Good work and idea

I'll ask Artur to insert it.

a sql query for quality I have to look at on the weekend. it works for sure, because the data is available.

try to change the library display so that you can scroll horizontally. not easy.

paradix commented 4 years ago

For dsf I would rather display DSD64, DSD128 etc I have an idea will do it tomorrow.

ArturSierzant commented 4 years ago

@paradix thanks for that, really nice feature. DSF file has: audio_bits_per_sample = 1 audio_sample_rate = 2822400 (or more - depends on file) audio_dataformat = dsf audio_profile = Lossless

There is one thing that should be improved: for albums from Tidal or HRA (or generally: for albums outside of local storage, for which audio parameters can't be read easy way) the badge should be hidden. Otherwise we have something like this:

obraz

Regards, Artur

paradix commented 4 years ago

@ArturSierzant fixed the Tidal issue and also added DSD64,etc tags. I thought it would be better to differentiate lossy and lossless, so there is now the following logic:

audio_dataformat audio_profile audio_bits_per_sample audio_sample_rate displayed format
* ie. 320 kbps * * audio_dataformat ie. MP3, AAC, M4A
* Lossless 16 44100 CD
* Lossless > 16 >= 44100 audio_bits_per_sample/audio_sample_rate ie. 24/96
dsf Lossless 1 2822400 DSD64
dsf Lossless 1 5644800 DSD128
dsf Lossless 1 11289600 DSD256
dsf Lossless 1 22579200 DSD512
dsf Lossless 1 any other DSF

Otherwise it will show "UNKNOWN" could by also not showing anything in that case

paradix commented 4 years ago

I'll merge it to the current master state and include the hra and tidal checks. Also found a way for mqa tracks just need to know if it would be fine to store the original sample rate of the mqa track in the attribute audio_sample_rate?

ArturSierzant commented 4 years ago

I don't have any MQA file, so I don't know how it is written to DB after analysing by getID3...

For Tidal and HRA we need to change: if ($cfg['show_album_format'] == true && !isTidal($album_id) && !isHra($album_id)) { to: if ($cfg['show_album_format'] == true && !isTidal($album['album_id']) && !isHra($album['album_id'])) { (line 71 in library.inc.php)

paradix commented 4 years ago

MQA are just plain flac files encoded with MQAEncode. I tried to handle this in PR #131 A MQA file can be downloaded from http://www.2l.no/hires/

paradix commented 4 years ago

I don't have any MQA file, so I don't know how it is written to DB after analysing by getID3...

For Tidal and HRA we need to change: if ($cfg['show_album_format'] == true && !isTidal($album_id) && !isHra($album_id)) { to: if ($cfg['show_album_format'] == true && !isTidal($album['album_id']) && !isHra($album['album_id'])) { (line 71 in library.inc.php)

Done with commit ff1604c

marcbth commented 4 years ago

Hello,

this looks better for me, because I get the format wav/flac displayed.

what do you think

Bildschirmfoto 2020-08-22 um 10 16 08

elseif (strpos($album_information['audio_profile'],'Lossless') !== false && $album_information['audio_sample_rate'] == '44100' && $album_information['audio_bits_per_sample$ return $album_information['audio_dataformat'] . ' ' . 'CD' ;

and

elseif ($album_information['audio_sample_rate'] >= '44100' && $album_information['audio_bits_per_sample'] > '16') { return $album_information['audio_dataformat'] . ' ' . $album_information['audio_bits_per_sample'] . '/' . round($album_information['audio_sample_rate']/1000,0); }

paradix commented 4 years ago

Hello,

this looks better for me, because I get the format wav/flac displayed.

what do you think

For me that is too much, it clutters the view. But in the end @ArturSierzant has to decide :) it's his product.

ArturSierzant commented 4 years ago

I agree with @paradix - let's stay with shorter version.

marcbth commented 4 years ago

just did a poll on my users.

I'm gonna keep the long version in for now.

a great new feature

try to make a settings menu where the user can do this with the on/off button.

he should not write in the config.inc.conf. my users are not the programming freaks :-)

thanks a lot