mirror of
https://github.com/jeffvli/feishin.git
synced 2026-11-20 00:51:26 -08:00
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.
This commit is contained in:
1 parent
1b8039e375
commit
2f4c8ca925
4 files changed
+30
-2
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { ItemDetailListCellProps } from './types';
|
||||
|
||||
export const CodecColumn = ({ song }: ItemDetailListCellProps) => song.container ?? <> </>;
|
||||
export const CodecColumn = ({ song }: ItemDetailListCellProps) =>
|
||||
song.codec ?? song.container ?? <> </>;
|
||||
@@ -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 <TableColumnTextContainer {...props}>{codec}</TableColumnTextContainer>;
|
||||
}
|
||||
|
||||
if (codec === null) {
|
||||
return <ColumnNullFallback {...props} />;
|
||||
}
|
||||
|
||||
return <ColumnSkeletonFixed {...props} />;
|
||||
};
|
||||
@@ -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 <NumericColumn {...props} {...dragProps} controls={controls} type={type} />;
|
||||
|
||||
case TableColumn.CODEC:
|
||||
return <CodecColumn {...props} {...dragProps} controls={controls} type={type} />;
|
||||
|
||||
case TableColumn.COMPOSER:
|
||||
return <ComposerColumn {...props} {...dragProps} controls={controls} type={type} />;
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ const SongPropertyMapping: ItemDetailRow<Song>[] = [
|
||||
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' },
|
||||
|
||||
Reference in new issue
Block a user