aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRigel Kent <par@rigelk.eu>2018-03-26 14:07:45 +0200
committerChocobozzz <me@florianbigard.com>2018-03-26 14:07:45 +0200
commit45b8a42ca1869ef36d565c6062fa569d718c91e9 (patch)
tree80082c3092a8ccf4d856119bf8000b1d9cfc0941
parent60a26a559ca21ca02458a1311c5b464044bb8a05 (diff)
downloadPeerTube-45b8a42ca1869ef36d565c6062fa569d718c91e9.tar.gz
PeerTube-45b8a42ca1869ef36d565c6062fa569d718c91e9.tar.zst
PeerTube-45b8a42ca1869ef36d565c6062fa569d718c91e9.zip
truncating long video names in import-videos.js (fixes #392) (#415)
-rw-r--r--server/tools/import-videos.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/tools/import-videos.ts b/server/tools/import-videos.ts
index baaedd329..27d0732a6 100644
--- a/server/tools/import-videos.ts
+++ b/server/tools/import-videos.ts
@@ -6,6 +6,7 @@ import { unlinkPromise } from '../helpers/core-utils'
6import { doRequestAndSaveToFile } from '../helpers/requests' 6import { doRequestAndSaveToFile } from '../helpers/requests'
7import { CONSTRAINTS_FIELDS } from '../initializers' 7import { CONSTRAINTS_FIELDS } from '../initializers'
8import { getClient, getVideoCategories, login, searchVideo, uploadVideo } from '../tests/utils' 8import { getClient, getVideoCategories, login, searchVideo, uploadVideo } from '../tests/utils'
9import { truncate } from 'lodash'
9 10
10program 11program
11 .option('-u, --url <url>', 'Server url') 12 .option('-u, --url <url>', 'Server url')
@@ -133,7 +134,11 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, languag
133 } 134 }
134 135
135 const videoAttributes = { 136 const videoAttributes = {
136 name: videoInfo.title, 137 name: truncate(videoInfo.title, {
138 'length': CONSTRAINTS_FIELDS.VIDEOS.NAME.max,
139 'separator': /,? +/,
140 'omission': ' […]'
141 }),
137 category, 142 category,
138 licence, 143 licence,
139 language, 144 language,