aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-import-videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-19 15:04:58 +0100
committerChocobozzz <me@florianbigard.com>2021-02-19 15:04:58 +0100
commitd7764e2eb7e2255a42465c8b06df9a77e3710d81 (patch)
tree6521536b12308796837200be7db90470fd18b906 /server/tools/peertube-import-videos.ts
parent4cbdcf440969de2bd0c0cac3dad53d582879465e (diff)
downloadPeerTube-d7764e2eb7e2255a42465c8b06df9a77e3710d81.tar.gz
PeerTube-d7764e2eb7e2255a42465c8b06df9a77e3710d81.tar.zst
PeerTube-d7764e2eb7e2255a42465c8b06df9a77e3710d81.zip
Fix import script when using the search index
Diffstat (limited to 'server/tools/peertube-import-videos.ts')
-rw-r--r--server/tools/peertube-import-videos.ts16
1 files changed, 7 insertions, 9 deletions
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index d91767c29..9be0834ba 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -1,20 +1,18 @@
1import { registerTSPaths } from '../helpers/register-ts-paths' 1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths() 2registerTSPaths()
3 3
4import { accessSync, constants } from 'fs'
5import { join } from 'path'
6import { promisify } from 'util'
7
8import * as program from 'commander' 4import * as program from 'commander'
5import { accessSync, constants } from 'fs'
9import { remove } from 'fs-extra' 6import { remove } from 'fs-extra'
10import { truncate } from 'lodash' 7import { truncate } from 'lodash'
8import { join } from 'path'
11import * as prompt from 'prompt' 9import * as prompt from 'prompt'
12 10import { promisify } from 'util'
13import { doRequestAndSaveToFile } from '../helpers/requests' 11import { advancedVideosSearch, getClient, getVideoCategories, login, uploadVideo } from '../../shared/extra-utils/index'
14import { CONSTRAINTS_FIELDS } from '../initializers/constants'
15import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo } from '../../shared/extra-utils/index'
16import { sha256 } from '../helpers/core-utils' 12import { sha256 } from '../helpers/core-utils'
13import { doRequestAndSaveToFile } from '../helpers/requests'
17import { buildOriginallyPublishedAt, getYoutubeDLVideoFormat, safeGetYoutubeDL } from '../helpers/youtube-dl' 14import { buildOriginallyPublishedAt, getYoutubeDLVideoFormat, safeGetYoutubeDL } from '../helpers/youtube-dl'
15import { CONSTRAINTS_FIELDS } from '../initializers/constants'
18import { buildCommonVideoOptions, buildVideoAttributesFromCommander, getLogger, getServerCredentials } from './cli' 16import { buildCommonVideoOptions, buildVideoAttributesFromCommander, getLogger, getServerCredentials } from './cli'
19 17
20type UserInfo = { 18type UserInfo = {
@@ -150,7 +148,7 @@ async function processVideo (parameters: {
150 return 148 return
151 } 149 }
152 150
153 const result = await searchVideoWithSort(url, videoInfo.title, '-match') 151 const result = await advancedVideosSearch(url, { search: videoInfo.title, sort: '-match', searchTarget: 'local' })
154 152
155 log.info('############################################################\n') 153 log.info('############################################################\n')
156 154