Skip to content

Commit b1bfbe0

Browse files
author
Tony Crisci
committed
Update readme for variables
fixes #150
1 parent 9300ff1 commit b1bfbe0

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,20 @@ playerctl metadata --format "Now playing: {{ artist }} - {{ album }} - {{ title
8787
# prints 'Now playing: Lana Del Rey - Born To Die - Video Games'
8888
```
8989

90-
Included in the template language are some helper functions for common formatting that you can call on template variables.
90+
Included in the template language are some built-in variables and helper functions for common formatting that you can call on template variables.
9191

9292
```bash
93+
# Prints 'Total length: 3:23'
9394
playerctl metadata --format "Total length: {{ duration(mpris:length) }}"
94-
# prints 'Total length: 3:23'
9595

96+
# Prints 'At position: 1:16'
9697
playerctl position --format "At position: {{ duration(position) }}"
97-
# prints 'At position: 1:16'
9898

99+
# Prints 'Artist in lowercase: lana del rey'
99100
playerctl metadata --format "Artist in lowercase: {{ lc(artist) }}"
100-
# prints 'Artist in lowercase: lana del rey'
101101

102+
# Prints 'STATUS: PLAYING'
102103
playerctl status --format "STATUS: {{ uc(status) }}"
103-
# prints 'STATUS: PLAYING'
104104
```
105105

106106
| Function | Argument | Description |
@@ -112,6 +112,16 @@ playerctl status --format "STATUS: {{ uc(status) }}"
112112
| `default` | any, any | Print the first value if it is present, or else print the second. |
113113
| `emoji` | status or volume | Try to convert the variable to an emoji representation. |
114114

115+
| Variable | Description |
116+
| ------------ | ------------------------------------------------- |
117+
| `playerName` | The name of the current player. |
118+
| `position` | The position of the current track in microseconds |
119+
| `status` | The playback status of the current player |
120+
| `volume` | The volume from 0.0 to 1.0 |
121+
| `album` | The album of the current track. |
122+
| `artist` | The artist of the current track. |
123+
| `title` | The title of the current track. |
124+
115125
### Following changes
116126

117127
You can pass the `--follow` flag to query commands to block, wait for players to connect, and print the query whenever it changes. If players are passed with `--player`, players earlier in the list will be preferred in the order they appear unless `--all-players` is passed. When no player can support the query, such as when all the players exit, a newline will be printed. For example, to be notified of information about the latest currently playing track for your media players, use:
@@ -197,7 +207,7 @@ fi
197207

198208
## Installing
199209

200-
First, check and see if the library is available from your package manager (if it is not, get someone to host a package for you) and also check the [releases](https://github.com/acrisci/playerctl/releases) page on github.
210+
First, check and see if Playerctl is available from your package manager (if it is not, get someone to host a package for you) and also check the [releases](https://github.com/acrisci/playerctl/releases) page on github.
201211

202212
### Fedora
203213

@@ -231,7 +241,6 @@ Additionally, you also need the following build dependencies:
231241

232242
Fedora users also need to install `redhat-rpm-config`
233243

234-
235244
To generate and build the project to contribute to development and install playerctl to `/`:
236245

237246
```

0 commit comments

Comments
 (0)