1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Import magnets with webtorrent

This commit is contained in:
Chocobozzz 2018-08-06 17:13:39 +02:00
parent 788487140c
commit ce33919c24
23 changed files with 648 additions and 142 deletions

View file

@ -9,6 +9,8 @@ import { ApplicationModel } from '../models/application/application'
import { pseudoRandomBytesPromise, unlinkPromise } from './core-utils'
import { logger } from './logger'
import { isArray } from './custom-validators/misc'
import * as crypto from "crypto"
import { join } from "path"
const isCidr = require('is-cidr')
@ -181,8 +183,14 @@ async function getServerActor () {
return Promise.resolve(serverActor)
}
function generateVideoTmpPath (id: string) {
const hash = crypto.createHash('sha256').update(id).digest('hex')
return join(CONFIG.STORAGE.VIDEOS_DIR, hash + '-import.mp4')
}
type SortType = { sortModel: any, sortValue: string }
// ---------------------------------------------------------------------------
export {
@ -195,5 +203,6 @@ export {
computeResolutionsToTranscode,
resetSequelizeInstance,
getServerActor,
SortType
SortType,
generateVideoTmpPath
}