feat: show sampling rate and bit depth if available

This commit is contained in:
Jaime García 2025-08-06 01:49:30 +02:00
parent bfd6f28d7a
commit 181af686c2
No known key found for this signature in database
GPG key ID: BC4E5F71A71BDA5B
11 changed files with 93 additions and 3 deletions

View file

@ -54,6 +54,8 @@ public class MappingUtil {
bundle.putString("transcodedSuffix", media.getTranscodedSuffix());
bundle.putInt("duration", media.getDuration() != null ? media.getDuration() : 0);
bundle.putInt("bitrate", media.getBitrate() != null ? media.getBitrate() : 0);
bundle.putInt("samplingRate", media.getSamplingRate() != null ? media.getSamplingRate() : 0);
bundle.putInt("bitDepth", media.getBitDepth() != null ? media.getBitDepth() : 0);
bundle.putString("path", media.getPath());
bundle.putBoolean("isVideo", media.isVideo());
bundle.putInt("userRating", media.getUserRating() != null ? media.getUserRating() : 0);

View file

@ -15,6 +15,7 @@ import com.cappielloantonio.tempo.repository.DownloadRepository;
import com.cappielloantonio.tempo.subsonic.models.Child;
import java.text.CharacterIterator;
import java.text.DecimalFormat;
import java.text.StringCharacterIterator;
import java.util.ArrayList;
import java.util.List;
@ -163,6 +164,12 @@ public class MusicUtil {
" " +
child.getBitrate() +
"kbps" +
"" +
(child.getBitDepth() != null && child.getBitDepth() != 0
? child.getBitDepth() + "/" + (child.getSamplingRate() != null ? child.getSamplingRate() / 1000 : "")
: (child.getSamplingRate() != null
? new DecimalFormat("0.#").format(child.getSamplingRate() / 1000.0) + "kHz"
: "")) +
" " +
child.getSuffix();
}