2 - [CLI wrapper](#cli-wrapper)
3 - [Remote tools](#remote-tools)
4 - [peertube-import-videos.js](#peertube-import-videosjs)
5 - [peertube-upload.js](#peertube-uploadjs)
6 - [peertube-watch.js](#peertube-watch)
7 - [Server tools](#server-tools)
8 - [parse-log](#parse-log)
9 - [create-transcoding-job.js](#create-transcoding-jobjs)
10 - [create-import-video-file-job.js](#create-import-video-file-jobjs)
11 - [prune-storage.js](#prune-storagejs)
15 The wrapper provides a convenient interface to most scripts, and requires the [same dependencies](#dependencies). You can access it as `peertube` via an alias in your `.bashrc` like `alias peertube="node ${PEERTUBE_PATH}/dist/server/tools/peertube.js"`:
18 Usage: peertube [command] [options]
22 -v, --version output the version number
23 -h, --help output usage information
27 auth [action] register your accounts on remote instances to use them with other commands
28 upload|up upload a video
29 import-videos|import import a video from a streaming platform
30 watch|w watch a video in the terminal ✩°。⋆
31 help [cmd] display help for [cmd]
34 The wrapper can keep track of instances you have an account on. We limit to one account per instance for now.
37 $ peertube auth add -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD"
39 ┌──────────────────────────────┬──────────────────────────────┐
41 ├──────────────────────────────┼──────────────────────────────┤
42 │ "PEERTUBE_URL" │ "PEERTUBE_USER" │
43 └──────────────────────────────┴──────────────────────────────┘
46 You can now use that account to upload videos without feeding the same parameters again.
49 $ peertube up <videoFile>
52 And now that your video is online, you can watch it from the confort of your terminal (use `peertube watch --help` to see the supported players):
55 $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10
60 You need at least 512MB RAM to run the script.
61 Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.
62 You need to follow all the following steps even if you are on a PeerTube server (including cloning the git repository in a different directory than your production installation because the scripts utilize non-production dependencies).
66 Install the [PeerTube dependencies](dependencies.md).
70 Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):
73 $ git clone https://github.com/Chocobozzz/PeerTube.git
74 $ CLONE="$(pwd)/PeerTube"
86 $ npm run build:server
89 ### peertube-import-videos.js
91 You can use this script to import videos from all [supported sites of youtube-dl](https://rg3.github.io/youtube-dl/supportedsites.html) into PeerTube.
92 Be sure you own the videos or have the author's authorization to do so.
95 $ node dist/server/tools/peertube-import-videos.js \
98 --password "PEERTUBE_PASSWORD" \
102 * `PEERTUBE_URL` : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re
103 * `PEERTUBE_USER` : your PeerTube account where videos will be uploaded
104 * `PEERTUBE_PASSWORD` : password of your PeerTube account (if omitted, you will be prompted for it)
105 * `TARGET_URL` : the target url you want to import. Examples:
107 * Channel: https://www.youtube.com/channel/ChannelId
108 * User https://www.youtube.com/c/UserName or https://www.youtube.com/user/UserName
109 * Video https://www.youtube.com/watch?v=blabla
110 * Vimeo: https://vimeo.com/xxxxxx
111 * Dailymotion: https://www.dailymotion.com/xxxxx
113 The script will get all public videos from Youtube, download them and upload to PeerTube.
114 Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection...
116 Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).
119 ### peertube-upload.js
121 You can use this script to import videos directly from the CLI.
123 Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).
127 $ node dist/server/tools/peertube-upload.js --help
130 ### peertube-watch.js
132 You can use this script to play videos directly from the CLI.
134 It provides support for different players:
136 - ascii (default ; plays in ascii art in your terminal!)
148 These scripts should be run on the server, in `peertube-latest` directory.
152 To parse PeerTube last log file:
155 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run parse-log -- --level info
158 `--level` is optional and could be `info`/`warn`/`error`
160 ### create-transcoding-job.js
162 You can use this script to force transcoding of an existing video.
165 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-transcoding-job -- -v [videoUUID]
168 Or to transcode to a specific resolution:
170 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-transcoding-job -- -v [videoUUID] -r [resolution]
173 ### create-import-video-file-job.js
175 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.
178 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
183 Some transcoded videos or shutdown at a bad time can leave some unused files on your storage.
184 To delete them (a confirmation will be demanded first):
187 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run prune-storage
192 If you started PeerTube with a domain, and then changed it you will have invalid torrent files and invalid URLs in your database.
193 To fix this, you have to run:
196 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run update-host