]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/tools.md
Fix import with when the imported file has the same extension than an
[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
35501c0f
C
66 The script will get all public videos from Youtube, download them and upload to PeerTube.
67 Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection...
358770db
C
68
69### upload.js
70
71You can use this script to import videos directly from the CLI.
72
73```
05e67d62
C
74$ cd ${CLONE}
75$ node dist/server/tools/upload.js --help
358770db 76```
a5f0521f 77
54a3a12e
C
78
79## Server tools
80
81These scripts should be run on the server, in `peertube-latest` directory.
a5f0521f
RK
82
83### create-transcoding-job.js
84
85You can use this script to force transcoding of an existing video.
86
87```
54a3a12e 88$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-transcoding-job -- -v [videoUUID]
a5f0521f
RK
89```
90
91### create-import-video-file-job.js
92
93You can use this script to import a video file to replace an already uploaded file or to add a new resolution to a video.
94
95```
54a3a12e
C
96$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
97```
98
99### prune-storage.js
100
101Some transcoded videos or shutdown at a bad time can leave some unused files on your storage.
102To delete them (a confirmation will be demanded first):
103
a5f0521f 104```
54a3a12e
C
105$ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run prune-storage
106```