]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - support/doc/tools.md
(doc) adding tools documentation for job creation
[github/Chocobozzz/PeerTube.git] / support / doc / tools.md
1 # CLI tools guide
2
3 - [Installation](#installation)
4 - [Usage](#usage)
5 - [import-videos.js](#import-videosjs)
6 - [upload.js](#uploadjs)
7 - [create-transcoding-job.js](#create-transcoding-jobjs)
8 - [create-import-video-file-job.js](#create-import-video-file-jobjs)
9
10 ## Installation
11
12 ## Prerequisites
13
14 You need at least 512MB RAM to run the script.
15 Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.
16 You need to follow all the following steps even if you are on a PeerTube server.
17
18 ### Dependencies
19
20 Install the [PeerTube dependencies](dependencies.md).
21
22 ### Installation
23
24 Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):
25
26 ```
27 $ git clone https://github.com/Chocobozzz/PeerTube.git
28 $ CLONE="$(pwd)/PeerTube"
29 ```
30
31 Run ``yarn install``
32 ```
33 $ cd ${CLONE}
34 $ yarn install
35 ```
36
37 Build server tools:
38 ```
39 $ cd ${CLONE}
40 $ npm run build:server
41 ```
42
43 ## Tools
44
45 ### import-videos.js
46
47 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.
48 Be sure you own the videos or have the author's authorization to do so.
49
50 ```sh
51 $ node dist/server/tools/import-videos.js \
52 -u "PEERTUBE_URL" \
53 -U "PEERTUBE_USER" \
54 --password "PEERTUBE_PASSWORD" \
55 -t "TARGET_URL"
56 ```
57
58 * `PEERTUBE_URL` : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re
59 * `PEERTUBE_USER` : your PeerTube account where videos will be uploaded
60 * `PEERTUBE_PASSWORD` : password of your PeerTube account (if omitted, you will be prompted for it)
61 * `TARGET_URL` : the target url you want to import. Examples:
62 * YouTube:
63 * Channel: https://www.youtube.com/channel/ChannelId
64 * User https://www.youtube.com/c/UserName or https://www.youtube.com/user/UserName
65 * Video https://www.youtube.com/watch?v=blabla
66 * Vimeo: https://vimeo.com/xxxxxx
67 * Dailymotion: https://www.dailymotion.com/xxxxx
68
69 The script will get all public videos from Youtube, download them and upload to PeerTube.
70 Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection...
71
72 ### upload.js
73
74 You can use this script to import videos directly from the CLI.
75
76 ```
77 $ cd ${CLONE}
78 $ node dist/server/tools/upload.js --help
79 ```
80
81 ## Tools to create jobs in the queue
82
83 ### create-transcoding-job.js
84
85 You can use this script to force transcoding of an existing video.
86
87 ```
88 $ 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 $ npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
97 ```