/** -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;
+ 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
+ );
+ buf = chunk_table_obj.data;
+ 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;
}
struct com_touch_options *cto;
/** Message buffer. */
struct para_buffer pb;
+ /** How many audio files matched the given pattern. */
+ unsigned num_matches;
};
static int touch_audio_file(__a_unused struct osl_table *table,
if (tad->cto->last_played >= 0)
new_afsi.last_played = tad->cto->last_played;
}
+ tad->num_matches++;
save_afsi(&new_afsi, &obj); /* in-place update */
aced.aft_row = row;
aced.old_afsi = &old_afsi;
ret = for_each_matching_row(&pmd);
if (ret < 0)
para_printf(&tad.pb, "%s\n", para_strerror(-ret));
+ else
+ if (!tad.num_matches)
+ para_printf(&tad.pb, "no matches\n");
if (tad.pb.buf) {
result->data = tad.pb.buf;
result->size = tad.pb.size;