]> git.tue.mpg.de Git - paraslash.git/commitdiff
aft.c: Simplify print_list_item().
authorAndre Noll <maan@systemlinux.org>
Sun, 18 Nov 2007 23:33:31 +0000 (00:33 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 18 Nov 2007 23:33:31 +0000 (00:33 +0100)
aft.c

diff --git a/aft.c b/aft.c
index 23c6c0dc24260faae2fed3baae17427f84944e7a..7af50f9de8dfe25ffe70356edd0d5ceaabd79bf4 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -887,82 +887,56 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
        lyrics_lines = make_lyrics_lines(afsi);
        image_lines = make_image_lines(afsi);
        filename_lines = make_filename_lines(d->path, opts->flags);
-       if (opts->mode == LS_MODE_VERBOSE) {
-               para_printf(b,
-                       "%s" /* filename stuff */
-                       "%s%s%s%s" /* score */
-                       "%s\n" /* attributes */
-                       "%s: %s\n" /* hash */
-                       "%s" /* image id, image name */
-                       "%s" /* lyrics */
-                       "%s: %dkbit/s\n" /* bitrate */
-                       "%s: %s\n" /* format */
-                       "%s: %dHz\n" /* frequency */
-                       "%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? status_item_list[SI_SCORE] : "",
-                               have_score? ": " : "",
-                               score_buf,
-                               have_score? "\n" : "",
-                       att_lines,
-                       status_item_list[SI_HASH], asc_hash,
-                       image_lines,
-                       lyrics_lines,
-                       status_item_list[SI_BITRATE], afhi->bitrate,
-                       status_item_list[SI_FORMAT], audio_format_name(afsi->audio_format_id),
-                       status_item_list[SI_FREQUENCY], afhi->frequency,
-                       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 */ /* FIXME: merge with verbose output */
-               struct osl_object lyrics_def;
-               lyr_get_def_by_id(afsi->lyrics_id, &lyrics_def);
+       if (opts->mode == LS_MODE_MBOX)
                para_printf(b,
                        "From foo@localhost %s\n"
                        "Received: from\nTo: bar\nFrom: a\n"
-                       "Subject: %s\n\n" /* path */
-                       "%s%s%s" /* score */
-                       "%s\n" /* attributes */
-                       "hash: %s\n"
-                       "%s\n" /* image id, image name */
-                       "lyrics_id: %s\n"
-                       "bitrate: %dkbit/s\n"
-                       "format: %s\n"
-                       "frequency: %dHz\n"
-                       "channels: %d\n"
-                       "duration: %s\n"
-                       "num_played: %d\n"
-                       "%s\n" /* tag info */
-                       "%s%s\n",
+                       "Subject: %s\n\n",
                        last_played_time,
-                       d->path,
-                       have_score? "score: " : "", score_buf,
-                               have_score? "\n" : "",
-                       att_lines,
-                       asc_hash,
-                       image_lines,
-                       lyrics_lines,
-                       afhi->bitrate,
-                       audio_format_name(afsi->audio_format_id),
-                       afhi->frequency,
-                       afhi->channels,
-                       duration_buf,
-                       afsi->num_played,
-                       afhi->info_string,
-                       lyrics_def.data? "Lyrics:\n~~~~~~~\n" : "",
-                       lyrics_def.data? (char *)lyrics_def.data : ""
-               );
-               if (lyrics_def.data)
+                       d->path);
+       para_printf(b,
+               "%s" /* filename stuff */
+               "%s%s%s%s" /* score */
+               "%s\n" /* attributes */
+               "%s: %s\n" /* hash */
+               "%s" /* image id, image name */
+               "%s" /* lyrics */
+               "%s: %dkbit/s\n" /* bitrate */
+               "%s: %s\n" /* format */
+               "%s: %dHz\n" /* frequency */
+               "%s: %d\n" /* channels */
+               "%s: %s\n" /* duration */
+               "%s: %lu\n" /* seconds total */
+               "%s: %s\n" /* last played time */
+               "%s: %d\n" /* num_played */
+               "%s\n", /* tag info */
+               filename_lines,
+               have_score? status_item_list[SI_SCORE] : "",
+                       have_score? ": " : "",
+                       score_buf,
+                       have_score? "\n" : "",
+               att_lines,
+               status_item_list[SI_HASH], asc_hash,
+               image_lines,
+               lyrics_lines,
+               status_item_list[SI_BITRATE], afhi->bitrate,
+               status_item_list[SI_FORMAT], audio_format_name(afsi->audio_format_id),
+               status_item_list[SI_FREQUENCY], afhi->frequency,
+               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_LAST_PLAYED], last_played_time,
+               status_item_list[SI_NUM_PLAYED], afsi->num_played,
+               afhi->info_string
+       );
+       if (opts->mode == LS_MODE_MBOX) {
+               struct osl_object lyrics_def;
+               lyr_get_def_by_id(afsi->lyrics_id, &lyrics_def);
+               if (lyrics_def.data) {
+                       para_printf(b, "Lyrics:\n~~~~~~~\n%s",
+                               (char *)lyrics_def.data);
                        osl_close_disk_object(&lyrics_def);
+               }
        }
        free(att_lines);
        free(lyrics_lines);