From: Andre Noll Date: Sun, 6 Jul 2008 17:26:50 +0000 (+0200) Subject: Teach the ls command to print the amplification value. X-Git-Tag: v0.3.3~52^2~11 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=77232467d1a62ea8a9dfce6bb06e61b185d8436e;p=paraslash.git Teach the ls command to print the amplification value. --- diff --git a/aft.c b/aft.c index 8797bd86..49cdf050 100644 --- a/aft.c +++ b/aft.c @@ -98,6 +98,8 @@ struct ls_widths { unsigned short duration_width; /** size of the num played field. */ unsigned short num_played_width; + /** size of the amp field. */ + unsigned short amp_width; }; /** Data passed from the ls command handler to its callback function. */ @@ -903,6 +905,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts, ret = para_printf(b, "%s" /* score */ "%s " /* attributes */ + "%*u " /* amp */ "%*d " /* image_id */ "%*d " /* lyrics_id */ "%*d " /* bitrate */ @@ -915,6 +918,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts, "%s\n", /* path */ score_buf, att_buf, + w->amp_width, afsi->amp, w->image_id_width, afsi->image_id, w->lyrics_id_width, afsi->lyrics_id, w->bitrate_width, afhi->bitrate, @@ -959,6 +963,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts, "%s: %lu\n" /* seconds total */ "%s: %s\n" /* last played time */ "%s: %d\n" /* num_played */ + "%s: %u\n" /* ampplification */ "%s" /* tag info */ "%s: %lu\n" /* chunk time */ "%s: %lu\n", /* num chunks */ @@ -979,6 +984,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts, status_item_list[SI_SECONDS_TOTAL], afhi->seconds_total, status_item_list[SI_LAST_PLAYED], last_played_time, status_item_list[SI_NUM_PLAYED], afsi->num_played, + status_item_list[SI_AMPLIFICATION], afsi->amp, afhi->info_string, status_item_list[SI_CHUNK_TIME], tv2ms(&afhi->chunk_tv), status_item_list[SI_NUM_CHUNKS], afhi->chunks_total @@ -1249,6 +1255,8 @@ static int prepare_ls_row(struct osl_row *row, void *ls_opts) /* get the number of chars to print this amount of time */ tmp = get_duration_width(d->afhi.seconds_total); w->duration_width = PARA_MAX(w->duration_width, tmp); + GET_NUM_DIGITS(d->afsi.amp, &num_digits); + w->amp_width = PARA_MAX(w->amp_width, num_digits); if (options->flags & LS_FLAG_ADMISSIBLE_ONLY) { GET_NUM_DIGITS(score, &num_digits); num_digits++; /* add one for the sign (space or "-") */