From 102f171a26add0f0e06f22eeace58047e7f0d956 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 11 Nov 2007 14:58:28 +0100 Subject: [PATCH] Add more status items. --- aac_afh.c | 4 ++-- aft.c | 59 ++++++++++++++++++++++++++++++---------------------- configure.ac | 5 +++-- gui_theme.c | 34 +++++++++++++++--------------- mp3_afh.c | 4 ++-- ogg_afh.c | 4 ++-- vss.c | 2 +- 7 files changed, 61 insertions(+), 51 deletions(-) diff --git a/aac_afh.c b/aac_afh.c index 4941fb1f..4166a399 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -139,8 +139,8 @@ static int aac_get_file_info(char *map, size_t numbytes, afhi->bitrate = ret / (channels * afhi->seconds_total * 1000); sprintf(afhi->info_string, "%s:\n%s:\n%s:\n", status_item_list[SI_AUDIO_FILE_INFO], - status_item_list[SI_TAG_INFO1], - status_item_list[SI_TAG_INFO2] + status_item_list[SI_TAGINFO1], + status_item_list[SI_TAGINFO2] ); tv_scale(20, &afhi->chunk_tv, &afhi->eof_tv); ret = 1; diff --git a/aft.c b/aft.c index cc6026fa..fa85e4e1 100644 --- a/aft.c +++ b/aft.c @@ -785,16 +785,20 @@ static char *make_lyrics_lines(struct afs_info *afsi) char *lyrics_name; lyr_get_name_by_id(afsi->lyrics_id, &lyrics_name); - return make_message("lyrics_id: %u\nlyrics_name: %s\n", - afsi->lyrics_id, lyrics_name? lyrics_name : "(none)"); + return make_message("%s: %u\n%s: %s\n", + status_item_list[SI_LYRICS_ID], afsi->lyrics_id, + status_item_list[SI_LYRICS_NAME], lyrics_name? + lyrics_name : "(none)"); } static char *make_image_lines(struct afs_info *afsi) { char *image_name; img_get_name_by_id(afsi->image_id, &image_name); - return make_message("image_id: %u\nimage_name: %s\n", - afsi->image_id, image_name? image_name : "(none)"); + return make_message("%s: %u\n%s: %s\n", + status_item_list[SI_IMAGE_ID], afsi->image_id, + status_item_list[SI_IMAGE_NAME], image_name? + image_name : "(none)"); } static char *make_filename_lines(const char *path, unsigned flags) @@ -803,12 +807,15 @@ static char *make_filename_lines(const char *path, unsigned flags) char *ret; if (!(flags & LS_FLAG_FULL_PATH)) - return make_message("%s: %s\n%s:\n", "basename", path, - "dir"); + return make_message("%s: %s\n%s:\n", + status_item_list[SI_BASENAME], path, + status_item_list[SI_DIRECTORY]); basename = para_basename(path), dirname = para_dirname(path); - ret = make_message("%s: %s\n%s: %s\n%s: %s\n", "path", path, - "dir", dirname, "basename", basename); + ret = make_message("%s: %s\n%s: %s\n%s: %s\n", + status_item_list[SI_PATH], path, + status_item_list[SI_DIRECTORY], dirname, + status_item_list[SI_BASENAME], basename); free(basename); free(dirname); return ret; @@ -883,38 +890,40 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts, if (opts->mode == LS_MODE_VERBOSE) { para_printf(b, "%s" /* filename stuff */ - "%s%s%s" /* score */ + "%s%s%s%s" /* score */ "%s\n" /* attributes */ - "hash: %s\n" + "%s: %s\n" /* hash */ "%s" /* image id, image name */ "%s" /* lyrics */ "%s: %dkbit/s\n" /* bitrate */ - "format: %s\n" + "%s: %s\n" /* format */ "%s: %dHz\n" /* frequency */ - "channels: %d\n" - "duration: %s\n" - "seconds_total: %lu\n" - "num_played: %d\n" - "last_played: %s\n" + "%s: %d\n" /* channels */ + "%s: %s\n" /* duration */ + "%s: %lu\n" /* seconds total */ + "%s: %d\n" /* num_played */ + "%s: %s\n" /* last_played */ "%s\n", /* tag info */ filename_lines, - have_score? "score: " : "", score_buf, + have_score? status_item_list[SI_SCORE] : "", + have_score? ": " : "", + score_buf, have_score? "\n" : "", att_lines, - asc_hash, + status_item_list[SI_HASH], asc_hash, image_lines, lyrics_lines, status_item_list[SI_BITRATE], afhi->bitrate, - audio_format_name(afsi->audio_format_id), + status_item_list[SI_FORMAT], audio_format_name(afsi->audio_format_id), status_item_list[SI_FREQUENCY], afhi->frequency, - afhi->channels, - duration_buf, - afhi->seconds_total, - afsi->num_played, - last_played_time, + status_item_list[SI_CHANNELS], afhi->channels, + status_item_list[SI_DURATION], duration_buf, + status_item_list[SI_SECONDS_TOTAL], afhi->seconds_total, + status_item_list[SI_NUM_PLAYED], afsi->num_played, + status_item_list[SI_LAST_PLAYED], last_played_time, afhi->info_string ); - } else { /* mbox mode */ + } else { /* mbox mode */ /* FIXME: merge with verbose output */ struct osl_object lyrics_def; lyr_get_def_by_id(afsi->lyrics_id, &lyrics_def); para_printf(b, diff --git a/configure.ac b/configure.ac index 06b7e524..d06983c3 100644 --- a/configure.ac +++ b/configure.ac @@ -549,10 +549,11 @@ AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM, ################################################################## status items status_items="basename status num_played mtime bitrate frequency file_size -status_flags format score audio_file_info tag_info1 tag_info2 afs_mode +status_flags format score audio_file_info taginfo1 taginfo2 afs_mode attributes_txt decoder_flags audiod_status play_time attributes_bitmap offset seconds_total stream_start current_time audiod_uptime image_id -lyrics_id duration directory" +lyrics_id duration directory lyrics_name image_name path hash channels +last_played" # $1: prefix, $2: items AC_DEFUN([make_enum_items], [$( diff --git a/gui_theme.c b/gui_theme.c index b0779791..84f8e45d 100644 --- a/gui_theme.c +++ b/gui_theme.c @@ -237,23 +237,23 @@ static void init_theme_colorful_blackness(struct gui_theme *t) d[SI_AUDIO_FILE_INFO].y = 43; d[SI_AUDIO_FILE_INFO].len = 100; - d[SI_TAG_INFO1].prefix = ""; - d[SI_TAG_INFO1].postfix = ""; - d[SI_TAG_INFO1].fg = COLOR_GREEN; - d[SI_TAG_INFO1].bg = COLOR_BLACK; - d[SI_TAG_INFO1].align = CENTER; - d[SI_TAG_INFO1].x = 0; - d[SI_TAG_INFO1].y = 53; - d[SI_TAG_INFO1].len = 100; - - d[SI_TAG_INFO2].prefix = ""; - d[SI_TAG_INFO2].postfix = ""; - d[SI_TAG_INFO2].fg = COLOR_GREEN; - d[SI_TAG_INFO2].bg = COLOR_BLACK; - d[SI_TAG_INFO2].align = CENTER; - d[SI_TAG_INFO2].x = 0; - d[SI_TAG_INFO2].y = 63; - d[SI_TAG_INFO2].len = 100; + d[SI_TAGINFO1].prefix = ""; + d[SI_TAGINFO1].postfix = ""; + d[SI_TAGINFO1].fg = COLOR_GREEN; + d[SI_TAGINFO1].bg = COLOR_BLACK; + d[SI_TAGINFO1].align = CENTER; + d[SI_TAGINFO1].x = 0; + d[SI_TAGINFO1].y = 53; + d[SI_TAGINFO1].len = 100; + + d[SI_TAGINFO2].prefix = ""; + d[SI_TAGINFO2].postfix = ""; + d[SI_TAGINFO2].fg = COLOR_GREEN; + d[SI_TAGINFO2].bg = COLOR_BLACK; + d[SI_TAGINFO2].align = CENTER; + d[SI_TAGINFO2].x = 0; + d[SI_TAGINFO2].y = 63; + d[SI_TAGINFO2].len = 100; d[SI_AFS_MODE].prefix = ""; d[SI_AFS_MODE].postfix = ""; diff --git a/mp3_afh.c b/mp3_afh.c index 710b6a50..fe174ea8 100644 --- a/mp3_afh.c +++ b/mp3_afh.c @@ -144,11 +144,11 @@ static void write_info_str(struct afh_info *afhi) "%s: A: %s, Y: %s, C: %s\n", /* taginfo 2*/ status_item_list[SI_AUDIO_FILE_INFO], mp3.vbr? 'v' : 'c', header_mode(&mp3.header), - status_item_list[SI_TAG_INFO1], v && *mp3.id3.title? + status_item_list[SI_TAGINFO1], v && *mp3.id3.title? mp3.id3.title : "(title tag not set)", v && *mp3.id3.artist? mp3.id3.artist : "(artist tag not set)", - status_item_list[SI_TAG_INFO2], + status_item_list[SI_TAGINFO2], v && *mp3.id3.album? mp3.id3.album : "(album tag not set)", v && *mp3.id3.year? mp3.id3.year : "????", diff --git a/ogg_afh.c b/ogg_afh.c index f223b57f..40bf925c 100644 --- a/ogg_afh.c +++ b/ogg_afh.c @@ -270,8 +270,8 @@ static int ogg_get_file_info(char *map, size_t numbytes, afhi->info_string[0] = '\0'; sprintf(afhi->info_string, "%s:\n%s:\n%s:\n", status_item_list[SI_AUDIO_FILE_INFO], - status_item_list[SI_TAG_INFO1], - status_item_list[SI_TAG_INFO2] + status_item_list[SI_TAGINFO1], + status_item_list[SI_TAGINFO2] ); afhi->chunk_tv.tv_sec = 0; afhi->chunk_tv.tv_usec = 250 * 1000; diff --git a/vss.c b/vss.c index 3c566227..0290ab75 100644 --- a/vss.c +++ b/vss.c @@ -194,7 +194,7 @@ static void vss_eof(void) free(mmd->afd.afhi.chunk_table); mmd->afd.afhi.chunk_table = NULL; tmp = make_message("%s:\n%s:\n%s:\n", status_item_list[SI_AUDIO_FILE_INFO], - status_item_list[SI_TAG_INFO1], status_item_list[SI_TAG_INFO2]); + status_item_list[SI_TAGINFO1], status_item_list[SI_TAGINFO2]); strncpy(mmd->afd.afhi.info_string, tmp, sizeof(mmd->afd.afhi.info_string)); mmd->afd.afhi.info_string[sizeof(mmd->afd.afhi.info_string) - 1] = '\0'; free(tmp); -- 2.39.5