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