]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - 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
1 # CLI tools guide
2
3 - [Remote tools](#remote-tools)
4 - [import-videos.js](#import-videosjs)
5 - [upload.js](#uploadjs)
6 - [Server tools](#server-tools)
7 - [create-transcoding-job.js](#create-transcoding-jobjs)
8 - [create-import-video-file-job.js](#create-import-video-file-jobjs)
9 - [prune-storage.js](#prune-storagejs)
10
11 ## Remote Tools
12
13 You need at least 512MB RAM to run the script.
14 Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.
15 You need to follow all the following steps even if you are on a PeerTube server.
16
17 ### Dependencies
18
19 Install the [PeerTube dependencies](dependencies.md).
20
21 ### Installation
22
23 Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):
24
25 ```
26 $ git clone https://github.com/Chocobozzz/PeerTube.git
27 $ CLONE="$(pwd)/PeerTube"
28 ```
29
30 Run ``yarn install``
31 ```
32 $ cd ${CLONE}
33 $ yarn install
34 ```
35
36 Build server tools:
37 ```
38 $ cd ${CLONE}
39 $ npm run build:server
40 ```
41
42 ### import-videos.js
43
44 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.
45 Be sure you own the videos or have the author's authorization to do so.
46
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"
53 ```
54
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
65
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...
68
69 ### upload.js
70
71 You can use this script to import videos directly from the CLI.
72
73 ```
74 $ cd ${CLONE}
75 $ node dist/server/tools/upload.js --help
76 ```
77
78
79 ## Server tools
80
81 These scripts should be run on the server, in `peertube-latest` directory.
82
83 ### create-transcoding-job.js
84
85 You can use this script to force transcoding of an existing video.
86
87 ```
88 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-transcoding-job -- -v [videoUUID]
89 ```
90
91 ### create-import-video-file-job.js
92
93 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.
94
95 ```
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
101 Some transcoded videos or shutdown at a bad time can leave some unused files on your storage.
102 To delete them (a confirmation will be demanded first):
103
104 ```
105 $ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run prune-storage
106 ```