Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 722 Bytes
5dfc565 e4e0e54 5dfc565 652f343 5dfc565 e4e0e54 652f343 e4e0e54 deae345 e4e0e54 deae345 652f343 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import { initFolders } from "./initFolders.mts"
import { getPendingVideos } from "./scheduler/getPendingVideos.mts"
import { processVideo } from "./scheduler/processVideo.mts"
import { sortPendingVideosByLeastCompletedFirst } from "./utils/sortPendingVideosByLeastCompletedFirst.mts"
export const main = async () => {
const videos = await getPendingVideos()
if (!videos.length) {
setTimeout(() => {
main()
}, 500)
return
}
console.log(`there are ${videos.length} pending videos`)
sortPendingVideosByLeastCompletedFirst(videos)
for (const video of videos) {
await processVideo(video)
}
console.log(`processed ${videos.length} videos`)
setTimeout(() => {
main()
}, 1000)
} |