]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tools/peertube-redundancy.ts
Prevent invalid end watch section warnings
[github/Chocobozzz/PeerTube.git] / server / tools / peertube-redundancy.ts
index 5fda68c8e6ef40ec15566a0fd199918683d3ea18..fd6c760b23de6fb212047b22d72076a5468a20da 100644 (file)
@@ -1,19 +1,14 @@
-import { registerTSPaths } from '../helpers/register-ts-paths'
-registerTSPaths()
-
-import * as CliTable3 from 'cli-table3'
+import CliTable3 from 'cli-table3'
 import { Command, program } from 'commander'
-import { uniq } from 'lodash'
 import { URL } from 'url'
 import validator from 'validator'
-import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
-import { VideoRedundanciesTarget } from '@shared/models'
-import { assignToken, buildServer, getServerCredentials } from './cli'
+import { forceNumber, uniqify } from '@shared/core-utils'
+import { HttpStatusCode, VideoRedundanciesTarget } from '@shared/models'
+import { assignToken, buildServer, getServerCredentials } from './shared'
 
 import bytes = require('bytes')
-
 program
-  .name('plugins')
+  .name('redundancy')
   .usage('[command] [options]')
 
 program
@@ -81,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)
@@ -143,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)