aft.c: Do not print directory if LS_FLAG_FULL_PATH was not given.
[paraslash.git] / aft.c
diff --git a/aft.c b/aft.c
index fa85e4e1f4e6b92dd61eedcfda960ada335d8e32..23c6c0dc24260faae2fed3baae17427f84944e7a 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -622,6 +622,7 @@ int load_afd(int shmid, struct audio_file_data *afd)
  * Mmap the given audio file and update statistics.
  *
  * \param aft_row Determines the audio file to be opened and updated.
+ * \param score The score of the audio file.
  * \param afd Result pointer.
  *
  * On success, the numplayed field of the audio file selector info is increased
@@ -630,8 +631,8 @@ int load_afd(int shmid, struct audio_file_data *afd)
  *
  * \return Positive shmid on success, negative on errors.
  */
-int open_and_update_audio_file(struct osl_row *aft_row,
-       struct audio_file_data *afd, long score)
+int open_and_update_audio_file(struct osl_row *aft_row, long score,
+       struct audio_file_data *afd)
 {
        HASH_TYPE *aft_hash, file_hash[HASH_SIZE];
        struct osl_object afsi_obj;
@@ -807,9 +808,8 @@ 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",
-                       status_item_list[SI_BASENAME], path,
-                       status_item_list[SI_DIRECTORY]);
+               return make_message("%s: %s\n",
+                       status_item_list[SI_BASENAME], path);
        basename = para_basename(path),
        dirname = para_dirname(path);
        ret = make_message("%s: %s\n%s: %s\n%s: %s\n",
@@ -903,7 +903,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        "%s: %lu\n" /* seconds total */
                        "%s: %d\n" /* num_played */
                        "%s: %s\n" /* last_played */
-                       "%s\n", /* tag info */
+                       "%s", /* tag info */
                        filename_lines,
                        have_score? status_item_list[SI_SCORE] : "",
                                have_score? ": " : "",
@@ -962,7 +962,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        lyrics_def.data? (char *)lyrics_def.data : ""
                );
                if (lyrics_def.data)
-                       osl_close_disk_object(lyrics_def.data);
+                       osl_close_disk_object(&lyrics_def);
        }
        free(att_lines);
        free(lyrics_lines);
@@ -971,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 = {