From 2f4c8ca925dbb20dd67eb0069a3505924b7f88bb Mon Sep 17 00:00:00 2001 From: Joel Town Road <13539685+hippi345@users.noreply.github.com> Date: Tue, 20 Oct 2026 21:13:35 -0400 Subject: [PATCH] fix(library): prefer codec over container in codec column and get info (#2592) * fix(library): prefer codec over container in codec column and get info Jellyfin and Navidrome adapters populate song.codec with the actual codec name (e.g. AAC, Vorbis) while song.container holds the file container (e.g. m4a, ogg). The codec column and the Get Info modal were both reading song.container directly, so m4a files showed "m4a" instead of "AAC" and ogg files showed "ogg" instead of "Vorbis". Change both display sites to song.codec ?? song.container so the real codec is shown when available and the container is used as a fallback when the server does not supply a separate codec field. No unit test harness exists for these UI components. * feat(library): add codec column to item table list Add TableColumn.CODEC support to ItemTableList by creating a new CodecColumn component that displays song.codec ?? song.container, matching the existing codec column behavior in ItemDetailList. --- .../item-detail-list/columns/codec-column.tsx | 3 ++- .../item-table-list/columns/codec-column.tsx | 23 +++++++++++++++++++ .../item-table-list-column.tsx | 4 ++++ .../components/item-details-modal.tsx | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 src/renderer/components/item-list/item-table-list/columns/codec-column.tsx diff --git a/src/renderer/components/item-list/item-detail-list/columns/codec-column.tsx b/src/renderer/components/item-list/item-detail-list/columns/codec-column.tsx index 0f7f0d2d5..b428befc9 100644 --- a/src/renderer/components/item-list/item-detail-list/columns/codec-column.tsx +++ b/src/renderer/components/item-list/item-detail-list/columns/codec-column.tsx @@ -1,3 +1,4 @@ import { ItemDetailListCellProps } from './types'; -export const CodecColumn = ({ song }: ItemDetailListCellProps) => song.container ?? <> ; +export const CodecColumn = ({ song }: ItemDetailListCellProps) => + song.codec ?? song.container ?? <> ; diff --git a/src/renderer/components/item-list/item-table-list/columns/codec-column.tsx b/src/renderer/components/item-list/item-table-list/columns/codec-column.tsx new file mode 100644 index 000000000..51b72220a --- /dev/null +++ b/src/renderer/components/item-list/item-table-list/columns/codec-column.tsx @@ -0,0 +1,23 @@ +import { + ColumnNullFallback, + ColumnSkeletonFixed, + ItemTableListInnerColumn, + TableColumnTextContainer, +} from '/@/renderer/components/item-list/item-table-list/item-table-list-column'; + +export const CodecColumn = (props: ItemTableListInnerColumn) => { + const rowItem = props.getRowItem?.(props.rowIndex) ?? (props.data as any[])[props.rowIndex]; + const song = rowItem as any; + + const codec = song?.codec ?? song?.container; + + if (typeof codec === 'string') { + return {codec}; + } + + if (codec === null) { + return ; + } + + return ; +}; diff --git a/src/renderer/components/item-list/item-table-list/item-table-list-column.tsx b/src/renderer/components/item-list/item-table-list/item-table-list-column.tsx index 08abb6217..7b2f705a1 100644 --- a/src/renderer/components/item-list/item-table-list/item-table-list-column.tsx +++ b/src/renderer/components/item-list/item-table-list/item-table-list-column.tsx @@ -31,6 +31,7 @@ import { AlbumArtistsColumn } from '/@/renderer/components/item-list/item-table- import { AlbumColumn } from '/@/renderer/components/item-list/item-table-list/columns/album-column'; import { AlbumGroupColumn } from '/@/renderer/components/item-list/item-table-list/columns/album-group-column'; import { ArtistsColumn } from '/@/renderer/components/item-list/item-table-list/columns/artists-column'; +import { CodecColumn } from '/@/renderer/components/item-list/item-table-list/columns/codec-column'; import { ComposerColumn } from '/@/renderer/components/item-list/item-table-list/columns/composer-column'; import { CountColumn } from '/@/renderer/components/item-list/item-table-list/columns/count-column'; import { @@ -248,6 +249,9 @@ const ItemTableListColumnBase = (props: ItemTableListColumn) => { case TableColumn.SAMPLE_RATE: return ; + case TableColumn.CODEC: + return ; + case TableColumn.COMPOSER: return ; diff --git a/src/renderer/features/item-details/components/item-details-modal.tsx b/src/renderer/features/item-details/components/item-details-modal.tsx index 8572db474..621446efb 100644 --- a/src/renderer/features/item-details/components/item-details-modal.tsx +++ b/src/renderer/features/item-details/components/item-details-modal.tsx @@ -341,7 +341,7 @@ const SongPropertyMapping: ItemDetailRow[] = [ render: (song) => formatDurationString(song.duration), }, { label: 'filter.isCompilation', render: (song) => BoolField(song.compilation || false) }, - { key: 'container', label: 'common.codec' }, + { label: 'common.codec', render: (song) => song.codec ?? song.container ?? null }, { key: 'bitRate', label: 'common.bitrate', render: (song) => `${song.bitRate} kbps` }, { key: 'sampleRate', label: 'common.sampleRate' }, { key: 'bitDepth', label: 'common.bitDepth' },