From 920fc07cb9377539e9169b51b2e7f1d2d60976a1 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 26 Mar 2022 12:36:19 -0500 Subject: add formatAttributes --- src/web/src/lib/util.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/web') diff --git a/src/web/src/lib/util.js b/src/web/src/lib/util.js index 86bd6977..32c55090 100644 --- a/src/web/src/lib/util.js +++ b/src/web/src/lib/util.js @@ -34,6 +34,20 @@ export const getDirectoryName = (fullPath) => { return path; } +export const formatAttributes = ({ bitRate, isVariableBitRate, bitDepth, sampleRate }) => { + const isLossless = !!sampleRate && !!bitDepth; + + if (isLossless) { + return `${bitDepth}/${sampleRate/1000}kHz`; + } + + if (isVariableBitRate) { + return `${bitRate}kbps, VBR` + } + + return bitRate ? `${bitRate}kbps` : '' +} + /* https://www.npmjs.com/package/js-file-download * * Copyright 2017 Kenneth Jiang -- cgit v1.2.3 From 5ee68ee6782c1c75e78a1f25d2169cff3c803667 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 26 Mar 2022 12:36:32 -0500 Subject: increase metadata column width --- src/web/src/components/App.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/App.css b/src/web/src/components/App.css index 720d5f5e..6244cdf8 100644 --- a/src/web/src/components/App.css +++ b/src/web/src/components/App.css @@ -68,8 +68,8 @@ body { width: 100px; } -.filelist-bitrate { - width: 70px; +.filelist-attributes { + width: 115px; } .filelist-length{ -- cgit v1.2.3 From b8548f3b055ba5858c182604f9b098a82a3e54d5 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 26 Mar 2022 12:36:41 -0500 Subject: format attributes --- src/web/src/components/Shared/FileList.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/Shared/FileList.js b/src/web/src/components/Shared/FileList.js index e470563f..f38e602d 100644 --- a/src/web/src/components/Shared/FileList.js +++ b/src/web/src/components/Shared/FileList.js @@ -1,6 +1,6 @@ import React from 'react'; -import { formatSeconds, formatBytes, getFileName } from '../../lib/util'; +import { formatSeconds, formatBytes, getFileName, formatAttributes } from '../../lib/util'; import { Header, @@ -44,7 +44,7 @@ const FileList = ({ directoryName, files, locked, onSelectionChange, disabled, o File Size - Bitrate + Attributes Length @@ -61,7 +61,7 @@ const FileList = ({ directoryName, files, locked, onSelectionChange, disabled, o {locked ? : ''}{getFileName(f.filename)} {formatBytes(f.size)} - {f.bitRate} + {formatAttributes(f)} {formatSeconds(f.length)} )} -- cgit v1.2.3