import { execPromise, execPromise2, randomBytesPromise, sha256 } from './core-utils'
import { logger } from './logger'
import { join } from 'path'
import { Instance as ParseTorrent } from 'parse-torrent'
import { remove } from 'fs-extra'
import { execPromise, execPromise2, randomBytesPromise, sha256 } from './core-utils'
import { logger } from './logger'
import { join } from 'path'
import { Instance as ParseTorrent } from 'parse-torrent'
import { remove } from 'fs-extra'
-const getServerActor = memoizee(async function () {
- const application = await ApplicationModel.load()
- if (!application) throw Error('Could not load Application from database.')
+function generateVideoImportTmpPath (target: string | ParseTorrent, extensionArg?: string) {
+ const id = typeof target === 'string'
+ ? target
+ : target.infoHash
- const actor = application.Account.Actor
- actor.Account = application.Account
-
- return actor
-}, { promise: true })
-
-function generateVideoImportTmpPath (target: string | ParseTorrent) {
- const id = typeof target === 'string' ? target : target.infoHash
+ let extension = '.mp4'
+ if (extensionArg && isVideoFileExtnameValid(extensionArg)) {
+ extension = extensionArg
+ }