X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Foptimize-old-videos.ts;h=01d30244fb62fe5f58bf73064f404791735ed35b;hb=9aa67e905f8972106d1a712ef2190d32f2410cbb;hp=a84845068f5f24520b6d46c73e6f422a8871f5a5;hpb=66fb2aa39b6f8e4677f80128c27fbafd3a8fe2e7;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/optimize-old-videos.ts b/scripts/optimize-old-videos.ts index a84845068..01d30244f 100644 --- a/scripts/optimize-old-videos.ts +++ b/scripts/optimize-old-videos.ts @@ -2,11 +2,11 @@ import { registerTSPaths } from '../server/helpers/register-ts-paths' registerTSPaths() import { VIDEO_TRANSCODING_FPS } from '../server/initializers/constants' -import { getDurationFromVideoFile, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../server/helpers/ffmpeg-utils' +import { getDurationFromVideoFile, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../server/helpers/ffprobe-utils' import { getMaxBitrate } from '../shared/models/videos' import { VideoModel } from '../server/models/video/video' import { optimizeOriginalVideofile } from '../server/lib/video-transcoding' -import { initDatabaseModels } from '../server/initializers' +import { initDatabaseModels } from '../server/initializers/database' import { basename, dirname } from 'path' import { copy, move, remove } from 'fs-extra' import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' @@ -34,7 +34,9 @@ async function run () { const localVideos = await VideoModel.listLocal() - for (const video of localVideos) { + for (const localVideo of localVideos) { + const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(localVideo.id) + currentVideoId = video.id for (const file of video.VideoFiles) {