X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftools%2Fpeertube-import-videos.ts;h=52aae3d2c372cd51783376ec3dd0d0ea82bde4af;hb=0d22b7ad5ffea0a830a266815f7bdfd8893917c9;hp=fc76735b9d5481c4046e99fb1a269d462a0ce833;hpb=d23dd9fbfc4d26026352c10f81d2795ceaf2908a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index fc76735b9..52aae3d2c 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -20,7 +20,7 @@ import { getLogger, getServerCredentials } from './cli' -import { ServerInfo } from '@shared/extra-utils' +import { PeerTubeServer } from '@shared/extra-utils' const processOptions = { maxBuffer: Infinity @@ -150,7 +150,7 @@ async function processVideo (parameters: { } const server = buildServer(url) - const { data } = await server.searchCommand.advancedVideoSearch({ + const { data } = await server.search.advancedVideoSearch({ search: { search: videoInfo.title, sort: '-match', @@ -249,14 +249,14 @@ async function uploadVideoOnPeerTube (parameters: { log.info('\nUploading on PeerTube video "%s".', attributes.name) try { - await server.videosCommand.upload({ attributes }) + await server.videos.upload({ attributes }) } catch (err) { if (err.message.indexOf('401') !== -1) { log.info('Got 401 Unauthorized, token may have expired, renewing token and retry.') - server.accessToken = await server.loginCommand.getAccessToken(username, password) + server.accessToken = await server.login.getAccessToken(username, password) - await server.videosCommand.upload({ attributes }) + await server.videos.upload({ attributes }) } else { exitError(err.message) } @@ -270,14 +270,14 @@ async function uploadVideoOnPeerTube (parameters: { /* ---------------------------------------------------------- */ -async function getCategory (server: ServerInfo, categories: string[]) { +async function getCategory (server: PeerTubeServer, categories: string[]) { if (!categories) return undefined const categoryString = categories[0] if (categoryString === 'News & Politics') return 11 - const categoriesServer = await server.videosCommand.getCategories() + const categoriesServer = await server.videos.getCategories() for (const key of Object.keys(categoriesServer)) { const categoryServer = categoriesServer[key]