]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/tools.md
Pull translations
[github/Chocobozzz/PeerTube.git] / support / doc / tools.md
CommitLineData
358770db 1# CLI tools guide
2519d9fe 2
54a3a12e 3 - [Remote tools](#remote-tools)
635a5686
C
4 - [import-videos.js](#import-videosjs)
5 - [upload.js](#uploadjs)
54a3a12e 6 - [Server tools](#server-tools)
a5f0521f
RK
7 - [create-transcoding-job.js](#create-transcoding-jobjs)
8 - [create-import-video-file-job.js](#create-import-video-file-jobjs)
54a3a12e 9 - [prune-storage.js](#prune-storagejs)
2519d9fe 10
54a3a12e 11## Remote Tools
2519d9fe 12
99402413
C
13You need at least 512MB RAM to run the script.
14Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.
05e67d62 15You need to follow all the following steps even if you are on a PeerTube server.
2519d9fe
L
16
17### Dependencies
18
358770db 19Install the [PeerTube dependencies](dependencies.md).
2519d9fe
L
20
21### Installation
22
99402413 23Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):
2519d9fe
L
24
25```
05e67d62
C
26$ git clone https://github.com/Chocobozzz/PeerTube.git
27$ CLONE="$(pwd)/PeerTube"
2519d9fe
L
28```
29
30Run ``yarn install``
31```
05e67d62
C
32$ cd ${CLONE}
33$ yarn install
2519d9fe
L
34```
35
36Build server tools:
37```
05e67d62
C
38$ cd ${CLONE}
39$ npm run build:server
2519d9fe
L
40```
41
358770db
C
42### import-videos.js
43
44You can use this script to import videos from all [supported sites of youtube-dl](https://rg3.github.io/youtube-dl/supportedsites.html) into PeerTube.
45Be sure you own the videos or have the author's authorization to do so.
2519d9fe 46
a5f0521f
RK
47```sh
48$ node dist/server/tools/import-videos.js \
49 -u "PEERTUBE_URL" \
50 -U "PEERTUBE_USER" \
51 --password "PEERTUBE_PASSWORD" \
52 -t "TARGET_URL"
2519d9fe
L
53```
54
a5f0521f
RK
55* `PEERTUBE_URL` : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re
56* `PEERTUBE_USER` : your PeerTube account where videos will be uploaded
57* `PEERTUBE_PASSWORD` : password of your PeerTube account (if omitted, you will be prompted for it)
58* `TARGET_URL` : the target url you want to import. Examples:
59 * YouTube:
60 * Channel: https://www.youtube.com/channel/ChannelId
61 * User https://www.youtube.com/c/UserName or https://www.youtube.com/user/UserName
62 * Video https://www.youtube.com/watch?v=blabla
63 * Vimeo: https://vimeo.com/xxxxxx
64 * Dailymotion: https://www.dailymotion.com/xxxxx
2519d9fe 65
2186386c
C
66The script will get all public videos from Youtube, download them and upload to PeerTube.
67Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection...
68
69Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).
70
358770db
C
71
72### upload.js
73
74You can use this script to import videos directly from the CLI.
75
2186386c
C
76Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).
77
358770db 78```
05e67d62
C
79$ cd ${CLONE}
80$ node dist/server/tools/upload.js --help
358770db 81```
a5f0521f 82
54a3a12e
C
83
84## Server tools
85
86These scripts should be run on the server, in `peertube-latest` directory.
a5f0521f
RK
87
88### create-transcoding-job.js
89
90You can use this script to force transcoding of an existing video.
91
92```
54a3a12e 93$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-transcoding-job -- -v [videoUUID]
a5f0521f
RK
94```
95
96### create-import-video-file-job.js
97
98You can use this script to import a video file to replace an already uploaded file or to add a new resolution to a video.
99
100```
54a3a12e
C
101$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
102```
103
104### prune-storage.js
105
106Some transcoded videos or shutdown at a bad time can leave some unused files on your storage.
107To delete them (a confirmation will be demanded first):
108
a5f0521f 109```
54a3a12e
C
110$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run prune-storage
111```