diff options
Diffstat (limited to 'server/tools/peertube-watch.ts')
-rw-r--r-- | server/tools/peertube-watch.ts | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/server/tools/peertube-watch.ts b/server/tools/peertube-watch.ts index 9ac1d05f9..b8e750a37 100644 --- a/server/tools/peertube-watch.ts +++ b/server/tools/peertube-watch.ts | |||
@@ -29,16 +29,10 @@ program | |||
29 | console.log(' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10') | 29 | console.log(' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10') |
30 | console.log() | 30 | console.log() |
31 | }) | 31 | }) |
32 | .action((url, cmd) => { | 32 | .action((url, cmd) => run(url, cmd)) |
33 | run(url, cmd) | ||
34 | .catch(err => { | ||
35 | console.error(err) | ||
36 | process.exit(-1) | ||
37 | }) | ||
38 | }) | ||
39 | .parse(process.argv) | 33 | .parse(process.argv) |
40 | 34 | ||
41 | async function run (url: string, program: any) { | 35 | function run (url: string, program: any) { |
42 | if (!url) { | 36 | if (!url) { |
43 | console.error('<url> positional argument is required.') | 37 | console.error('<url> positional argument is required.') |
44 | process.exit(-1) | 38 | process.exit(-1) |
@@ -49,5 +43,10 @@ async function run (url: string, program: any) { | |||
49 | url.replace('videos/watch', 'download/torrents') + | 43 | url.replace('videos/watch', 'download/torrents') + |
50 | `-${program.resolution}.torrent` | 44 | `-${program.resolution}.torrent` |
51 | 45 | ||
52 | execSync(cmd + args) | 46 | try { |
47 | execSync(cmd + args) | ||
48 | } catch (err) { | ||
49 | console.error('Cannto exec command.', err) | ||
50 | process.exit(-1) | ||
51 | } | ||
53 | } | 52 | } |