/** -lv */
LS_MODE_VERBOSE,
/** -lm */
- LS_MODE_MBOX
+ LS_MODE_MBOX,
+ /** -lc */
+ LS_MODE_CHUNKS
};
/** The flags accepted by the ls command. */
return ret;
}
+static int print_chunk_table(struct ls_data *d, struct para_buffer *b)
+{
+ struct osl_object chunk_table_obj;
+ struct osl_row *aft_row;
+ int ret, i;
+ char *buf;
+
+ ret = aft_get_row_of_hash(d->hash, &aft_row);
+ if (ret < 0)
+ return ret;
+ ret = osl_open_disk_object(audio_file_table, aft_row,
+ AFTCOL_CHUNKS, &chunk_table_obj);
+ if (ret < 0)
+ return ret;
+ buf = chunk_table_obj.data;
+ para_printf(b, "%s\n"
+ "chunk_time: %lu:%lu\nchunk_offsets: ",
+ d->path,
+ (long unsigned) d->afhi.chunk_tv.tv_sec,
+ (long unsigned) d->afhi.chunk_tv.tv_usec
+ );
+ for (i = 0; i <= d->afhi.chunks_total; i++)
+ para_printf(b, "%u ",
+ (unsigned) read_u32(buf + 4 * i));
+ osl_close_disk_object(&chunk_table_obj);
+ para_printf(b, "\n");
+ return 1;
+}
+
static int print_list_item(struct ls_data *d, struct ls_options *opts,
struct para_buffer *b, time_t current_time)
{
para_printf(b, "%s\n", d->path);
return 1;
}
+ if (opts->mode == LS_MODE_CHUNKS)
+ return print_chunk_table(d, b);
get_attribute_bitmap(&afsi->attributes, att_buf);
ret = get_local_time(&afsi->last_played, last_played_time,
sizeof(last_played_time), current_time, opts->mode);
case 'm':
mode = LS_MODE_MBOX;
continue;
+ case 'c':
+ mode = LS_MODE_CHUNKS;
+ continue;
default:
return -E_AFT_SYNTAX;
}