Merge branch 'mpd-volume'

This commit is contained in:
Daniel Eklöf 2020-12-02 21:45:04 +01:00
commit c9ef44a775
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 8 additions and 0 deletions

View file

@ -14,6 +14,8 @@
(https://codeberg.org/dnkl/yambar/issues/9). (https://codeberg.org/dnkl/yambar/issues/9).
* script: new module, adds support for custom user scripts * script: new module, adds support for custom user scripts
(https://codeberg.org/dnkl/yambar/issues/11). (https://codeberg.org/dnkl/yambar/issues/11).
* mpd: `volume` tag. This is a range tag that represents MPD's current volume
in percentage (0-100)
### Deprecated ### Deprecated

View file

@ -452,6 +452,9 @@ artist/album/song.
| consume | consume
: bool : bool
: True if the *consume* flag is set : True if the *consume* flag is set
| volume
: range
: Volume of MPD in percentage
| album | album
: string : string
: Currently playing album (also valid in *paused* state) : Currently playing album (also valid in *paused* state)

View file

@ -38,6 +38,7 @@ struct private {
bool repeat; bool repeat;
bool random; bool random;
bool consume; bool consume;
int volume;
char *album; char *album;
char *artist; char *artist;
char *title; char *title;
@ -162,6 +163,7 @@ content(struct module *mod)
tag_new_bool(mod, "repeat", m->repeat), tag_new_bool(mod, "repeat", m->repeat),
tag_new_bool(mod, "random", m->random), tag_new_bool(mod, "random", m->random),
tag_new_bool(mod, "consume", m->consume), tag_new_bool(mod, "consume", m->consume),
tag_new_int_range(mod, "volume", m->volume, 0, 100),
tag_new_string(mod, "album", m->album), tag_new_string(mod, "album", m->album),
tag_new_string(mod, "artist", m->artist), tag_new_string(mod, "artist", m->artist),
tag_new_string(mod, "title", m->title), tag_new_string(mod, "title", m->title),
@ -320,6 +322,7 @@ update_status(struct module *mod)
m->repeat = mpd_status_get_repeat(status); m->repeat = mpd_status_get_repeat(status);
m->random = mpd_status_get_random(status); m->random = mpd_status_get_random(status);
m->consume = mpd_status_get_consume(status); m->consume = mpd_status_get_consume(status);
m->volume = mpd_status_get_volume(status);
m->duration = mpd_status_get_total_time(status) * 1000; m->duration = mpd_status_get_total_time(status) * 1000;
m->elapsed.value = mpd_status_get_elapsed_ms(status); m->elapsed.value = mpd_status_get_elapsed_ms(status);
m->elapsed.when = now; m->elapsed.when = now;