summaryrefslogtreecommitdiffabout
path: root/src/idop.c
authorSergey Poznyakoff <gray@gnu.org.ua>2011-07-08 11:00:35 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-07-08 11:00:35 (GMT)
commit3d82867917b5a5d517a0b238b7f0dbd244855dec (patch) (side-by-side diff)
tree377a4754eae09ab0dba3fa931a93738079411782 /src/idop.c
parentaeefe0f04e3eb45cec6cbd0ed6296ca0ea2844a6 (diff)
downloadidest-3d82867917b5a5d517a0b238b7f0dbd244855dec.tar.gz
idest-3d82867917b5a5d517a0b238b7f0dbd244855dec.tar.bz2
Add a possibility to delete a subset of ID3 frames.
* NEWS: Document changes to --delete. * doc/idest.texi: Likewise. * src/cmdline.opt: --delete takes optional argument. -d is a shorthand for it. * src/idop.c (del_tags): Delete only certain frames, if a frame list is given.
Diffstat (limited to 'src/idop.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/idop.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/idop.c b/src/idop.c
index c953836..79f9491 100644
--- a/src/idop.c
+++ b/src/idop.c
@@ -163,7 +163,23 @@ del_tags(const char *name)
tag = id3_file_tag(file);
if (!tag)
abort(); /* FIXME */
- id3_tag_clearframes(tag);
+ if (ed_list) {
+ gl_list_iterator_t itr;
+ const void *p;
+
+ itr = gl_list_iterator(ed_list);
+ while (gl_list_iterator_next(&itr, &p, NULL)) {
+ const struct ed_item *item = p;
+ struct id3_frame *frame;
+
+ while (frame = id3_tag_findframe(tag, item->id, 0)) {
+ id3_tag_detachframe(tag, frame);
+ id3_frame_delete(frame);
+ }
+ }
+ gl_list_iterator_free(&itr);
+ } else
+ id3_tag_clearframes(tag);
safe_id3_file_update_and_close(file);
}

Return to:

Send suggestions and report system problems to the System administrator.