Define status items in para.h.
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 14 Jul 2017 15:11:32 +0000 (17:11 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 21 Jul 2017 14:51:12 +0000 (16:51 +0200)
The only reason the status item enum and string array are defined in
configure.ac is that upper case identifiers and lower case strings
are not easy to do in cpp as it lacks toupper().

However, configure.ac is not the right place for defining C language
constructs as the configure script should only check for installed
packages.

This commit moves the definition of the status item enum and array to
para.h and modifies all users to use lower case for the item names.
This was automated with a script which essentially did

upper=${i^^}
sed -i "s/\<SI_$upper/SI_$i/g" $files

for each status item $i. Care has been taken to leave the order of
the status items unchanged. This is important because the item numbers
must be considered part of the API between server and client.

12 files changed:
afh_common.c
aft.c
amp_filter.c
audioc.c
audiod.c
audiod_command.c
command.c
configure.ac
filter.c
gui.c
gui_theme.c
para.h

index b47def8..516ea65 100644 (file)
@@ -21,7 +21,7 @@ extern afh_init_func mp3_afh_init, ogg_afh_init, aac_afh_init, wma_afh_init,
        spx_afh_init, flac_afh_init, opus_afh_init;
 
 /** The list of all status items */
-const char *status_item_list[] = {STATUS_ITEM_ARRAY};
+const char *status_item_list[] = {STATUS_ITEMS};
 
 /**
  * The list of supported audio formats.
@@ -454,21 +454,21 @@ unsigned afh_get_afhi_txt(int audio_format_num, struct afh_info *afhi, char **re
                "%s: %s\n" /* year */
                "%s: %s\n" /* album */
                "%s: %s\n", /* comment */
-               status_item_list[SI_BITRATE], afhi->bitrate,
-               status_item_list[SI_FORMAT], audio_format_name(audio_format_num),
-               status_item_list[SI_FREQUENCY], afhi->frequency,
-               status_item_list[SI_CHANNELS], afhi->channels,
-               status_item_list[SI_SECONDS_TOTAL], afhi->seconds_total,
-               status_item_list[SI_CHUNK_TIME], (long unsigned)afhi->chunk_tv.tv_sec,
+               status_item_list[SI_bitrate], afhi->bitrate,
+               status_item_list[SI_format], audio_format_name(audio_format_num),
+               status_item_list[SI_frequency], afhi->frequency,
+               status_item_list[SI_channels], afhi->channels,
+               status_item_list[SI_seconds_total], afhi->seconds_total,
+               status_item_list[SI_chunk_time], (long unsigned)afhi->chunk_tv.tv_sec,
                        (long unsigned)afhi->chunk_tv.tv_usec,
-               status_item_list[SI_NUM_CHUNKS], afhi->chunks_total,
-               status_item_list[SI_MAX_CHUNK_SIZE], afhi->max_chunk_size,
-               status_item_list[SI_TECHINFO], afhi->techinfo? afhi->techinfo : "",
-               status_item_list[SI_ARTIST], afhi->tags.artist? afhi->tags.artist : "",
-               status_item_list[SI_TITLE], afhi->tags.title? afhi->tags.title : "",
-               status_item_list[SI_YEAR], afhi->tags.year? afhi->tags.year : "",
-               status_item_list[SI_ALBUM], afhi->tags.album? afhi->tags.album : "",
-               status_item_list[SI_COMMENT], afhi->tags.comment? afhi->tags.comment : ""
+               status_item_list[SI_num_chunks], afhi->chunks_total,
+               status_item_list[SI_max_chunk_size], afhi->max_chunk_size,
+               status_item_list[SI_techinfo], afhi->techinfo? afhi->techinfo : "",
+               status_item_list[SI_artist], afhi->tags.artist? afhi->tags.artist : "",
+               status_item_list[SI_title], afhi->tags.title? afhi->tags.title : "",
+               status_item_list[SI_year], afhi->tags.year? afhi->tags.year : "",
+               status_item_list[SI_album], afhi->tags.album? afhi->tags.album : "",
+               status_item_list[SI_comment], afhi->tags.comment? afhi->tags.comment : ""
        );
 }
 
diff --git a/aft.c b/aft.c
index 0c4c932..68e89db 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -753,11 +753,11 @@ static int write_attribute_items(struct para_buffer *b,
        char *att_text;
        int ret;
 
-       WRITE_STATUS_ITEM(b, SI_ATTRIBUTES_BITMAP, "%s\n", att_bitmap);
+       WRITE_STATUS_ITEM(b, SI_attributes_bitmap, "%s\n", att_bitmap);
        ret = get_attribute_text(&afsi->attributes, " ", &att_text);
        if (ret < 0)
                return ret;
-       WRITE_STATUS_ITEM(b, SI_ATTRIBUTES_TXT, "%s\n", att_text);
+       WRITE_STATUS_ITEM(b, SI_attributes_txt, "%s\n", att_text);
        free(att_text);
        return ret;
 }
@@ -766,9 +766,9 @@ static void write_lyrics_items(struct para_buffer *b, struct afs_info *afsi)
 {
        char *lyrics_name;
 
-       WRITE_STATUS_ITEM(b, SI_LYRICS_ID, "%u\n", afsi->lyrics_id);
+       WRITE_STATUS_ITEM(b, SI_lyrics_id, "%u\n", afsi->lyrics_id);
        lyr_get_name_by_id(afsi->lyrics_id, &lyrics_name);
-       WRITE_STATUS_ITEM(b, SI_LYRICS_NAME, "%s\n", lyrics_name?
+       WRITE_STATUS_ITEM(b, SI_lyrics_name, "%s\n", lyrics_name?
                lyrics_name : "(none)");
 }
 
@@ -776,9 +776,9 @@ static void write_image_items(struct para_buffer *b, struct afs_info *afsi)
 {
        char *image_name;
 
-       WRITE_STATUS_ITEM(b, SI_IMAGE_ID, "%u\n", afsi->image_id);
+       WRITE_STATUS_ITEM(b, SI_image_id, "%u\n", afsi->image_id);
        img_get_name_by_id(afsi->image_id, &image_name);
-       WRITE_STATUS_ITEM(b, SI_IMAGE_NAME, "%s\n", image_name?
+       WRITE_STATUS_ITEM(b, SI_image_name, "%s\n", image_name?
                image_name : "(none)");
 }
 
@@ -788,14 +788,14 @@ static void write_filename_items(struct para_buffer *b, const char *path,
        char *val;
 
        if (basename) {
-               WRITE_STATUS_ITEM(b, SI_BASENAME, "%s\n", path);
+               WRITE_STATUS_ITEM(b, SI_basename, "%s\n", path);
                return;
        }
-       WRITE_STATUS_ITEM(b, SI_PATH, "%s\n", path);
+       WRITE_STATUS_ITEM(b, SI_path, "%s\n", path);
        val = para_basename(path);
-       WRITE_STATUS_ITEM(b, SI_BASENAME, "%s\n", val? val : "");
+       WRITE_STATUS_ITEM(b, SI_basename, "%s\n", val? val : "");
        val = para_dirname(path);
-       WRITE_STATUS_ITEM(b, SI_DIRECTORY, "%s\n", val? val : "");
+       WRITE_STATUS_ITEM(b, SI_directory, "%s\n", val? val : "");
        free(val);
 }
 
@@ -912,36 +912,36 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
        }
        write_filename_items(b, d->path, lls_opt_given(r_b));
        if (lls_opt_given(r_a))
-               WRITE_STATUS_ITEM(b, SI_SCORE, "%li\n", d->score);
+               WRITE_STATUS_ITEM(b, SI_score, "%li\n", d->score);
        ret = write_attribute_items(b, att_buf, afsi);
        if (ret < 0)
                goto out;
        write_image_items(b, afsi);
        write_lyrics_items(b, afsi);
        hash_to_asc(d->hash, asc_hash);
-       WRITE_STATUS_ITEM(b, SI_HASH, "%s\n", asc_hash);
-       WRITE_STATUS_ITEM(b, SI_BITRATE, "%dkbit/s\n", afhi->bitrate);
-       WRITE_STATUS_ITEM(b, SI_FORMAT, "%s\n",
+       WRITE_STATUS_ITEM(b, SI_hash, "%s\n", asc_hash);
+       WRITE_STATUS_ITEM(b, SI_bitrate, "%dkbit/s\n", afhi->bitrate);
+       WRITE_STATUS_ITEM(b, SI_format, "%s\n",
                audio_format_name(afsi->audio_format_id));
-       WRITE_STATUS_ITEM(b, SI_FREQUENCY, "%dHz\n", afhi->frequency);
-       WRITE_STATUS_ITEM(b, SI_CHANNELS, "%d\n", afhi->channels);
-       WRITE_STATUS_ITEM(b, SI_DURATION, "%s\n", duration_buf);
-       WRITE_STATUS_ITEM(b, SI_SECONDS_TOTAL, "%" PRIu32 "\n",
+       WRITE_STATUS_ITEM(b, SI_frequency, "%dHz\n", afhi->frequency);
+       WRITE_STATUS_ITEM(b, SI_channels, "%d\n", afhi->channels);
+       WRITE_STATUS_ITEM(b, SI_duration, "%s\n", duration_buf);
+       WRITE_STATUS_ITEM(b, SI_seconds_total, "%" PRIu32 "\n",
                afhi->seconds_total);
-       WRITE_STATUS_ITEM(b, SI_LAST_PLAYED, "%s\n", last_played_time);
-       WRITE_STATUS_ITEM(b, SI_NUM_PLAYED, "%u\n", afsi->num_played);
-       WRITE_STATUS_ITEM(b, SI_AMPLIFICATION, "%u\n", afsi->amp);
-       WRITE_STATUS_ITEM(b, SI_CHUNK_TIME, "%lu\n", tv2ms(&afhi->chunk_tv));
-       WRITE_STATUS_ITEM(b, SI_NUM_CHUNKS, "%" PRIu32 "\n",
+       WRITE_STATUS_ITEM(b, SI_last_played, "%s\n", last_played_time);
+       WRITE_STATUS_ITEM(b, SI_num_played, "%u\n", afsi->num_played);
+       WRITE_STATUS_ITEM(b, SI_amplification, "%u\n", afsi->amp);
+       WRITE_STATUS_ITEM(b, SI_chunk_time, "%lu\n", tv2ms(&afhi->chunk_tv));
+       WRITE_STATUS_ITEM(b, SI_num_chunks, "%" PRIu32 "\n",
                afhi->chunks_total);
-       WRITE_STATUS_ITEM(b, SI_MAX_CHUNK_SIZE, "%" PRIu32 "\n",
+       WRITE_STATUS_ITEM(b, SI_max_chunk_size, "%" PRIu32 "\n",
                afhi->max_chunk_size);
-       WRITE_STATUS_ITEM(b, SI_TECHINFO, "%s\n", afhi->techinfo);
-       WRITE_STATUS_ITEM(b, SI_ARTIST, "%s\n", afhi->tags.artist);
-       WRITE_STATUS_ITEM(b, SI_TITLE, "%s\n", afhi->tags.title);
-       WRITE_STATUS_ITEM(b, SI_YEAR, "%s\n", afhi->tags.year);
-       WRITE_STATUS_ITEM(b, SI_ALBUM, "%s\n", afhi->tags.album);
-       WRITE_STATUS_ITEM(b, SI_COMMENT, "%s\n", afhi->tags.comment);
+       WRITE_STATUS_ITEM(b, SI_techinfo, "%s\n", afhi->techinfo);
+       WRITE_STATUS_ITEM(b, SI_artist, "%s\n", afhi->tags.artist);
+       WRITE_STATUS_ITEM(b, SI_title, "%s\n", afhi->tags.title);
+       WRITE_STATUS_ITEM(b, SI_year, "%s\n", afhi->tags.year);
+       WRITE_STATUS_ITEM(b, SI_album, "%s\n", afhi->tags.album);
+       WRITE_STATUS_ITEM(b, SI_comment, "%s\n", afhi->tags.comment);
        if (opts->mode == LS_MODE_MBOX) {
                struct osl_object lyrics_def;
                lyr_get_def_by_id(afsi->lyrics_id, &lyrics_def);
@@ -975,8 +975,8 @@ static void make_inode_status_items(struct para_buffer *pb)
        ret = strftime(mtime_str, 29, "%b %d %Y", &mtime_tm);
        assert(ret > 0); /* number of bytes placed in mtime_str */
 out:
-       WRITE_STATUS_ITEM(pb, SI_MTIME, "%s\n", mtime_str);
-       WRITE_STATUS_ITEM(pb, SI_FILE_SIZE, "%ld\n", statbuf.st_size / 1024);
+       WRITE_STATUS_ITEM(pb, SI_mtime, "%s\n", mtime_str);
+       WRITE_STATUS_ITEM(pb, SI_file_size, "%ld\n", statbuf.st_size / 1024);
 }
 
 static int make_status_items(void)
index f3d0d87..4f8e049 100644 (file)
@@ -39,8 +39,8 @@ static void amp_open(struct filter_node *fn)
 
        fn->private_data = pad;
        fn->min_iqs = 2;
-       if (!given && stat_item_values[SI_AMPLIFICATION])
-               sscanf(stat_item_values[SI_AMPLIFICATION], "%u", &pad->amp);
+       if (!given && stat_item_values[SI_amplification])
+               sscanf(stat_item_values[SI_amplification], "%u", &pad->amp);
        else
                pad->amp = amp_arg;
        PARA_INFO_LOG("amplification: %u (scaling factor: %1.2f)\n",
index 38a8db5..2711ac1 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -116,7 +116,7 @@ static void version_completer(struct i9e_completion_info *ci,
 static void stat_completer(struct i9e_completion_info *ci,
                struct i9e_completion_result *cr)
 {
-       char *sia[] = {STATUS_ITEM_ARRAY NULL};
+       char *sia[] = {STATUS_ITEMS NULL};
        char *opts[] = {LSG_AUDIOD_CMD_STAT_OPTS, NULL};
 
        if (ci->word_num <= 2 && ci->word && ci->word[0] == '-')
index 74d0ce2..d3c9c46 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -803,38 +803,38 @@ static int update_item(int itemnum, char *buf)
 {
        long unsigned sec, usec;
 
-       if (stat_task->clock_diff_count && itemnum != SI_CURRENT_TIME)
+       if (stat_task->clock_diff_count && itemnum != SI_current_time)
                return 1;
        free(stat_item_values[itemnum]);
        stat_item_values[itemnum] = para_strdup(buf);
        stat_client_write_item(itemnum);
        switch (itemnum) {
-       case SI_STATUS_FLAGS:
+       case SI_status_flags:
                stat_task->vss_status = 0;
                if (strchr(buf, 'N'))
                        stat_task->vss_status |= VSS_STATUS_FLAG_NEXT;
                if (strchr(buf, 'P'))
                        stat_task->vss_status |= VSS_STATUS_FLAG_PLAYING;
                break;
-       case SI_OFFSET:
+       case SI_offset:
                stat_task->offset_seconds = atoi(buf);
                break;
-       case SI_SECONDS_TOTAL:
+       case SI_seconds_total:
                stat_task->length_seconds = atoi(buf);
                break;
-       case SI_STREAM_START:
+       case SI_stream_start:
                if (sscanf(buf, "%lu.%lu", &sec, &usec) == 2) {
                        stat_task->server_stream_start.tv_sec = sec;
                        stat_task->server_stream_start.tv_usec = usec;
                }
                break;
-       case SI_CURRENT_TIME:
+       case SI_current_time:
                if (sscanf(buf, "%lu.%lu", &sec, &usec) == 2) {
                        struct timeval tv = {sec, usec};
                        compute_time_diff(&tv);
                }
                break;
-       case SI_FORMAT:
+       case SI_format:
                stat_task->current_audio_format_num
                        = get_audio_format_num(buf);
        }
@@ -1386,10 +1386,10 @@ static int status_post_select(struct sched *s, void *context)
                client_open(argc, argv, &st->ct, NULL, NULL, st->btrn, s);
                set_stat_task_restart_barrier(5);
        }
-       free(stat_item_values[SI_BASENAME]);
-       stat_item_values[SI_BASENAME] = para_strdup(
+       free(stat_item_values[SI_basename]);
+       stat_item_values[SI_basename] = para_strdup(
                "no connection to para_server");
-       stat_client_write_item(SI_BASENAME);
+       stat_client_write_item(SI_basename);
        st->last_status_read = *now;
 out:
        start_stop_decoders();
index 9623c4f..0920162 100644 (file)
@@ -82,7 +82,7 @@ static INITIALIZED_LIST_HEAD(client_list);
 static int num_clients;
 
 /** The list of all status items used by para_{server,audiod,gui}. */
-const char *status_item_list[] = {STATUS_ITEM_ARRAY};
+const char *status_item_list[] = {STATUS_ITEMS};
 
 static void dump_stat_client_list(void)
 {
@@ -481,41 +481,41 @@ void audiod_status_dump(bool force)
 {
        char *old, *new;
 
-       old = stat_item_values[SI_PLAY_TIME];
+       old = stat_item_values[SI_play_time];
        new = get_time_string();
        if (new) {
                if (force || !old || strcmp(old, new)) {
                        free(old);
-                       stat_item_values[SI_PLAY_TIME] = new;
-                       stat_client_write_item(SI_PLAY_TIME);
+                       stat_item_values[SI_play_time] = new;
+                       stat_client_write_item(SI_play_time);
                } else
                        free(new);
        }
 
        new = daemon_get_uptime_str(now);
-       old = stat_item_values[SI_AUDIOD_UPTIME];
+       old = stat_item_values[SI_audiod_uptime];
        if (force || !old || strcmp(old, new)) {
                free(old);
-               stat_item_values[SI_AUDIOD_UPTIME] = new;
-               stat_client_write_item(SI_AUDIOD_UPTIME);
+               stat_item_values[SI_audiod_uptime] = new;
+               stat_client_write_item(SI_audiod_uptime);
        } else
                free(new);
 
-       old = stat_item_values[SI_AUDIOD_STATUS];
+       old = stat_item_values[SI_audiod_status];
        new = audiod_status_string();
        if (force || !old || strcmp(old, new)) {
                free(old);
-               stat_item_values[SI_AUDIOD_STATUS] = new;
-               stat_client_write_item(SI_AUDIOD_STATUS);
+               stat_item_values[SI_audiod_status] = new;
+               stat_client_write_item(SI_audiod_status);
        } else
                free(new);
 
-       old = stat_item_values[SI_DECODER_FLAGS];
+       old = stat_item_values[SI_decoder_flags];
        new = audiod_get_decoder_flags();
        if (force || !old || strcmp(old, new)) {
                free(old);
-               stat_item_values[SI_DECODER_FLAGS] = new;
-               stat_client_write_item(SI_DECODER_FLAGS);
+               stat_item_values[SI_decoder_flags] = new;
+               stat_client_write_item(SI_decoder_flags);
        } else
                free(new);
 }
index d0aeea3..52f4153 100644 (file)
--- a/command.c
+++ b/command.c
@@ -111,14 +111,14 @@ static unsigned get_status(struct misc_meta_data *nmmd, bool parser_friendly,
         * is not smart enough to prove this and complains nevertheless.
         * Casting the return value to void silences clang.
         */
-       (void)WRITE_STATUS_ITEM(&b, SI_STATUS, "%s\n", status);
-       (void)WRITE_STATUS_ITEM(&b, SI_STATUS_FLAGS, "%s\n", flags);
-       (void)WRITE_STATUS_ITEM(&b, SI_OFFSET, "%li\n", offset);
-       (void)WRITE_STATUS_ITEM(&b, SI_AFS_MODE, "%s\n", mmd->afs_mode_string);
-       (void)WRITE_STATUS_ITEM(&b, SI_STREAM_START, "%lu.%lu\n",
+       (void)WRITE_STATUS_ITEM(&b, SI_status, "%s\n", status);
+       (void)WRITE_STATUS_ITEM(&b, SI_status_flags, "%s\n", flags);
+       (void)WRITE_STATUS_ITEM(&b, SI_offset, "%li\n", offset);
+       (void)WRITE_STATUS_ITEM(&b, SI_afs_mode, "%s\n", mmd->afs_mode_string);
+       (void)WRITE_STATUS_ITEM(&b, SI_stream_start, "%lu.%lu\n",
                (long unsigned)nmmd->stream_start.tv_sec,
                (long unsigned)nmmd->stream_start.tv_usec);
-       (void)WRITE_STATUS_ITEM(&b, SI_CURRENT_TIME, "%lu.%lu\n",
+       (void)WRITE_STATUS_ITEM(&b, SI_current_time, "%lu.%lu\n",
                (long unsigned)current_time.tv_sec,
                (long unsigned)current_time.tv_usec);
        free(flags);
@@ -426,36 +426,36 @@ EXPORT_SERVER_CMD_HANDLER(version);
 
 /** These status items are cleared if no audio file is currently open. */
 #define EMPTY_STATUS_ITEMS \
-       ITEM(PATH) \
-       ITEM(DIRECTORY) \
-       ITEM(BASENAME) \
-       ITEM(SCORE) \
-       ITEM(ATTRIBUTES_BITMAP) \
-       ITEM(ATTRIBUTES_TXT) \
-       ITEM(HASH) \
-       ITEM(IMAGE_ID) \
-       ITEM(IMAGE_NAME) \
-       ITEM(LYRICS_ID) \
-       ITEM(LYRICS_NAME) \
-       ITEM(BITRATE) \
-       ITEM(FORMAT) \
-       ITEM(FREQUENCY) \
-       ITEM(CHANNELS) \
-       ITEM(DURATION) \
-       ITEM(SECONDS_TOTAL) \
-       ITEM(NUM_PLAYED) \
-       ITEM(LAST_PLAYED) \
-       ITEM(TECHINFO) \
-       ITEM(ARTIST) \
-       ITEM(TITLE) \
-       ITEM(YEAR) \
-       ITEM(ALBUM) \
-       ITEM(COMMENT) \
-       ITEM(MTIME) \
-       ITEM(FILE_SIZE) \
-       ITEM(CHUNK_TIME) \
-       ITEM(NUM_CHUNKS) \
-       ITEM(AMPLIFICATION) \
+       ITEM(path) \
+       ITEM(directory) \
+       ITEM(basename) \
+       ITEM(score) \
+       ITEM(attributes_bitmap) \
+       ITEM(attributes_txt) \
+       ITEM(hash) \
+       ITEM(image_id) \
+       ITEM(image_name) \
+       ITEM(lyrics_id) \
+       ITEM(lyrics_name) \
+       ITEM(bitrate) \
+       ITEM(format) \
+       ITEM(frequency) \
+       ITEM(channels) \
+       ITEM(duration) \
+       ITEM(seconds_total) \
+       ITEM(num_played) \
+       ITEM(last_played) \
+       ITEM(techinfo) \
+       ITEM(artist) \
+       ITEM(title) \
+       ITEM(year) \
+       ITEM(album) \
+       ITEM(comment) \
+       ITEM(mtime) \
+       ITEM(file_size) \
+       ITEM(chunk_time) \
+       ITEM(num_chunks) \
+       ITEM(amplification) \
 
 /**
  * Write a list of audio-file related status items with empty values.
index c2cb47e..b51f72d 100644 (file)
@@ -803,33 +803,9 @@ if test $HAVE_READLINE = yes; then
 fi
 audioc_objs="$audioc_errlist_objs"
 AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
-################################################################## status items
-
-status_items="basename status num_played mtime bitrate frequency file_size
-status_flags format score techinfo 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_name image_name path hash channels
-last_played num_chunks chunk_time amplification artist title year album
-comment max_chunk_size"
-
-result=
-for i in $status_items; do
-       result="$result SI_$(echo $i | tr 'a-z' 'A-Z'), "
-done
-AC_DEFINE_UNQUOTED(STATUS_ITEM_ENUM, [$result],
-       [enum of all status items])
-
-result=
-for i in $status_items; do
-       result="$result \"$i\", "
-done
-AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [$result],
-       [char * array of all status items])
 
 AC_DEFINE_UNQUOTED(AUDIO_FORMAT_HANDLERS, "$audio_format_handlers",
        [formats supported by para_server and para_afh])
-
 AC_SUBST(executables)
 
 AC_OUTPUT
index d5dac67..156e049 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -34,7 +34,7 @@ static struct lls_parse_result *lpr; /* command line options */
 #define OPT_UINT32_VAL(_name) (lls_uint32_val(0, OPT_RESULT(_name)))
 
 /** The list of all status items used by para_{server,audiod,gui}. */
-const char *status_item_list[] = {STATUS_ITEM_ARRAY};
+const char *status_item_list[] = {STATUS_ITEMS};
 
 /**
  * Dummy version which only contains NULL pointers.
diff --git a/gui.c b/gui.c
index 5bad7e1..493bc3c 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -569,19 +569,19 @@ static int update_item(int item_num, char *buf)
        if (buf && buf[0])
                goto dup;
        switch (item_num) {
-       case SI_ARTIST:
+       case SI_artist:
                *c = para_strdup("(artist tag not set)");
                goto print;
-       case SI_TITLE:
+       case SI_title:
                *c = para_strdup("(title tag not set)");
                goto print;
-       case SI_YEAR:
+       case SI_year:
                *c = para_strdup("????");
                goto print;
-       case SI_ALBUM:
+       case SI_album:
                *c = para_strdup("(album tag not set)");
                goto print;
-       case SI_COMMENT:
+       case SI_comment:
                *c = para_strdup("(comment tag not set)");
                goto print;
        }
@@ -680,8 +680,8 @@ static int status_post_select(struct sched *s, void *context)
                close(st->fd);
                st->fd = -1;
                clear_all_items();
-               free(stat_content[SI_BASENAME]);
-               stat_content[SI_BASENAME] =
+               free(stat_content[SI_basename]);
+               stat_content[SI_basename] =
                        para_strdup("stat command terminated!?");
                print_all_items();
                return 0;
index fb8f2f9..78527ef 100644 (file)
@@ -34,32 +34,32 @@ static void init_theme_simple(struct gui_theme *t)
        t->dflt.bg = COLOR_BLUE;
        t->sep_char = '*';
 
-       d[SI_BASENAME].prefix = "";
-       d[SI_BASENAME].postfix = "";
-       d[SI_BASENAME].color.fg = COLOR_WHITE;
-       d[SI_BASENAME].color.bg = COLOR_BLUE;
-       d[SI_BASENAME].align = CENTER;
-       d[SI_BASENAME].x = 0;
-       d[SI_BASENAME].y = 7;
-       d[SI_BASENAME].len = 100;
-
-       d[SI_STATUS].prefix = "para_server: ";
-       d[SI_STATUS].postfix = "";
-       d[SI_STATUS].color.fg = COLOR_WHITE;
-       d[SI_STATUS].color.bg = COLOR_BLUE;
-       d[SI_STATUS].align = CENTER;
-       d[SI_STATUS].x = 0;
-       d[SI_STATUS].y = 60;
-       d[SI_STATUS].len = 50;
-
-       d[SI_AUDIOD_STATUS].prefix = "para_audiod: ";
-       d[SI_AUDIOD_STATUS].postfix = "";
-       d[SI_AUDIOD_STATUS].color.fg = COLOR_WHITE;
-       d[SI_AUDIOD_STATUS].color.bg = COLOR_BLUE;
-       d[SI_AUDIOD_STATUS].align = CENTER;
-       d[SI_AUDIOD_STATUS].x = 50;
-       d[SI_AUDIOD_STATUS].y = 60;
-       d[SI_AUDIOD_STATUS].len = 50;
+       d[SI_basename].prefix = "";
+       d[SI_basename].postfix = "";
+       d[SI_basename].color.fg = COLOR_WHITE;
+       d[SI_basename].color.bg = COLOR_BLUE;
+       d[SI_basename].align = CENTER;
+       d[SI_basename].x = 0;
+       d[SI_basename].y = 7;
+       d[SI_basename].len = 100;
+
+       d[SI_status].prefix = "para_server: ";
+       d[SI_status].postfix = "";
+       d[SI_status].color.fg = COLOR_WHITE;
+       d[SI_status].color.bg = COLOR_BLUE;
+       d[SI_status].align = CENTER;
+       d[SI_status].x = 0;
+       d[SI_status].y = 60;
+       d[SI_status].len = 50;
+
+       d[SI_audiod_status].prefix = "para_audiod: ";
+       d[SI_audiod_status].postfix = "";
+       d[SI_audiod_status].color.fg = COLOR_WHITE;
+       d[SI_audiod_status].color.bg = COLOR_BLUE;
+       d[SI_audiod_status].align = CENTER;
+       d[SI_audiod_status].x = 50;
+       d[SI_audiod_status].y = 60;
+       d[SI_audiod_status].len = 50;
 
 }
 
@@ -92,266 +92,266 @@ static void init_theme_colorful_blackness(struct gui_theme *t)
        t->dflt.fg = COLOR_MAGENTA;
 
 
-       d[SI_PLAY_TIME].prefix = "";
-       d[SI_PLAY_TIME].postfix = "";
-       d[SI_PLAY_TIME].color.fg = COLOR_CYAN;
-       d[SI_PLAY_TIME].color.bg = COLOR_BLACK;
-       d[SI_PLAY_TIME].align = CENTER;
-       d[SI_PLAY_TIME].x = 0;
-       d[SI_PLAY_TIME].y = 7;
-       d[SI_PLAY_TIME].len = 35;
-
-       d[SI_BASENAME].prefix = "";
-       d[SI_BASENAME].postfix = "";
-       d[SI_BASENAME].color.fg = COLOR_CYAN;
-       d[SI_BASENAME].color.bg = COLOR_BLACK;
-       d[SI_BASENAME].align = LEFT;
-       d[SI_BASENAME].x = 35;
-       d[SI_BASENAME].y = 7;
-       d[SI_BASENAME].len = 65;
-
-       d[SI_STATUS].prefix = "";
-       d[SI_STATUS].postfix = " ";
-       d[SI_STATUS].color.fg = COLOR_RED;
-       d[SI_STATUS].color.bg = COLOR_BLACK;
-       d[SI_STATUS].align = RIGHT;
-       d[SI_STATUS].x = 0;
-       d[SI_STATUS].y = 17;
-       d[SI_STATUS].len = 11;
-
-       d[SI_STATUS_FLAGS].prefix = "(";
-       d[SI_STATUS_FLAGS].postfix = ")";
-       d[SI_STATUS_FLAGS].color.fg = COLOR_RED;
-       d[SI_STATUS_FLAGS].color.bg = COLOR_BLACK;
-       d[SI_STATUS_FLAGS].align = LEFT;
-       d[SI_STATUS_FLAGS].x = 11;
-       d[SI_STATUS_FLAGS].y = 17;
-       d[SI_STATUS_FLAGS].len = 10;
-
-       d[SI_IMAGE_ID].prefix = "img: ";
-       d[SI_IMAGE_ID].postfix = "";
-       d[SI_IMAGE_ID].color.fg = COLOR_RED;
-       d[SI_IMAGE_ID].color.bg = COLOR_BLACK;
-       d[SI_IMAGE_ID].align = CENTER;
-       d[SI_IMAGE_ID].x = 21;
-       d[SI_IMAGE_ID].y = 17;
-       d[SI_IMAGE_ID].len = 10;
-
-       d[SI_LYRICS_ID].prefix = "lyr: ";
-       d[SI_LYRICS_ID].postfix = "";
-       d[SI_LYRICS_ID].color.fg = COLOR_RED;
-       d[SI_LYRICS_ID].color.bg = COLOR_BLACK;
-       d[SI_LYRICS_ID].align = CENTER;
-       d[SI_LYRICS_ID].x = 31;
-       d[SI_LYRICS_ID].y = 17;
-       d[SI_LYRICS_ID].len = 11;
-
-       d[SI_FORMAT].prefix = "format: ";
-       d[SI_FORMAT].postfix = "";
-       d[SI_FORMAT].color.fg = COLOR_RED;
-       d[SI_FORMAT].color.bg = COLOR_BLACK;
-       d[SI_FORMAT].align = CENTER;
-       d[SI_FORMAT].x = 42;
-       d[SI_FORMAT].y = 17;
-       d[SI_FORMAT].len = 18;
-
-       d[SI_NUM_PLAYED].prefix = "#";
-       d[SI_NUM_PLAYED].postfix = "";
-       d[SI_NUM_PLAYED].color.fg = COLOR_RED;
-       d[SI_NUM_PLAYED].color.bg = COLOR_BLACK;
-       d[SI_NUM_PLAYED].align = LEFT;
-       d[SI_NUM_PLAYED].x = 60;
-       d[SI_NUM_PLAYED].y = 17;
-       d[SI_NUM_PLAYED].len = 5;
-
-       d[SI_BITRATE].prefix = "";
-       d[SI_BITRATE].postfix = "";
-       d[SI_BITRATE].color.fg = COLOR_RED;
-       d[SI_BITRATE].color.bg = COLOR_BLACK;
-       d[SI_BITRATE].align = CENTER;
-       d[SI_BITRATE].x = 65;
-       d[SI_BITRATE].y = 17;
-       d[SI_BITRATE].len = 13;
-
-       d[SI_FREQUENCY].prefix = "";
-       d[SI_FREQUENCY].postfix = "";
-       d[SI_FREQUENCY].color.fg = COLOR_RED;
-       d[SI_FREQUENCY].color.bg = COLOR_BLACK;
-       d[SI_FREQUENCY].align = CENTER;
-       d[SI_FREQUENCY].x = 78;
-       d[SI_FREQUENCY].y = 17;
-       d[SI_FREQUENCY].len = 10;
-
-       d[SI_SCORE].prefix = "sc: ";
-       d[SI_SCORE].postfix = "";
-       d[SI_SCORE].color.fg = COLOR_RED;
-       d[SI_SCORE].color.bg = COLOR_BLACK;
-       d[SI_SCORE].align = CENTER;
-       d[SI_SCORE].x = 88;
-       d[SI_SCORE].y = 17;
-       d[SI_SCORE].len = 10;
-
-       d[SI_AUDIOD_STATUS].prefix = "";
-       d[SI_AUDIOD_STATUS].postfix = "";
-       d[SI_AUDIOD_STATUS].color.fg = COLOR_MAGENTA;
-       d[SI_AUDIOD_STATUS].color.bg = COLOR_BLACK;
-       d[SI_AUDIOD_STATUS].align = CENTER;
-       d[SI_AUDIOD_STATUS].x = 0;
-       d[SI_AUDIOD_STATUS].y = 27;
-       d[SI_AUDIOD_STATUS].len = 5;
-
-       d[SI_DECODER_FLAGS].prefix = "[";
-       d[SI_DECODER_FLAGS].postfix = "]";
-       d[SI_DECODER_FLAGS].color.fg = COLOR_MAGENTA;
-       d[SI_DECODER_FLAGS].color.bg = COLOR_BLACK;
-       d[SI_DECODER_FLAGS].align = CENTER;
-       d[SI_DECODER_FLAGS].x = 5;
-       d[SI_DECODER_FLAGS].y = 27;
-       d[SI_DECODER_FLAGS].len = 10;
-
-       d[SI_MTIME].prefix = "mod: ";
-       d[SI_MTIME].postfix = "";
-       d[SI_MTIME].color.fg = COLOR_MAGENTA;
-       d[SI_MTIME].color.bg = COLOR_BLACK;
-       d[SI_MTIME].align = CENTER;
-       d[SI_MTIME].x = 15;
-       d[SI_MTIME].y = 27;
-       d[SI_MTIME].len = 22;
-
-       d[SI_FILE_SIZE].prefix = "";
-       d[SI_FILE_SIZE].postfix = "kb";
-       d[SI_FILE_SIZE].color.fg = COLOR_MAGENTA;
-       d[SI_FILE_SIZE].color.bg = COLOR_BLACK;
-       d[SI_FILE_SIZE].align = CENTER;
-       d[SI_FILE_SIZE].x = 37;
-       d[SI_FILE_SIZE].y = 27;
-       d[SI_FILE_SIZE].len = 10;
-
-       d[SI_CHANNELS].prefix = "";
-       d[SI_CHANNELS].postfix = "ch";
-       d[SI_CHANNELS].color.fg = COLOR_MAGENTA;
-       d[SI_CHANNELS].color.bg = COLOR_BLACK;
-       d[SI_CHANNELS].align = CENTER;
-       d[SI_CHANNELS].x = 47;
-       d[SI_CHANNELS].y = 27;
-       d[SI_CHANNELS].len = 5;
-
-       d[SI_LAST_PLAYED].prefix = "lp: ";
-       d[SI_LAST_PLAYED].postfix = "";
-       d[SI_LAST_PLAYED].color.fg = COLOR_MAGENTA;
-       d[SI_LAST_PLAYED].color.bg = COLOR_BLACK;
-       d[SI_LAST_PLAYED].align = CENTER;
-       d[SI_LAST_PLAYED].x = 52;
-       d[SI_LAST_PLAYED].y = 27;
-       d[SI_LAST_PLAYED].len = 21;
-
-       d[SI_NUM_CHUNKS].prefix = "";
-       d[SI_NUM_CHUNKS].postfix = "x";
-       d[SI_NUM_CHUNKS].color.fg = COLOR_MAGENTA;
-       d[SI_NUM_CHUNKS].color.bg = COLOR_BLACK;
-       d[SI_NUM_CHUNKS].align = RIGHT;
-       d[SI_NUM_CHUNKS].x = 73;
-       d[SI_NUM_CHUNKS].y = 27;
-       d[SI_NUM_CHUNKS].len = 11;
-
-       d[SI_CHUNK_TIME].prefix = "";
-       d[SI_CHUNK_TIME].postfix = "ms";
-       d[SI_CHUNK_TIME].color.fg = COLOR_MAGENTA;
-       d[SI_CHUNK_TIME].color.bg = COLOR_BLACK;
-       d[SI_CHUNK_TIME].align = LEFT;
-       d[SI_CHUNK_TIME].x = 84;
-       d[SI_CHUNK_TIME].y = 27;
-       d[SI_CHUNK_TIME].len = 8;
-
-       d[SI_AMPLIFICATION].prefix = "amp:";
-       d[SI_AMPLIFICATION].postfix = "";
-       d[SI_AMPLIFICATION].color.fg = COLOR_MAGENTA;
-       d[SI_AMPLIFICATION].color.bg = COLOR_BLACK;
-       d[SI_AMPLIFICATION].align = RIGHT;
-       d[SI_AMPLIFICATION].x = 92;
-       d[SI_AMPLIFICATION].y = 27;
-       d[SI_AMPLIFICATION].len = 8;
-
-       d[SI_TECHINFO].prefix = "";
-       d[SI_TECHINFO].postfix = "";
-       d[SI_TECHINFO].color.fg = COLOR_GREEN;
-       d[SI_TECHINFO].color.bg = COLOR_BLACK;
-       d[SI_TECHINFO].align = CENTER;
-       d[SI_TECHINFO].x = 0;
-       d[SI_TECHINFO].y = 43;
-       d[SI_TECHINFO].len = 100;
-
-       d[SI_TITLE].prefix = "";
-       d[SI_TITLE].postfix = ",";
-       d[SI_TITLE].color.fg = COLOR_GREEN;
-       d[SI_TITLE].color.bg = COLOR_BLACK;
-       d[SI_TITLE].align = RIGHT;
-       d[SI_TITLE].x = 0;
-       d[SI_TITLE].y = 53;
-       d[SI_TITLE].len = 45;
-
-       d[SI_ARTIST].prefix = " by ";
-       d[SI_ARTIST].postfix = "";
-       d[SI_ARTIST].color.fg = COLOR_GREEN;
-       d[SI_ARTIST].color.bg = COLOR_BLACK;
-       d[SI_ARTIST].align = LEFT;
-       d[SI_ARTIST].x = 45;
-       d[SI_ARTIST].y = 53;
-       d[SI_ARTIST].len = 45;
-
-       d[SI_YEAR].prefix = "(";
-       d[SI_YEAR].postfix = ")";
-       d[SI_YEAR].color.fg = COLOR_GREEN;
-       d[SI_YEAR].color.bg = COLOR_BLACK;
-       d[SI_YEAR].align = RIGHT;
-       d[SI_YEAR].x = 90;
-       d[SI_YEAR].y = 53;
-       d[SI_YEAR].len = 10;
-
-       d[SI_ALBUM].prefix = "A: ";
-       d[SI_ALBUM].postfix = ",";
-       d[SI_ALBUM].color.fg = COLOR_GREEN;
-       d[SI_ALBUM].color.bg = COLOR_BLACK;
-       d[SI_ALBUM].align = RIGHT;
-       d[SI_ALBUM].x = 0;
-       d[SI_ALBUM].y = 63;
-       d[SI_ALBUM].len = 50;
-
-       d[SI_COMMENT].prefix = " C: ";
-       d[SI_COMMENT].postfix = "";
-       d[SI_COMMENT].color.fg = COLOR_GREEN;
-       d[SI_COMMENT].color.bg = COLOR_BLACK;
-       d[SI_COMMENT].align = LEFT;
-       d[SI_COMMENT].x = 50;
-       d[SI_COMMENT].y = 63;
-       d[SI_COMMENT].len = 50;
-
-       d[SI_AFS_MODE].prefix = "";
-       d[SI_AFS_MODE].postfix = "";
-       d[SI_AFS_MODE].color.fg = COLOR_YELLOW;
-       d[SI_AFS_MODE].color.bg = COLOR_BLACK;
-       d[SI_AFS_MODE].align = CENTER;
-       d[SI_AFS_MODE].x = 0;
-       d[SI_AFS_MODE].y = 77;
-       d[SI_AFS_MODE].len = 100;
-
-       d[SI_ATTRIBUTES_TXT].prefix = "";
-       d[SI_ATTRIBUTES_TXT].postfix = "";
-       d[SI_ATTRIBUTES_TXT].color.fg = COLOR_YELLOW;
-       d[SI_ATTRIBUTES_TXT].color.bg = COLOR_BLACK;
-       d[SI_ATTRIBUTES_TXT].align = CENTER;
-       d[SI_ATTRIBUTES_TXT].x = 0;
-       d[SI_ATTRIBUTES_TXT].y = 87;
-       d[SI_ATTRIBUTES_TXT].len = 100;
-
-       d[SI_DIRECTORY].prefix = "dir: ";
-       d[SI_DIRECTORY].postfix = "";
-       d[SI_DIRECTORY].color.fg = COLOR_YELLOW;
-       d[SI_DIRECTORY].color.bg = COLOR_BLACK;
-       d[SI_DIRECTORY].align = CENTER;
-       d[SI_DIRECTORY].x = 0;
-       d[SI_DIRECTORY].y = 97;
-       d[SI_DIRECTORY].len = 100;
+       d[SI_play_time].prefix = "";
+       d[SI_play_time].postfix = "";
+       d[SI_play_time].color.fg = COLOR_CYAN;
+       d[SI_play_time].color.bg = COLOR_BLACK;
+       d[SI_play_time].align = CENTER;
+       d[SI_play_time].x = 0;
+       d[SI_play_time].y = 7;
+       d[SI_play_time].len = 35;
+
+       d[SI_basename].prefix = "";
+       d[SI_basename].postfix = "";
+       d[SI_basename].color.fg = COLOR_CYAN;
+       d[SI_basename].color.bg = COLOR_BLACK;
+       d[SI_basename].align = LEFT;
+       d[SI_basename].x = 35;
+       d[SI_basename].y = 7;
+       d[SI_basename].len = 65;
+
+       d[SI_status].prefix = "";
+       d[SI_status].postfix = " ";
+       d[SI_status].color.fg = COLOR_RED;
+       d[SI_status].color.bg = COLOR_BLACK;
+       d[SI_status].align = RIGHT;
+       d[SI_status].x = 0;
+       d[SI_status].y = 17;
+       d[SI_status].len = 11;
+
+       d[SI_status_flags].prefix = "(";
+       d[SI_status_flags].postfix = ")";
+       d[SI_status_flags].color.fg = COLOR_RED;
+       d[SI_status_flags].color.bg = COLOR_BLACK;
+       d[SI_status_flags].align = LEFT;
+       d[SI_status_flags].x = 11;
+       d[SI_status_flags].y = 17;
+       d[SI_status_flags].len = 10;
+
+       d[SI_image_id].prefix = "img: ";
+       d[SI_image_id].postfix = "";
+       d[SI_image_id].color.fg = COLOR_RED;
+       d[SI_image_id].color.bg = COLOR_BLACK;
+       d[SI_image_id].align = CENTER;
+       d[SI_image_id].x = 21;
+       d[SI_image_id].y = 17;
+       d[SI_image_id].len = 10;
+
+       d[SI_lyrics_id].prefix = "lyr: ";
+       d[SI_lyrics_id].postfix = "";
+       d[SI_lyrics_id].color.fg = COLOR_RED;
+       d[SI_lyrics_id].color.bg = COLOR_BLACK;
+       d[SI_lyrics_id].align = CENTER;
+       d[SI_lyrics_id].x = 31;
+       d[SI_lyrics_id].y = 17;
+       d[SI_lyrics_id].len = 11;
+
+       d[SI_format].prefix = "format: ";
+       d[SI_format].postfix = "";
+       d[SI_format].color.fg = COLOR_RED;
+       d[SI_format].color.bg = COLOR_BLACK;
+       d[SI_format].align = CENTER;
+       d[SI_format].x = 42;
+       d[SI_format].y = 17;
+       d[SI_format].len = 18;
+
+       d[SI_num_played].prefix = "#";
+       d[SI_num_played].postfix = "";
+       d[SI_num_played].color.fg = COLOR_RED;
+       d[SI_num_played].color.bg = COLOR_BLACK;
+       d[SI_num_played].align = LEFT;
+       d[SI_num_played].x = 60;
+       d[SI_num_played].y = 17;
+       d[SI_num_played].len = 5;
+
+       d[SI_bitrate].prefix = "";
+       d[SI_bitrate].postfix = "";
+       d[SI_bitrate].color.fg = COLOR_RED;
+       d[SI_bitrate].color.bg = COLOR_BLACK;
+       d[SI_bitrate].align = CENTER;
+       d[SI_bitrate].x = 65;
+       d[SI_bitrate].y = 17;
+       d[SI_bitrate].len = 13;
+
+       d[SI_frequency].prefix = "";
+       d[SI_frequency].postfix = "";
+       d[SI_frequency].color.fg = COLOR_RED;
+       d[SI_frequency].color.bg = COLOR_BLACK;
+       d[SI_frequency].align = CENTER;
+       d[SI_frequency].x = 78;
+       d[SI_frequency].y = 17;
+       d[SI_frequency].len = 10;
+
+       d[SI_score].prefix = "sc: ";
+       d[SI_score].postfix = "";
+       d[SI_score].color.fg = COLOR_RED;
+       d[SI_score].color.bg = COLOR_BLACK;
+       d[SI_score].align = CENTER;
+       d[SI_score].x = 88;
+       d[SI_score].y = 17;
+       d[SI_score].len = 10;
+
+       d[SI_audiod_status].prefix = "";
+       d[SI_audiod_status].postfix = "";
+       d[SI_audiod_status].color.fg = COLOR_MAGENTA;
+       d[SI_audiod_status].color.bg = COLOR_BLACK;
+       d[SI_audiod_status].align = CENTER;
+       d[SI_audiod_status].x = 0;
+       d[SI_audiod_status].y = 27;
+       d[SI_audiod_status].len = 5;
+
+       d[SI_decoder_flags].prefix = "[";
+       d[SI_decoder_flags].postfix = "]";
+       d[SI_decoder_flags].color.fg = COLOR_MAGENTA;
+       d[SI_decoder_flags].color.bg = COLOR_BLACK;
+       d[SI_decoder_flags].align = CENTER;
+       d[SI_decoder_flags].x = 5;
+       d[SI_decoder_flags].y = 27;
+       d[SI_decoder_flags].len = 10;
+
+       d[SI_mtime].prefix = "mod: ";
+       d[SI_mtime].postfix = "";
+       d[SI_mtime].color.fg = COLOR_MAGENTA;
+       d[SI_mtime].color.bg = COLOR_BLACK;
+       d[SI_mtime].align = CENTER;
+       d[SI_mtime].x = 15;
+       d[SI_mtime].y = 27;
+       d[SI_mtime].len = 22;
+
+       d[SI_file_size].prefix = "";
+       d[SI_file_size].postfix = "kb";
+       d[SI_file_size].color.fg = COLOR_MAGENTA;
+       d[SI_file_size].color.bg = COLOR_BLACK;
+       d[SI_file_size].align = CENTER;
+       d[SI_file_size].x = 37;
+       d[SI_file_size].y = 27;
+       d[SI_file_size].len = 10;
+
+       d[SI_channels].prefix = "";
+       d[SI_channels].postfix = "ch";
+       d[SI_channels].color.fg = COLOR_MAGENTA;
+       d[SI_channels].color.bg = COLOR_BLACK;
+       d[SI_channels].align = CENTER;
+       d[SI_channels].x = 47;
+       d[SI_channels].y = 27;
+       d[SI_channels].len = 5;
+
+       d[SI_last_played].prefix = "lp: ";
+       d[SI_last_played].postfix = "";
+       d[SI_last_played].color.fg = COLOR_MAGENTA;
+       d[SI_last_played].color.bg = COLOR_BLACK;
+       d[SI_last_played].align = CENTER;
+       d[SI_last_played].x = 52;
+       d[SI_last_played].y = 27;
+       d[SI_last_played].len = 21;
+
+       d[SI_num_chunks].prefix = "";
+       d[SI_num_chunks].postfix = "x";
+       d[SI_num_chunks].color.fg = COLOR_MAGENTA;
+       d[SI_num_chunks].color.bg = COLOR_BLACK;
+       d[SI_num_chunks].align = RIGHT;
+       d[SI_num_chunks].x = 73;
+       d[SI_num_chunks].y = 27;
+       d[SI_num_chunks].len = 11;
+
+       d[SI_chunk_time].prefix = "";
+       d[SI_chunk_time].postfix = "ms";
+       d[SI_chunk_time].color.fg = COLOR_MAGENTA;
+       d[SI_chunk_time].color.bg = COLOR_BLACK;
+       d[SI_chunk_time].align = LEFT;
+       d[SI_chunk_time].x = 84;
+       d[SI_chunk_time].y = 27;
+       d[SI_chunk_time].len = 8;
+
+       d[SI_amplification].prefix = "amp:";
+       d[SI_amplification].postfix = "";
+       d[SI_amplification].color.fg = COLOR_MAGENTA;
+       d[SI_amplification].color.bg = COLOR_BLACK;
+       d[SI_amplification].align = RIGHT;
+       d[SI_amplification].x = 92;
+       d[SI_amplification].y = 27;
+       d[SI_amplification].len = 8;
+
+       d[SI_techinfo].prefix = "";
+       d[SI_techinfo].postfix = "";
+       d[SI_techinfo].color.fg = COLOR_GREEN;
+       d[SI_techinfo].color.bg = COLOR_BLACK;
+       d[SI_techinfo].align = CENTER;
+       d[SI_techinfo].x = 0;
+       d[SI_techinfo].y = 43;
+       d[SI_techinfo].len = 100;
+
+       d[SI_title].prefix = "";
+       d[SI_title].postfix = ",";
+       d[SI_title].color.fg = COLOR_GREEN;
+       d[SI_title].color.bg = COLOR_BLACK;
+       d[SI_title].align = RIGHT;
+       d[SI_title].x = 0;
+       d[SI_title].y = 53;
+       d[SI_title].len = 45;
+
+       d[SI_artist].prefix = " by ";
+       d[SI_artist].postfix = "";
+       d[SI_artist].color.fg = COLOR_GREEN;
+       d[SI_artist].color.bg = COLOR_BLACK;
+       d[SI_artist].align = LEFT;
+       d[SI_artist].x = 45;
+       d[SI_artist].y = 53;
+       d[SI_artist].len = 45;
+
+       d[SI_year].prefix = "(";
+       d[SI_year].postfix = ")";
+       d[SI_year].color.fg = COLOR_GREEN;
+       d[SI_year].color.bg = COLOR_BLACK;
+       d[SI_year].align = RIGHT;
+       d[SI_year].x = 90;
+       d[SI_year].y = 53;
+       d[SI_year].len = 10;
+
+       d[SI_album].prefix = "A: ";
+       d[SI_album].postfix = ",";
+       d[SI_album].color.fg = COLOR_GREEN;
+       d[SI_album].color.bg = COLOR_BLACK;
+       d[SI_album].align = RIGHT;
+       d[SI_album].x = 0;
+       d[SI_album].y = 63;
+       d[SI_album].len = 50;
+
+       d[SI_comment].prefix = " C: ";
+       d[SI_comment].postfix = "";
+       d[SI_comment].color.fg = COLOR_GREEN;
+       d[SI_comment].color.bg = COLOR_BLACK;
+       d[SI_comment].align = LEFT;
+       d[SI_comment].x = 50;
+       d[SI_comment].y = 63;
+       d[SI_comment].len = 50;
+
+       d[SI_afs_mode].prefix = "";
+       d[SI_afs_mode].postfix = "";
+       d[SI_afs_mode].color.fg = COLOR_YELLOW;
+       d[SI_afs_mode].color.bg = COLOR_BLACK;
+       d[SI_afs_mode].align = CENTER;
+       d[SI_afs_mode].x = 0;
+       d[SI_afs_mode].y = 77;
+       d[SI_afs_mode].len = 100;
+
+       d[SI_attributes_txt].prefix = "";
+       d[SI_attributes_txt].postfix = "";
+       d[SI_attributes_txt].color.fg = COLOR_YELLOW;
+       d[SI_attributes_txt].color.bg = COLOR_BLACK;
+       d[SI_attributes_txt].align = CENTER;
+       d[SI_attributes_txt].x = 0;
+       d[SI_attributes_txt].y = 87;
+       d[SI_attributes_txt].len = 100;
+
+       d[SI_directory].prefix = "dir: ";
+       d[SI_directory].postfix = "";
+       d[SI_directory].color.fg = COLOR_YELLOW;
+       d[SI_directory].color.bg = COLOR_BLACK;
+       d[SI_directory].align = CENTER;
+       d[SI_directory].x = 0;
+       d[SI_directory].y = 97;
+       d[SI_directory].len = 100;
 }
 
 struct theme_description {
diff --git a/para.h b/para.h
index 3cd1b16..323a4fb 100644 (file)
--- a/para.h
+++ b/para.h
@@ -103,15 +103,6 @@ void compute_chunk_time(long unsigned chunk_num,
                struct timeval *result);
 struct timeval *clock_get_realtime(struct timeval *tv);
 
-/** The enum of all status items. */
-enum status_items {STATUS_ITEM_ENUM NUM_STAT_ITEMS};
-extern const char *status_item_list[];
-/** Loop over each status item. */
-#define FOR_EACH_STATUS_ITEM(i) for (i = 0; i < NUM_STAT_ITEMS; i++)
-int for_each_stat_item(char *item_buf, size_t num_bytes,
-       int (*item_handler)(int, char *));
-
-
 /**
  * Return a random non-negative integer in an interval.
  *
@@ -233,3 +224,57 @@ enum loglevels {LOGLEVELS, NUM_LOGLEVELS};
 #define PARA_ERROR_LOG(f,...) para_log(LL_ERROR, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
 #define PARA_CRIT_LOG(f,...) para_log(LL_CRIT, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
 #define PARA_EMERG_LOG(f,...) para_log(LL_EMERG, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
+
+#define STATUS_ITEMS \
+       STATUS_ITEM(basename) \
+       STATUS_ITEM(status) \
+       STATUS_ITEM(num_played) \
+       STATUS_ITEM(mtime) \
+       STATUS_ITEM(bitrate) \
+       STATUS_ITEM(frequency) \
+       STATUS_ITEM(file_size) \
+       STATUS_ITEM(status_flags) \
+       STATUS_ITEM(format) \
+       STATUS_ITEM(score) \
+       STATUS_ITEM(techinfo) \
+       STATUS_ITEM(afs_mode) \
+       STATUS_ITEM(attributes_txt) \
+       STATUS_ITEM(decoder_flags) \
+       STATUS_ITEM(audiod_status) \
+       STATUS_ITEM(play_time) \
+       STATUS_ITEM(attributes_bitmap) \
+       STATUS_ITEM(offset) \
+       STATUS_ITEM(seconds_total) \
+       STATUS_ITEM(stream_start) \
+       STATUS_ITEM(current_time) \
+       STATUS_ITEM(audiod_uptime) \
+       STATUS_ITEM(image_id) \
+       STATUS_ITEM(lyrics_id) \
+       STATUS_ITEM(duration) \
+       STATUS_ITEM(directory) \
+       STATUS_ITEM(lyrics_name) \
+       STATUS_ITEM(image_name) \
+       STATUS_ITEM(path) \
+       STATUS_ITEM(hash) \
+       STATUS_ITEM(channels) \
+       STATUS_ITEM(last_played) \
+       STATUS_ITEM(num_chunks) \
+       STATUS_ITEM(chunk_time) \
+       STATUS_ITEM(amplification) \
+       STATUS_ITEM(artist) \
+       STATUS_ITEM(title) \
+       STATUS_ITEM(year) \
+       STATUS_ITEM(album) \
+       STATUS_ITEM(comment) \
+       STATUS_ITEM(max_chunk_size) \
+
+#define STATUS_ITEM(_name) SI_ ##_name,
+enum status_items {STATUS_ITEMS NUM_STAT_ITEMS};
+#undef STATUS_ITEM
+#define STATUS_ITEM(_name) #_name,
+
+extern const char *status_item_list[];
+/** Loop over each status item. */
+#define FOR_EACH_STATUS_ITEM(i) for (i = 0; i < NUM_STAT_ITEMS; i++)
+int for_each_stat_item(char *item_buf, size_t num_bytes,
+       int (*item_handler)(int, char *));