feat: extract track duration and bitrate during scans
This commit is contained in:
@@ -32,6 +32,7 @@ export type Track = {
|
||||
albumTitle: string
|
||||
trackNumber: number
|
||||
durationSeconds: number
|
||||
bitrateKbps?: number
|
||||
contentType?: string
|
||||
coverArtId?: string
|
||||
playCount?: number
|
||||
|
||||
@@ -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`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user