diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-19 15:04:58 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-19 15:04:58 +0100 |
commit | d7764e2eb7e2255a42465c8b06df9a77e3710d81 (patch) | |
tree | 6521536b12308796837200be7db90470fd18b906 /server | |
parent | 4cbdcf440969de2bd0c0cac3dad53d582879465e (diff) | |
download | PeerTube-d7764e2eb7e2255a42465c8b06df9a77e3710d81.tar.gz PeerTube-d7764e2eb7e2255a42465c8b06df9a77e3710d81.tar.zst PeerTube-d7764e2eb7e2255a42465c8b06df9a77e3710d81.zip |
Fix import script when using the search index
Diffstat (limited to 'server')
-rw-r--r-- | server/tools/peertube-import-videos.ts | 16 |
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 @@ | |||
1 | import { registerTSPaths } from '../helpers/register-ts-paths' | 1 | import { registerTSPaths } from '../helpers/register-ts-paths' |
2 | registerTSPaths() | 2 | registerTSPaths() |
3 | 3 | ||
4 | import { accessSync, constants } from 'fs' | ||
5 | import { join } from 'path' | ||
6 | import { promisify } from 'util' | ||
7 | |||
8 | import * as program from 'commander' | 4 | import * as program from 'commander' |
5 | import { accessSync, constants } from 'fs' | ||
9 | import { remove } from 'fs-extra' | 6 | import { remove } from 'fs-extra' |
10 | import { truncate } from 'lodash' | 7 | import { truncate } from 'lodash' |
8 | import { join } from 'path' | ||
11 | import * as prompt from 'prompt' | 9 | import * as prompt from 'prompt' |
12 | 10 | import { promisify } from 'util' | |
13 | import { doRequestAndSaveToFile } from '../helpers/requests' | 11 | import { advancedVideosSearch, getClient, getVideoCategories, login, uploadVideo } from '../../shared/extra-utils/index' |
14 | import { CONSTRAINTS_FIELDS } from '../initializers/constants' | ||
15 | import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo } from '../../shared/extra-utils/index' | ||
16 | import { sha256 } from '../helpers/core-utils' | 12 | import { sha256 } from '../helpers/core-utils' |
13 | import { doRequestAndSaveToFile } from '../helpers/requests' | ||
17 | import { buildOriginallyPublishedAt, getYoutubeDLVideoFormat, safeGetYoutubeDL } from '../helpers/youtube-dl' | 14 | import { buildOriginallyPublishedAt, getYoutubeDLVideoFormat, safeGetYoutubeDL } from '../helpers/youtube-dl' |
15 | import { CONSTRAINTS_FIELDS } from '../initializers/constants' | ||
18 | import { buildCommonVideoOptions, buildVideoAttributesFromCommander, getLogger, getServerCredentials } from './cli' | 16 | import { buildCommonVideoOptions, buildVideoAttributesFromCommander, getLogger, getServerCredentials } from './cli' |
19 | 17 | ||
20 | type UserInfo = { | 18 | type 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 | ||