diff --git a/src/core.c b/src/core.c index 5038470a..d0a4d9d5 100644 --- a/src/core.c +++ b/src/core.c @@ -1133,7 +1133,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.print = &print_mpd_file; END OBJ(mpd_percent, &update_mpd) init_mpd(); - obj->callbacks.print = &print_mpd_percent; + obj->callbacks.percentage = &mpd_percentage; END OBJ(mpd_album, &update_mpd) mpd_set_maxlen(mpd_album); init_mpd(); diff --git a/src/mpd.c b/src/mpd.c index f02f5a39..7ea626db 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -370,10 +370,10 @@ void print_mpd_length(struct text_object *obj, char *p, int p_max_size) format_media_player_time(p, p_max_size, mpd_info.length); } -void print_mpd_percent(struct text_object *obj, char *p, int p_max_size) +uint8_t mpd_percentage(struct text_object *obj) { (void)obj; - percent_print(p, p_max_size, (int)(mpd_info.progress * 100)); + return round_to_int(mpd_info.progress * 100.0f); } uint8_t mpd_barval(struct text_object *obj) diff --git a/src/mpd.h b/src/mpd.h index 6721b2de..fd180a73 100644 --- a/src/mpd.h +++ b/src/mpd.h @@ -16,7 +16,7 @@ void update_mpd(void); void print_mpd_elapsed(struct text_object *, char *, int); void print_mpd_length(struct text_object *, char *, int); -void print_mpd_percent(struct text_object *, char *, int); +uint8_t mpd_percentage(struct text_object *); uint8_t mpd_barval(struct text_object *); void print_mpd_smart(struct text_object *, char *, int); void print_mpd_title(struct text_object *, char *, int);