]> git.tue.mpg.de Git - paraslash.git/commitdiff
afs: Minor improvements and fixes.
authorAndre Noll <maan@systemlinux.org>
Mon, 10 Sep 2007 00:56:46 +0000 (02:56 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 10 Sep 2007 00:56:46 +0000 (02:56 +0200)
- Fix audio format handler output of ls -v.
- add_one_audio_file(): Write log messages to the client fd instead of
  para_server's logfile.

aft.c

diff --git a/aft.c b/aft.c
index e1004d00c081eb77cdcdb04abc4554b13aa00715..1d7680714f05d39e1c0c057aaaf95b412e1626b6 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -704,7 +704,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        w->image_id_width, afsi->image_id,
                        w->lyrics_id_width, afsi->lyrics_id,
                        w->bitrate_width, afhi->bitrate,
-                       audio_format_name(afsi->audio_format_id), /* FIXME */
+                       audio_format_name(afsi->audio_format_id),
                        w->frequency_width, afhi->frequency,
                        afhi->channels,
                        duration_buf,
@@ -745,7 +745,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        image_line,
                        lyrics_line,
                        afhi->bitrate,
-                       "mp3", /* FIXME */
+                       audio_format_name(afsi->audio_format_id),
                        afhi->frequency,
                        afhi->channels,
                        duration_buf,
@@ -1244,6 +1244,8 @@ afhi <=> force or no HS
 #define ADD_FLAG_FORCE 2
 #define ADD_FLAG_VERBOSE 4
 
+/* TODO: change log messages so that they get written to the result buffer */
+
 static int com_add_callback(const struct osl_object *query,
                __a_unused struct osl_object *result)
 {
@@ -1421,7 +1423,7 @@ static int add_one_audio_file(const char *arg, const void *private_data)
        ret = 1;
        if (pb && (pad->flags & ADD_FLAG_LAZY)) { /* lazy is really cheap */
                if (pad->flags & ADD_FLAG_VERBOSE)
-                       PARA_NOTICE_LOG("lazy-ignore: %s\n", path);
+                       ret = send_va_buffer(pad->fd, "lazy-ignore: %s\n", path);
                goto out_free;
        }
        /* We still want to add this file. Compute its hash. */
@@ -1444,7 +1446,8 @@ static int add_one_audio_file(const char *arg, const void *private_data)
        ret = 1;
        if (pb && hs && hs == pb && (!(pad->flags & ADD_FLAG_FORCE))) {
                if (pad->flags & ADD_FLAG_VERBOSE)
-                       PARA_NOTICE_LOG("not forcing update: %s\n", path);
+                       ret = send_va_buffer(pad->fd,
+                               "not forcing update: %s\n", path);
                goto out_unmap;
        }
        /*
@@ -1454,8 +1457,8 @@ static int add_one_audio_file(const char *arg, const void *private_data)
        if (!hs || (pad->flags & ADD_FLAG_FORCE)) {
                ret = compute_afhi(path, map.data, map.size, &afhi);
                if (ret < 0) {
-                       PARA_WARNING_LOG("audio format of %s not recognized, skipping\n", path);
-                       ret = 1;
+                       ret = send_va_buffer(pad->fd,
+                               "audio format of %s not recognized\n", path);
                        goto out_unmap;
                }
                format_num = ret;