getLogger,
getServerCredentials
} from './cli'
-import { ServerInfo } from '@shared/extra-utils'
+import { PeerTubeServer } from '@shared/extra-utils'
const processOptions = {
maxBuffer: Infinity
}
const server = buildServer(url)
- const { data } = await server.searchCommand.advancedVideoSearch({
+ const { data } = await server.search.advancedVideoSearch({
search: {
search: videoInfo.title,
sort: '-match',
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)
}
/* ---------------------------------------------------------- */
-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]