feat: extract track duration and bitrate during scans

This commit is contained in:
2026-04-03 02:34:07 +03:00
parent 2774b93830
commit 252075ee1c
7 changed files with 170 additions and 10 deletions

View File

@@ -32,6 +32,7 @@ export type Track = {
albumTitle: string
trackNumber: number
durationSeconds: number
bitrateKbps?: number
contentType?: string
coverArtId?: string
playCount?: number

View File

@@ -103,7 +103,7 @@ export function AlbumDetailPage() {
<div className="text-base text-slate-200">{formatDuration(track.durationSeconds)}</div>
<div className="text-base text-slate-400">{track.playCount ?? 0}</div>
<div className="text-base text-slate-400">{formatLastPlayed(track.lastPlayedAt)}</div>
<div className="text-base text-slate-200"></div>
<div className="text-base text-slate-200">{formatBitrate(track.bitrateKbps)}</div>
<div>
<span className="rounded-full bg-[#38455d] px-3 py-1 text-sm font-semibold text-white">{formatQuality(track)}</span>
</div>
@@ -187,3 +187,10 @@ function formatQuality(track: Track) {
}
return 'AUDIO'
}
function formatBitrate(value?: number) {
if (!value) {
return '—'
}
return `${value} kbps`
}