diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-13 14:27:44 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-14 11:08:55 +0200 |
commit | 8704acf49efc770d73bf07c10468ed8c74d28a83 (patch) | |
tree | ffd46289fcf9a13ac4412b167e9f71dfb35753c5 /support/doc/tools.md | |
parent | 1d9d9cfdcf3983e3fd89026bc4b5633a8abf5752 (diff) | |
download | PeerTube-8704acf49efc770d73bf07c10468ed8c74d28a83.tar.gz PeerTube-8704acf49efc770d73bf07c10468ed8c74d28a83.tar.zst PeerTube-8704acf49efc770d73bf07c10468ed8c74d28a83.zip |
one cli to unite them all
Ash nazg thrakatulûk agh burzum-ishi krimpatul
- refactor import-videos to use the youtubeDL helper
- add very basic tests for the cli
Diffstat (limited to 'support/doc/tools.md')
-rw-r--r-- | support/doc/tools.md | 75 |
1 files changed, 68 insertions, 7 deletions
diff --git a/support/doc/tools.md b/support/doc/tools.md index 0a2f1f11b..1db29edc0 100644 --- a/support/doc/tools.md +++ b/support/doc/tools.md | |||
@@ -1,14 +1,60 @@ | |||
1 | # CLI tools guide | 1 | # CLI tools guide |
2 | 2 | - [CLI wrapper](#cli-wrapper) | |
3 | - [Remote tools](#remote-tools) | 3 | - [Remote tools](#remote-tools) |
4 | - [import-videos.js](#import-videosjs) | 4 | - [peertube-import-videos.js](#peertube-import-videosjs) |
5 | - [upload.js](#uploadjs) | 5 | - [peertube-upload.js](#peertube-uploadjs) |
6 | - [peertube-watch.js](#peertube-watch) | ||
6 | - [Server tools](#server-tools) | 7 | - [Server tools](#server-tools) |
7 | - [parse-log](#parse-log) | 8 | - [parse-log](#parse-log) |
8 | - [create-transcoding-job.js](#create-transcoding-jobjs) | 9 | - [create-transcoding-job.js](#create-transcoding-jobjs) |
9 | - [create-import-video-file-job.js](#create-import-video-file-jobjs) | 10 | - [create-import-video-file-job.js](#create-import-video-file-jobjs) |
10 | - [prune-storage.js](#prune-storagejs) | 11 | - [prune-storage.js](#prune-storagejs) |
11 | 12 | ||
13 | ## CLI wrapper | ||
14 | |||
15 | The wrapper provides a convenient interface to most scripts, and requires the [same dependencies](#dependencies). You can access it as `peertube` via an alias in your `.bashrc` like `alias peertube="node ${PEERTUBE_PATH}/dist/server/tools/peertube.js"`: | ||
16 | |||
17 | ``` | ||
18 | Usage: peertube [command] [options] | ||
19 | |||
20 | Options: | ||
21 | |||
22 | -v, --version output the version number | ||
23 | -h, --help output usage information | ||
24 | |||
25 | Commands: | ||
26 | |||
27 | auth [action] register your accounts on remote instances to use them with other commands | ||
28 | upload|up upload a video | ||
29 | import-videos|import import a video from a streaming platform | ||
30 | watch|w watch a video in the terminal ✩°。⋆ | ||
31 | help [cmd] display help for [cmd] | ||
32 | ``` | ||
33 | |||
34 | The wrapper can keep track of instances you have an account on. We limit to one account per instance for now. | ||
35 | |||
36 | ```bash | ||
37 | $ peertube auth add -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD" | ||
38 | $ peertube auth list | ||
39 | ┌──────────────────────────────┬──────────────────────────────┐ | ||
40 | │ instance │ login │ | ||
41 | ├──────────────────────────────┼──────────────────────────────┤ | ||
42 | │ "PEERTUBE_URL" │ "PEERTUBE_USER" │ | ||
43 | └──────────────────────────────┴──────────────────────────────┘ | ||
44 | ``` | ||
45 | |||
46 | You can now use that account to upload videos without feeding the same parameters again. | ||
47 | |||
48 | ```bash | ||
49 | $ peertube up <videoFile> | ||
50 | ``` | ||
51 | |||
52 | And now that your video is online, you can watch it from the confort of your terminal (use `peertube watch --help` to see the supported players): | ||
53 | |||
54 | ```bash | ||
55 | $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10 | ||
56 | ``` | ||
57 | |||
12 | ## Remote Tools | 58 | ## Remote Tools |
13 | 59 | ||
14 | You need at least 512MB RAM to run the script. | 60 | You need at least 512MB RAM to run the script. |
@@ -40,13 +86,13 @@ $ cd ${CLONE} | |||
40 | $ npm run build:server | 86 | $ npm run build:server |
41 | ``` | 87 | ``` |
42 | 88 | ||
43 | ### import-videos.js | 89 | ### peertube-import-videos.js |
44 | 90 | ||
45 | 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. | 91 | 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. |
46 | Be sure you own the videos or have the author's authorization to do so. | 92 | Be sure you own the videos or have the author's authorization to do so. |
47 | 93 | ||
48 | ```sh | 94 | ```sh |
49 | $ node dist/server/tools/import-videos.js \ | 95 | $ node dist/server/tools/peertube-import-videos.js \ |
50 | -u "PEERTUBE_URL" \ | 96 | -u "PEERTUBE_URL" \ |
51 | -U "PEERTUBE_USER" \ | 97 | -U "PEERTUBE_USER" \ |
52 | --password "PEERTUBE_PASSWORD" \ | 98 | --password "PEERTUBE_PASSWORD" \ |
@@ -70,7 +116,7 @@ Already downloaded videos will not be uploaded twice, so you can run and re-run | |||
70 | Videos will be publicly available after transcoding (you can see them before that in your account on the web interface). | 116 | Videos will be publicly available after transcoding (you can see them before that in your account on the web interface). |
71 | 117 | ||
72 | 118 | ||
73 | ### upload.js | 119 | ### peertube-upload.js |
74 | 120 | ||
75 | You can use this script to import videos directly from the CLI. | 121 | You can use this script to import videos directly from the CLI. |
76 | 122 | ||
@@ -78,9 +124,24 @@ Videos will be publicly available after transcoding (you can see them before tha | |||
78 | 124 | ||
79 | ``` | 125 | ``` |
80 | $ cd ${CLONE} | 126 | $ cd ${CLONE} |
81 | $ node dist/server/tools/upload.js --help | 127 | $ node dist/server/tools/peertube-upload.js --help |
82 | ``` | 128 | ``` |
83 | 129 | ||
130 | ### peertube-watch.js | ||
131 | |||
132 | You can use this script to play videos directly from the CLI. | ||
133 | |||
134 | It provides support for different players: | ||
135 | |||
136 | - ascii (default ; plays in ascii art in your terminal!) | ||
137 | - mpv | ||
138 | - mplayer | ||
139 | - vlc | ||
140 | - stdout | ||
141 | - xbmc | ||
142 | - airplay | ||
143 | - chromecast | ||
144 | |||
84 | 145 | ||
85 | ## Server tools | 146 | ## Server tools |
86 | 147 | ||