X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftools%2Fpeertube-redundancy.ts;h=5c82fa420367efc9e2fd90e04f49bec2b06fc02d;hb=35f6b17e6112e6ebf5030f91fa9aad0c33e07cfd;hp=2c62a3c195db7524d54a4f0f17d2cd765f3bf3f8;hpb=c3edc5b074aa4bb1861ed0a94d3713808e87170f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.ts index 2c62a3c19..5c82fa420 100644 --- a/server/tools/peertube-redundancy.ts +++ b/server/tools/peertube-redundancy.ts @@ -1,13 +1,12 @@ import CliTable3 from 'cli-table3' import { Command, program } from 'commander' -import { uniq } from 'lodash' import { URL } from 'url' import validator from 'validator' +import { forceNumber, uniqify } from '@shared/core-utils' import { HttpStatusCode, VideoRedundanciesTarget } from '@shared/models' import { assignToken, buildServer, getServerCredentials } from './cli' import bytes = require('bytes') - program .name('redundancy') .usage('[command] [options]') @@ -77,7 +76,7 @@ async function listRedundanciesCLI (target: VideoRedundanciesTarget) { totalSize = bytes(tmp) } - const instances = uniq( + const instances = uniqify( webtorrentFiles.concat(streamingPlaylists) .map(r => r.fileUrl) .map(u => new URL(u).host) @@ -139,7 +138,7 @@ async function removeRedundancyCLI (options: { video: number }, command: Command process.exit(-1) } - const videoId = parseInt(options.video + '', 10) + const videoId = forceNumber(options.video) const myVideoRedundancies = await server.redundancy.listVideos({ target: 'my-videos' }) let videoRedundancy = myVideoRedundancies.data.find(r => videoId === r.id)