gongxiangp2/scripts/check-transcode-status.js

31 lines
1.4 KiB
JavaScript

/**
* 统计转码状态(仅查询,不会入队)
* 在宿主机执行:
* scp scripts/check-transcode-status.js root@192.168.58.20:/tmp/
* ssh root@192.168.58.20 "docker cp /tmp/check-transcode-status.js youyidian-3d-material:/tmp/check-transcode-status.js && docker exec youyidian-3d-material node /tmp/check-transcode-status.js"
*/
const { PrismaClient } = require('/app/node_modules/@prisma/client')
const prisma = new PrismaClient()
async function main() {
try {
const types = ['主图视频', '安装视频', '种草视频', '视频', 'VIDEO']
const base = { materialType: { in: types }, videoSourceUrl: { not: null }, deletedAt: null }
const total = await prisma.material.count({ where: base })
const processing = await prisma.material.count({ where: { ...base, videoProcessingStatus: 'processing' } })
const done = await prisma.material.count({ where: { ...base, videoProcessingStatus: 'done' } })
const failed = await prisma.material.count({ where: { ...base, videoProcessingStatus: 'failed' } })
const pending = await prisma.material.count({ where: { ...base, videoProcessingStatus: 'pending' } })
const nulls = await prisma.material.count({ where: { ...base, videoProcessingStatus: null } })
console.log({ total, done, processing, pending, failed, nulls })
} catch (e) {
console.error(e)
} finally {
await prisma.$disconnect()
}
}
main()