# CLI tools guide
- - [CLI wrapper](#cli-wrapper)
- - [Remote tools](#remote-tools)
- - [peertube-import-videos.js](#peertube-import-videosjs)
- - [peertube-upload.js](#peertube-uploadjs)
- - [peertube-watch.js](#peertube-watch)
- - [Server tools](#server-tools)
- - [parse-log](#parse-log)
- - [create-transcoding-job.js](#create-transcoding-jobjs)
- - [create-import-video-file-job.js](#create-import-video-file-jobjs)
- - [prune-storage.js](#prune-storagejs)
+
+<!-- START doctoc generated TOC please keep comment here to allow auto update -->
+<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
+**Table of Contents**
+
+- [CLI wrapper](#cli-wrapper)
+- [Remote Tools](#remote-tools)
+ - [Dependencies](#dependencies)
+ - [Installation](#installation)
+ - [peertube-import-videos.js](#peertube-import-videosjs)
+ - [peertube-upload.js](#peertube-uploadjs)
+ - [peertube-watch.js](#peertube-watchjs)
+- [Server tools](#server-tools)
+ - [parse-log](#parse-log)
+ - [create-transcoding-job.js](#create-transcoding-jobjs)
+ - [create-import-video-file-job.js](#create-import-video-file-jobjs)
+ - [prune-storage.js](#prune-storagejs)
+ - [optimize-old-videos.js](#optimize-old-videosjs)
+ - [update-host.js](#update-hostjs)
+ - [REPL (Read Eval Print Loop)](#repl-read-eval-print-loop)
+ - [.help](#help)
+ - [Lodash example](#lodash-example)
+ - [YoutubeDL example](#youtubedl-example)
+ - [Models examples](#models-examples)
+
+<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## CLI wrapper
upload|up upload a video
import-videos|import import a video from a streaming platform
watch|w watch a video in the terminal ✩°。⋆
+ repl initiate a REPL to access internals
help [cmd] display help for [cmd]
```
### create-transcoding-job.js
-You can use this script to force transcoding of an existing video.
+You can use this script to force transcoding of an existing video. PeerTube needs to be running.
```
$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-transcoding-job -- -v [videoUUID]
### create-import-video-file-job.js
-You can use this script to import a video file to replace an already uploaded file or to add a new resolution to a video.
+You can use this script to import a video file to replace an already uploaded file or to add a new resolution to a video. PeerTube needs to be running.
```
$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
### optimize-old-videos.js
-Before version v1.0.0-beta.16, Peertube did not specify a bitrate for the transcoding of uploaded videos.
-This means that videos might be encoded into very large files that are too large for streaming. This script
-re-transcodes these videos so that they can be watched properly, even on slow connections.
+Before version v1.0.0-beta.16, Peertube did not specify a bitrate for the
+transcoding of uploaded videos. This means that videos might be encoded into
+very large files that are too large for streaming. This script re-transcodes
+these videos so that they can be watched properly, even on slow connections.
```
$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run optimize-old-videos
### update-host.js
-If you started PeerTube with a domain, and then changed it you will have invalid torrent files and invalid URLs in your database.
-To fix this, you have to run:
+If you started PeerTube with a domain, and then changed it you will have
+invalid torrent files and invalid URLs in your database. To fix this, you have
+to run:
```
$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run update-host
### REPL ([Read Eval Print Loop](https://nodejs.org/docs/latest-v8.x/api/repl.html))
-If you want to interact with the application libraries and objects, there is a REPL for that.
+If you want to interact with the application libraries and objects even when PeerTube is not running, there is a REPL for that.
-usage: `node ./dist/server/tools/repl.js`
+usage: `node ./dist/server/tools/peertube-repl.js`
"The default evaluator will, by default, assign the result of the most recently evaluated expression to the special variable `_` (underscore). Explicitly setting `_` to a value will disable this behavior."