docs/src/config/commands.md
103 lines · 5613 bytes
4 symbols in this file
1# Commands config
2
3The commands config file decides what options (that will run a certain command on select) to be display in the *video* and *playlist* page respectively, it is located in `~/.config/youtube-tui/commands.yml`.
4
5## Example commands config
6
7```yaml
8launch_command: loadpage library ;; flush ;; history clear ;; key Esc 0 ;; key Up 0 ;; key Up 0 ;; key Left 0 ;; key Enter 0 # the key commands select the searchbar on launch
9video:
10- Reload updated video: rmcache ${id} ;; video ${id} # remove the cached info first, then reload the page
11- Play video: parrun ${video-player} '${embed-url}'
12- Play audio: mpv stop ;; resume ;; mpv sprop loop-file no ;; mpv loadfile '${embed-url}' ;; echo mpv Player started
13- Play audio (loop): mpv stop ;; resume ;; mpv sprop loop-file inf ;; mpv loadfile '${embed-url}' ;; echo mpv Player started
14- View channel: channel ${channel-id}
15- Subscribe to channel: sync ${channel-id}
16- Open in browser: parrun ${browser} '${url}'
17- Toggle bookmark: togglemark ${id}
18- Save video to library: bookmark ${id} ;; run rm -rf '${save-path}${id}.*' ;; parrun ${terminal-emulator} ${youtube-downloader} '${embed-url}' -o '${save-path}%(title)s[%(id)s].%(ext)s'
19- Save audio to library: bookmark ${id} ;; parrun rm -rf '${save-path}${id}.*' ;; parrun ${terminal-emulator} ${youtube-downloader} '${embed-url}' -x -o '${save-path}%(title)s[%(id)s].%(ext)s'
20- 'Mode: ${provider}': switchprovider
21
22# ...
23```
24
25<hr>
26
27The few required fields are:
28
29- `video`
30- `saved_video`
31- `playlist`
32- `saved_playlist`
33- `channel`
34
35## Env variables
36
37Notice that a lot of the commands contains the `${label}` pattern, this actually replaces the text with the env variables set in `main.yml`, or is added by the current page (video or playlist) on-the-go.
38
39<!-- Replacing all these with known values it might look something like this: -->
40<!-- -->
41<!-- ```yaml -->
42<!-- launch_command: loadpage popular ;; flush ;; history clear -->
43<!-- video: -->
44<!-- - Play video: mpv 'https://youtube.com/embed/dQw4w9WgXcQ' -->
45<!-- - Play audio: konsole -e mpv 'https://youtube.com/embed/dQw4w9WgXcQ' --no-video -->
46<!-- - Open in browser: firefox 'https://youtu.be/dQw4w9WgXcQ' -->
47<!-- - Download video (webm): konsole -e yt-dlp -o '~/Downloads/%(title)s-%(id)s.%(ext)s' 'https://youtube.com/embed/dQw4w9WgXcQ' -->
48<!-- - 'Mode: ${provider}': '%switch-provider%' -->
49<!-- -->
50<!-- playlist: -->
51<!-- - Switch view: '%switch-view%' -->
52<!-- - Play all videos: mpv 'https://youtube.com/embed/Z8oiddSsB6I' 'https://youtube.com/embed/yiS0DPekSDQ' 'https://youtube.com/embed/YhM8GYuDFps' # and much more... -->
53<!-- - Play all audio: konsole -e mpv 'https://youtube.com/embed/Z8oiddSsB6I' 'https://youtube.com/embed/yiS0DPekSDQ' 'https://youtube.com/embed/YhM8GYuDFps' --no-video -->
54<!-- - Shuffle play all audio: konsole -e mpv 'https://youtube.com/embed/Z8oiddSsB6I' 'https://youtube.com/embed/yiS0DPekSDQ' 'https://youtube.com/embed/YhM8GYuDFps' --no-video --shuffle -->
55<!-- - Open in browser: firefox 'https://www.youtube.com/playlist?list=PLdgHTasZAjYZlCXN9rTcX9LFOQ-RIrzCs' -->
56<!-- - Download all video (webm): konsole -e yt-dlp -o '~/Downloads/%(title)s-%(id)s.%(ext)s' 'https://youtube.com/embed/Z8oiddSsB6I' 'https://youtube.com/embed/yiS0DPekSDQ' 'https://youtube.com/embed/YhM8GYuDFps' -->
57<!-- - 'Mode: ${provider}': '%switch-provider%' -->
58<!-- ``` -->
59
60<!-- > Global commands can also be used here. (Ones that start with an `:`). -->
61
62<!-- Below are the description of each of the fields: -->
63<!-- -->
64<!-- ### video -->
65<!-- -->
66<!-- Commands to be displayed in a video page. -->
67<!-- -->
68<!-- *Accept: `string_label: string_command` pairs* -->
69<!-- -->
70<!-- ### playlist -->
71<!-- -->
72<!-- Commands to be displayed in a playlist page (commands view). -->
73<!-- -->
74<!-- *Accept: `string_label: string_command` pairs* -->
75
76### Env reference
77
78Does not include custom env set in `main.yml`.
79
80|Name|Page|Value|
81|---|---|---|
82|`url`|search, popular, trending, video, playlist, channel (main)|String url to the web page|
83|`id`|video, playlist, channel (main)|String id of the video, playlist or channel|
84|`title`|video, playlist|Title of video or playlist|
85|`name`|channel|Name of channel|
86|`channel-id`|video, playlist|String id of the channel|
87|`embed-url`|video|String url to the embed video (required to play video using mpv from Invidious)|
88|`all-videos`|playlist|String url***s*** separated by space to all embed videos in a playlist|
89|`hover-url`|trending, popular, search|Url of the currenly hovering item.|
90|`hover-id`|trending, popular, search|Url of the currenly hovering item.|
91|`hover-title`|trending, popular, search|Title of the currenly hovering item.|
92|`hover-channel`|trending, popular, search|Channel name of the currenly hovering item.|
93|`hover-channel-id`|trending, popular, search|Channel ID of the currenly hovering item.|
94|`hover-channel`|trending, popular, search|Url of the currenly hovering item.|
95|`hover-channel-id`|trending, popular, search|Url of the currenly hovering item.|
96|`hover-channel-url`|feed|Url of the currenly hovering channel.|
97|`hover-channel-id`|feed|ID of the currenly hovering channel.|
98|`hover-video-url`|feed|Url of the currenly hovering video.|
99|`hover-video-id`|feed|ID of the currenly hovering video.|
100|`all-ids`|playlist|IDs of all videos in a playlist, separated with space.|
101|`offline-path`|Saved video and playlist only|Direct path to saved file.|
102|`mpv-queuelist`|Online playlists only|Valid mpv command to queue all videos in the list.|
103|`offline-queuelist`|Saved playlists only|Valid mpv command to queue all saved videos in the list.|