Files
shumai/packages/webui/lib/transcript.ts
T

21 lines
630 B
TypeScript
Raw Normal View History

import type { AssetInfo } from '@shumai/dtos'
export function getTranscriptVideo(item: AssetInfo) {
const isVideo = item.proxyType ? item.proxyType === 'video' : item.mediaType?.startsWith('video/')
if (!isVideo) return undefined
if (item.type === 'version_stack') {
const version = item.versionStack?.versions.find(({ current }) => current)
if (version) {
return {
id: version.id,
name: version.name || item.name,
status: version.status ?? item.status,
}
}
}
if (item.type === 'file' && item.id) {
return { id: item.id, name: item.name, status: item.status }
}
}