aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/youtube-dl.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/youtube-dl.ts')
-rw-r--r--server/helpers/youtube-dl.ts21
1 files changed, 10 insertions, 11 deletions
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts
index b3079370f..87a0d0584 100644
--- a/server/helpers/youtube-dl.ts
+++ b/server/helpers/youtube-dl.ts
@@ -1,10 +1,9 @@
1import { truncate } from 'lodash'
2import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES } from '../initializers/constants' 1import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES } from '../initializers/constants'
3import { logger } from './logger' 2import { logger } from './logger'
4import { generateVideoImportTmpPath } from './utils' 3import { generateVideoImportTmpPath } from './utils'
5import { join } from 'path' 4import { join } from 'path'
6import { root } from './core-utils' 5import { peertubeTruncate, root } from './core-utils'
7import { ensureDir, writeFile, remove } from 'fs-extra' 6import { ensureDir, remove, writeFile } from 'fs-extra'
8import * as request from 'request' 7import * as request from 'request'
9import { createWriteStream } from 'fs' 8import { createWriteStream } from 'fs'
10 9
@@ -212,20 +211,20 @@ function buildVideoInfo (obj: any) {
212} 211}
213 212
214function titleTruncation (title: string) { 213function titleTruncation (title: string) {
215 return truncate(title, { 214 return peertubeTruncate(title, {
216 'length': CONSTRAINTS_FIELDS.VIDEOS.NAME.max, 215 length: CONSTRAINTS_FIELDS.VIDEOS.NAME.max,
217 'separator': /,? +/, 216 separator: /,? +/,
218 'omission': ' […]' 217 omission: ' […]'
219 }) 218 })
220} 219}
221 220
222function descriptionTruncation (description: string) { 221function descriptionTruncation (description: string) {
223 if (!description || description.length < CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.min) return undefined 222 if (!description || description.length < CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.min) return undefined
224 223
225 return truncate(description, { 224 return peertubeTruncate(description, {
226 'length': CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max, 225 length: CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max,
227 'separator': /,? +/, 226 separator: /,? +/,
228 'omission': ' […]' 227 omission: ' […]'
229 }) 228 })
230} 229}
231 230