diff --git a/ui/src/album/AlbumSongs.js b/ui/src/album/AlbumSongs.js
index 292c738fb..45d355c87 100644
--- a/ui/src/album/AlbumSongs.js
+++ b/ui/src/album/AlbumSongs.js
@@ -21,6 +21,7 @@ import {
SongTitleField,
} from '../common'
import { AddToPlaylistDialog } from '../dialogs'
+import { QualityInfo } from '../common/QualityInfo'
import config from '../config'
const useStyles = makeStyles(
@@ -119,6 +120,7 @@ const AlbumSongs = (props) => {
/>
{isDesktop && }
+
@@ -18,9 +19,9 @@ const Toolbar = ({ id }) => {
const handlers = {
TOGGLE_LOVE: useCallback(() => toggleLove(), [toggleLove]),
}
-
return (
<>
+ {data && }
{config.enableFavourites && (
{
+ let { suffix = 'NO_SUFFIX', bitRate = 'NO_BITRATE' } = record
+ suffix = suffix.toUpperCase()
+ let info = suffix
+ if (!LOSSLESS_FORMATS.includes(suffix)) {
+ info += ' ' + bitRate
+ }
+ return
+}
+
+QualityInfo.propTypes = {
+ record: PropTypes.object.isRequired,
+ size: PropTypes.string,
+}
+
+QualityInfo.defaultProps = {
+ size: 'small',
+ record: {},
+}
diff --git a/ui/src/common/QualityInfo.test.js b/ui/src/common/QualityInfo.test.js
new file mode 100644
index 000000000..e2781c85a
--- /dev/null
+++ b/ui/src/common/QualityInfo.test.js
@@ -0,0 +1,80 @@
+import * as React from 'react'
+import { cleanup, render } from '@testing-library/react'
+import { QualityInfo } from './QualityInfo'
+
+describe('', () => {
+ afterEach(cleanup)
+
+ it('only render FLAC', () => {
+ const info = { suffix: 'FLAC', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('FLAC')
+ expect(format.innerHTML).toEqual('FLAC')
+ })
+ it('only render WAV', () => {
+ const info = { suffix: 'WAV', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('WAV')
+ expect(format.innerHTML).toEqual('WAV')
+ })
+ it('only render DSF', () => {
+ const info = { suffix: 'DSF', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('DSF')
+ expect(format.innerHTML).toEqual('DSF')
+ })
+ it('only render ALAC', () => {
+ const info = { suffix: 'ALAC', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('ALAC')
+ expect(format.innerHTML).toEqual('ALAC')
+ })
+ it('only render TTA', () => {
+ const info = { suffix: 'TTA', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('TTA')
+ expect(format.innerHTML).toEqual('TTA')
+ })
+ it('only render ATRAC', () => {
+ const info = { suffix: 'ATRAC', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('ATRAC')
+ expect(format.innerHTML).toEqual('ATRAC')
+ })
+ it('only render SHN', () => {
+ const info = { suffix: 'SHN', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('SHN')
+ expect(format.innerHTML).toEqual('SHN')
+ })
+ it('only render OCG 108', () => {
+ const info = { suffix: 'OCG', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('OCG 108')
+ expect(format.innerHTML).toEqual('OCG 108')
+ })
+ it('only render MP3 108', () => {
+ const info = { suffix: 'MP3', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('MP3 108')
+ expect(format.innerHTML).toEqual('MP3 108')
+ })
+ it('only render AAC 108', () => {
+ const info = { suffix: 'AAC', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('AAC 108')
+ expect(format.innerHTML).toEqual('AAC 108')
+ })
+ it('only render OPUS 108', () => {
+ const info = { suffix: 'OPUS', bitRate: 108 }
+ const { getByText } = render()
+ const format = getByText('OPUS 108')
+ expect(format.innerHTML).toEqual('OPUS 108')
+ })
+ it('render nothing', () => {
+ const info = {}
+ const { getByText } = render()
+ const format = getByText('NO_SUFFIX NO_BITRATE')
+ expect(format.innerHTML).toEqual('NO_SUFFIX NO_BITRATE')
+ })
+})
diff --git a/ui/src/consts.js b/ui/src/consts.js
index 3dc6bcbf2..1e7578083 100644
--- a/ui/src/consts.js
+++ b/ui/src/consts.js
@@ -3,3 +3,13 @@ export const REST_URL = '/app/api'
export const M3U_MIME_TYPE = 'audio/x-mpegurl'
export const AUTO_THEME_ID = 'AUTO_THEME_ID'
+
+export const LOSSLESS_FORMATS = [
+ 'FLAC',
+ 'WAV',
+ 'DSF',
+ 'ALAC',
+ 'TTA',
+ 'ATRAC',
+ 'SHN',
+]
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 5fbc4e7fd..eef3fbed8 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -20,7 +20,8 @@
"bitRate": "Bit rate",
"discSubtitle": "Disc Subtitle",
"starred": "Favourite",
- "comment": "Comment"
+ "comment": "Comment",
+ "quality": "Quality"
},
"actions": {
"addToQueue": "Play Later",
diff --git a/ui/src/playlist/PlaylistSongs.js b/ui/src/playlist/PlaylistSongs.js
index 11de6427c..5f79665e8 100644
--- a/ui/src/playlist/PlaylistSongs.js
+++ b/ui/src/playlist/PlaylistSongs.js
@@ -26,6 +26,7 @@ import { AddToPlaylistDialog } from '../dialogs'
import { AlbumLinkField } from '../song/AlbumLinkField'
import { playTracks } from '../actions'
import PlaylistSongBulkActions from './PlaylistSongBulkActions'
+import { QualityInfo } from '../common/QualityInfo'
const useStyles = makeStyles(
(theme) => ({
@@ -164,6 +165,7 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
{isDesktop && }
{isDesktop && }
+
{
sortByOrder={'DESC'}
/>
)}
+