diff options
author | Rigel Kent <par@rigelk.eu> | 2018-03-26 14:07:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-26 14:07:45 +0200 |
commit | 45b8a42ca1869ef36d565c6062fa569d718c91e9 (patch) | |
tree | 80082c3092a8ccf4d856119bf8000b1d9cfc0941 /server/tools | |
parent | 60a26a559ca21ca02458a1311c5b464044bb8a05 (diff) | |
download | PeerTube-45b8a42ca1869ef36d565c6062fa569d718c91e9.tar.gz PeerTube-45b8a42ca1869ef36d565c6062fa569d718c91e9.tar.zst PeerTube-45b8a42ca1869ef36d565c6062fa569d718c91e9.zip |
truncating long video names in import-videos.js (fixes #392) (#415)
Diffstat (limited to 'server/tools')
-rw-r--r-- | server/tools/import-videos.ts | 7 |
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' | |||
6 | import { doRequestAndSaveToFile } from '../helpers/requests' | 6 | import { doRequestAndSaveToFile } from '../helpers/requests' |
7 | import { CONSTRAINTS_FIELDS } from '../initializers' | 7 | import { CONSTRAINTS_FIELDS } from '../initializers' |
8 | import { getClient, getVideoCategories, login, searchVideo, uploadVideo } from '../tests/utils' | 8 | import { getClient, getVideoCategories, login, searchVideo, uploadVideo } from '../tests/utils' |
9 | import { truncate } from 'lodash' | ||
9 | 10 | ||
10 | program | 11 | program |
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, |