Fix com_pause().
[paraslash.git] / aft.c
diff --git a/aft.c b/aft.c
index cc6026f..df6c259 100644 (file)
--- 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\n", /* tag info */
+                       "%s: %d\n" /* channels */
+                       "%s: %s\n" /* duration */
+                       "%s: %lu\n" /* seconds total */
+                       "%s: %d\n" /* num_played */
+                       "%s: %s\n" /* last_played */
+                       "%s", /* 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,
@@ -962,6 +971,51 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
        return 1;
 }
 
+void make_empty_status_items(char *buf)
+{
+       sprintf(buf,
+               "%s: \n" /* path */
+               "%s: \n" /* dirname */
+               "%s: \n" /* basename */
+               "%s: \n" /* score */
+               "%s: \n" /* attributes bitnmap */
+               "%s: \n" /* attributes txt */
+               "%s: \n" /* hash */
+               "%s: \n" /* image id */
+               "%s: \n" /* image name */
+               "%s: \n" /* lyrics id */
+               "%s: \n" /* lyrics name */
+               "%s: \n" /* bitrate */
+               "%s: \n" /* format */
+               "%s: \n" /* frequency */
+               "%s: \n" /* channels */
+               "%s: \n" /* duration */
+               "%s: \n" /* seconds total */
+               "%s: \n" /* num played */
+               "%s: \n" /* last played */
+               ,
+               status_item_list[SI_PATH],
+               status_item_list[SI_DIRECTORY],
+               status_item_list[SI_BASENAME],
+               status_item_list[SI_SCORE],
+               status_item_list[SI_ATTRIBUTES_BITMAP],
+               status_item_list[SI_ATTRIBUTES_TXT],
+               status_item_list[SI_HASH],
+               status_item_list[SI_IMAGE_ID],
+               status_item_list[SI_IMAGE_NAME],
+               status_item_list[SI_LYRICS_ID],
+               status_item_list[SI_LYRICS_NAME],
+               status_item_list[SI_BITRATE],
+               status_item_list[SI_FORMAT],
+               status_item_list[SI_FREQUENCY],
+               status_item_list[SI_CHANNELS],
+               status_item_list[SI_DURATION],
+               status_item_list[SI_SECONDS_TOTAL],
+               status_item_list[SI_NUM_PLAYED],
+               status_item_list[SI_LAST_PLAYED]
+       );
+}
+
 int make_status_items(struct ls_data *d, struct para_buffer *pb)
 {
        struct ls_options opts = {