summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2011-07-29 11:33:27 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-07-29 11:33:27 (GMT)
commit8006a1de47d492a2fc15e314a3851fb40e6622bd (patch) (side-by-side diff)
tree2d28aa3e671e5b5ccecc4ef0f2f60020d47e20e3
parent07e8fc8a6afe790f7e225601392cf6d17b6a3591 (diff)
downloadidest-8006a1de47d492a2fc15e314a3851fb40e6622bd.tar.gz
idest-8006a1de47d492a2fc15e314a3851fb40e6622bd.tar.bz2
Add more tests.
* src/idest.h (source_vopt): New extern. (guess_file_tag_options): New proto. * src/idop.c (parse_ed_items): Use only commas as separators. (set_tag_options,guess_file_tag_options): New function. (find_matching_frame): Use the above functions. (del_tags): make sure tag version remains unchanged, unless requested so on the command line. * src/main.c (source_vopt): New variable. (main): Set source_vopt. * tests/Makefile.am: Add new testcases. * tests/testsuite.at: Add new testcases. * tests/copy-v1-00.at: New testcase. * tests/copy-v12-00.at: New testcase. * tests/copy-v2-00.at: New testcase. * tests/del-all-v1.at: New testcase. * tests/del-all-v12.at: New testcase. * tests/del-all-v2.at: New testcase. * tests/del-frame-v1.at: New testcase. * tests/del-frame-v2.at: New testcase. * tests/set-v1-01.at: New testcase. * tests/set-v2-01.at: New testcase.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/idest.h2
-rw-r--r--src/idop.c94
-rw-r--r--src/main.c4
-rw-r--r--tests/Makefile.am10
-rw-r--r--tests/copy-v1-00.at54
-rw-r--r--tests/copy-v12-00.at74
-rw-r--r--tests/copy-v2-00.at72
-rw-r--r--tests/del-all-v1.at50
-rw-r--r--tests/del-all-v12.at42
-rw-r--r--tests/del-all-v2.at42
-rw-r--r--tests/del-frame-v1.at52
-rw-r--r--tests/del-frame-v2.at70
-rw-r--r--tests/set-v1-01.at52
-rw-r--r--tests/set-v2-01.at70
-rw-r--r--tests/testsuite.at14
15 files changed, 668 insertions, 34 deletions
diff --git a/src/idest.h b/src/idest.h
index 5668474..3d18135 100644
--- a/src/idest.h
+++ b/src/idest.h
@@ -73,6 +73,7 @@ extern int verbose_option;
extern int all_frames;
extern char *source_file;
extern struct id3_tag *source_tag;
+extern int source_vopt;
extern enum backup_type backup_type;
extern char *backup_dir;
extern unsigned convert_version;
@@ -83,6 +84,7 @@ extern char **guile_argv;
extern int no_init_files_option;
/* idop.c */
+int guess_file_tag_options(struct id3_file *file, int *modified);
int set_frame_value(struct id3_frame *frame, const struct ed_item *item);
void set_tags(const char *name);
void del_tags(const char *name);
diff --git a/src/idop.c b/src/idop.c
index e549bcc..353bd46 100644
--- a/src/idop.c
+++ b/src/idop.c
@@ -42,14 +42,14 @@ parse_ed_items(gl_list_t *plist, const char *arg)
list = *plist;
while (*arg) {
struct ed_item *itm;
- size_t len = strcspn(arg, " \t,");
+ size_t len = strcspn(arg, ",");
itm = ed_item_from_frame_spec(arg, len);
gl_list_add_last(list, itm);
arg += len;
if (!*arg)
break;
- arg += strspn(arg, " \t,");
+ arg += strspn(arg, ",");
}
}
@@ -368,6 +368,48 @@ build_tag_options(struct id3_tag *tag, unsigned long location,
return 0;
}
+static void
+set_tag_options(struct id3_tag *tag, int vopt)
+{
+ int opts = 0;
+
+ if (vopt & IDEST_ID3V_1)
+ opts |= ID3_TAG_OPTION_ID3V1;
+ if (!(vopt & IDEST_ID3V_2))
+ opts |= ID3_TAG_OPTION_NO_ID3V2;
+ if (opts)
+ id3_tag_options(tag,
+ ID3_TAG_OPTION_ID3V1|ID3_TAG_OPTION_NO_ID3V2,
+ opts);
+}
+
+int
+guess_file_tag_options(struct id3_file *file, int *modified)
+{
+ int vopt = version_option;
+ int m = 0;
+
+ if (!modified)
+ modified = &m;
+ if (convert_version == 0) {
+ if (*modified && !vopt) {
+ if (id3_file_struct_ntags(file)) {
+ id3_file_struct_iterate(file,
+ build_tag_options,
+ &vopt);
+ } else
+ vopt = default_version_option;
+ }
+ } else if (id3_file_struct_ntags(file)) {
+ id3_file_struct_iterate(file, build_tag_options, &vopt);
+ if (vopt != convert_version) {
+ vopt = convert_version;
+ *modified |= 1;
+ }
+ }
+ return vopt;
+}
+
struct id3_frame *
find_matching_frame(struct id3_tag *tag, const struct ed_item *item,
idest_frame_cmp_t cmp)
@@ -452,11 +494,13 @@ set_tags(const char *name)
struct id3_file *file;
struct id3_tag *tag;
int modified = 0;
- int vopt = version_option;
-
+ int vopt;
+ int has_tags;
+
file = id3_file_open(name, ID3_FILE_MODE_READWRITE);
if (!file)
error(1, errno, "cannot open file %s", name);
+ has_tags = id3_file_struct_ntags(file);
tag = id3_file_tag(file);
if (!tag)
abort(); /* FIXME */
@@ -482,38 +526,14 @@ set_tags(const char *name)
/* FIXME */
modified |= guile_transform(name, tag);
-
- if (convert_version == 0) {
- if (modified && !vopt) {
- if (id3_file_struct_ntags(file)) {
- id3_file_struct_iterate(file,
- build_tag_options,
- &vopt);
- } else
- vopt = default_version_option;
- }
- } else if (id3_file_struct_ntags(file)) {
- id3_file_struct_iterate(file, build_tag_options, &vopt);
- if (vopt != convert_version) {
- vopt = convert_version;
- modified |= 1;
- }
- }
-
- if (modified && vopt) {
- int opts = 0;
- if (vopt & IDEST_ID3V_1)
- opts |= ID3_TAG_OPTION_ID3V1;
- if (!(vopt & IDEST_ID3V_2))
- opts |= ID3_TAG_OPTION_NO_ID3V2;
- id3_tag_options(tag,
- ID3_TAG_OPTION_ID3V1|ID3_TAG_OPTION_NO_ID3V2,
- opts);
- }
- if (modified)
+ vopt = (source_tag && !has_tags) ? source_vopt :
+ guess_file_tag_options(file, &modified);
+
+ if (modified) {
+ set_tag_options(tag, vopt);
safe_id3_file_update_and_close(file);
- else
+ } else
id3_file_close(file);
}
@@ -532,6 +552,8 @@ del_tags(const char *name)
if (filter_list) {
int i;
struct id3_frame *frame;
+ int modified = 0;
+ int vopt;
for (i = 0; (frame = id3_tag_findframe(tag, NULL, i)); ) {
const struct idest_frametab *ft =
@@ -540,9 +562,13 @@ del_tags(const char *name)
frame, ft ? ft->cmp : NULL)) {
id3_tag_detachframe(tag, frame);
id3_frame_delete(frame);
+ modified = 1;
} else
i++;
}
+ vopt = guess_file_tag_options(file, &modified);
+ if (modified)
+ set_tag_options(tag, vopt);
} else
id3_tag_clearframes(tag);
safe_id3_file_update_and_close(file);
diff --git a/src/main.c b/src/main.c
index 54a987d..65c2ef0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -29,6 +29,7 @@ int dry_run_option = 0;
int all_frames = 0;
char *source_file;
struct id3_tag *source_tag;
+int source_vopt;
char *format_name;
char *batch_name;
@@ -241,11 +242,14 @@ main(int argc, char **argv)
mode = MODE_MOD;
if (source_file) {
+ int modified = 1;
+
mode = MODE_MOD;
file = id3_file_open(source_file, ID3_FILE_MODE_READONLY);
if (!file)
error(1, errno, "cannot open file %s", source_file);
source_tag = id3_file_tag(file);
+ source_vopt = guess_file_tag_options(file, &modified);
}
while (argc--) {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4463d13..7b4f48e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -48,13 +48,23 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac $(srcdir)/Makefile
## ------------ ##
TESTSUITE_AT = \
+ copy-v1-00.at\
+ copy-v2-00.at\
+ copy-v12-00.at\
+ del-all-v1.at\
+ del-all-v2.at\
+ del-all-v12.at\
+ del-frame-v1.at\
+ del-frame-v2.at\
testsuite.at\
version.at\
info-v1-00.at\
info-v2-00.at\
info-v12-00.at\
set-v1-00.at\
+ set-v1-01.at\
set-v2-00.at\
+ set-v2-01.at\
query-v1-00.at\
query-v1-01.at\
query-v2-00.at\
diff --git a/tests/copy-v1-00.at b/tests/copy-v1-00.at
new file mode 100644
index 0000000..66f3a2f
--- a/dev/null
+++ b/tests/copy-v1-00.at
@@ -0,0 +1,54 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([copy tags (v1)])
+AT_KEYWORDS([copy v1 copy-v1-00])
+
+AT_CHECK([
+genfile -f file 10k
+cp file file.orig
+echo copy
+idest -c $abs_srcdir/id3v1 file
+echo structure
+idest -i file
+echo tags
+idest file
+echo file data
+dd if=file of=file.mod bs=1024 count=10 2>/dev/null
+cmp file.mod file.orig
+],
+[0],
+[copy
+structure
+file: file
+ntags: 1
+version: 1.1
+offset: 10240
+length: 128
+tags
+title: File
+album: Idest Test Suite
+track: 1
+comment:XXX:: Sample ID3 headers for idest
+artist: Sergey Poznyakoff
+year: 2011
+genre: Other
+file data
+])
+
+AT_CLEANUP
+
+
diff --git a/tests/copy-v12-00.at b/tests/copy-v12-00.at
new file mode 100644
index 0000000..5d04c8c
--- a/dev/null
+++ b/tests/copy-v12-00.at
@@ -0,0 +1,74 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([copy tags (v1-2)])
+AT_KEYWORDS([copy v1-2 copy-v12-00])
+
+AT_CHECK([
+genfile -f file 10k
+cp file file.orig
+echo copy
+idest -c $abs_srcdir/id3v1-2 file
+echo structure
+idest -i file > struct
+off=`idest -i file | sed -n '/^length/{s/length: //p;q}'`
+sed 's/length: .*/length: X/;s/offset: .*/offset: X/' struct
+echo all tags
+idest -a file | sed 's/ *$//'
+echo file data
+dd if=file of=file.mod bs=1 skip=$off count=10240 2>/dev/null
+cmp file.mod file.orig
+],
+[0],
+[copy
+structure
+file: file
+ntags: 2
+version: 2.4.0
+offset: X
+length: X
+version: 1.1
+offset: X
+length: X
+all tags
+TIT2: File
+TALB: Idest Test Suite
+TRCK: 1
+COMM:eng:: Sample ID3 headers for idest testsuite
+TPE1: Sergey Poznyakoff
+TDRC: 2011
+TCON: Sample headers
+TCOP: This file is part of Idest Copyright (C) 2009-2011 Sergey Poznyakoff Idest is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Idest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Idest. If not, see <http://www.gnu.org/licenses/>.
+TENC: Idest
+USLT:eng:: IdEst is an ID3 Edit and Scripting Tool, a command line utility for
+manipulating ID3 tags. ID3 tag is a metadata container which supplies
+related information for a MP3 audio file. It allows information such
+as the title, artist, album, track number, etc. to be stored in the file
+itself.
+
+The idest utility allows to create new tags, and to view,
+modify or delete the existing ones. When compiled with Guile,
+IdEst allows you to write programs of arbitrary complexity for
+manipulating ID3 tags and to apply them to any number of files.
+WPUB: http://www.gnu.org.ua/software/idest
+WXXX:documentation: http://www.gnu.org.ua/software/idest/manual
+WXXX:author: http://gray.gnu.org.ua
+APIC:image/png:5:32x32 sample image: 89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7AF4000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DB071C093A2D7365CBF80000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000954944415458C3ED56D10A002108D3E8FF7F79F7D421125D696107FA16452E5D6E0C00141885826309003313339BF7AFAC40F55EB0FAE2AD1568C9019095CBFF226102D0D1FA6EF97E2F8F72122680049000AE96E3DE749B9D5B5229DD7EE0E4B07419125D21A90DF2CCE801653691169C911991EBE32D98EDF5F65FA0135AE5D8ED07BC04ADAB64EB116DD4822F12A6214900E1001E26BD48441311DC6B0000000049454E44AE426082
+APIC:image/png:0:68x68 sample image: 89504E470D0A1A0A0000000D4948445200000044000000440806000000381393B2000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DB071C0A0032D982A62D0000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000FE4944415478DAEDDADB0E82300C005047F8FF5FAE6F8410196C949B397D3266A9DDB1EB345A22223E628A0101102040800001020408102040800001020408100104081020408000B923C6EC84A594E9F11B7F141CFF7573BDB53B32404E9C21F3B63C7AACF6E65AAEFBB57EB9A6A5CE316B03B5625BF3CC9FAF6DF4311DB2267EB4E0963CB5773922EE1BAAF3176B3D326B455FDD15A77E0EC93C8257CDAFD7DE32B54D6775D2F886CDD6D6651FA921B3D55B8BDB9A15A59443F92FEB90E514CF2A744F9E8CABBDD68D43668BF70CB688D8BC427B72F40ED9E27FAABECB0001020408102040800001020408102040800820408000010204081020401E1F5F46586895430352C20000000049454E44AE426082
+file data
+])
+
+AT_CLEANUP
diff --git a/tests/copy-v2-00.at b/tests/copy-v2-00.at
new file mode 100644
index 0000000..936b101
--- a/dev/null
+++ b/tests/copy-v2-00.at
@@ -0,0 +1,72 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([copy tags (v2)])
+AT_KEYWORDS([copy v2 copy-v2-00])
+
+AT_CHECK([
+genfile -f file 10k
+cp file file.orig
+echo copy
+idest -c $abs_srcdir/id3v2 file
+echo structure
+idest -i file > struct
+off=`sed -n 's/length: //p' struct`
+sed 's/length: .*/length: X/' struct
+echo all tags
+idest -a file | sed 's/ *$//'
+echo file data
+dd if=file of=file.mod bs=1 skip=$off 2>/dev/null
+cmp file.mod file.orig
+],
+[0],
+[copy
+structure
+file: file
+ntags: 1
+version: 2.4.0
+offset: 0
+length: X
+all tags
+TIT2: File
+TALB: Idest Test Suite
+TRCK: 1
+COMM:eng:: Sample ID3 headers for idest testsuite
+TPE1: Sergey Poznyakoff
+TDRC: 2011
+TCON: Sample headers
+TCOP: This file is part of Idest Copyright (C) 2009-2011 Sergey Poznyakoff Idest is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Idest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Idest. If not, see <http://www.gnu.org/licenses/>.
+TENC: Idest
+USLT:eng:: IdEst is an ID3 Edit and Scripting Tool, a command line utility for
+manipulating ID3 tags. ID3 tag is a metadata container which supplies
+related information for a MP3 audio file. It allows information such
+as the title, artist, album, track number, etc. to be stored in the file
+itself.
+
+The idest utility allows to create new tags, and to view,
+modify or delete the existing ones. When compiled with Guile,
+IdEst allows you to write programs of arbitrary complexity for
+manipulating ID3 tags and to apply them to any number of files.
+WPUB: http://www.gnu.org.ua/software/idest
+WXXX:documentation: http://www.gnu.org.ua/software/idest/manual
+WXXX:author: http://gray.gnu.org.ua
+APIC:image/png:5:32x32 sample image: 89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7AF4000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DB071C093A2D7365CBF80000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000954944415458C3ED56D10A002108D3E8FF7F79F7D421125D696107FA16452E5D6E0C00141885826309003313339BF7AFAC40F55EB0FAE2AD1568C9019095CBFF226102D0D1FA6EF97E2F8F72122680049000AE96E3DE749B9D5B5229DD7EE0E4B07419125D21A90DF2CCE801653691169C911991EBE32D98EDF5F65FA0135AE5D8ED07BC04ADAB64EB116DD4822F12A6214900E1001E26BD48441311DC6B0000000049454E44AE426082
+APIC:image/png:0:68x68 sample image: 89504E470D0A1A0A0000000D4948445200000044000000440806000000381393B2000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DB071C0A0032D982A62D0000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000FE4944415478DAEDDADB0E82300C005047F8FF5FAE6F8410196C949B397D3266A9DDB1EB345A22223E628A0101102040800001020408102040800001020408100104081020408000B923C6EC84A594E9F11B7F141CFF7573BDB53B32404E9C21F3B63C7AACF6E65AAEFBB57EB9A6A5CE316B03B5625BF3CC9FAF6DF4311DB2267EB4E0963CB5773922EE1BAAF3176B3D326B455FDD15A77E0EC93C8257CDAFD7DE32B54D6775D2F886CDD6D6651FA921B3D55B8BDB9A15A59443F92FEB90E514CF2A744F9E8CABBDD68D43668BF70CB688D8BC427B72F40ED9E27FAABECB0001020408102040800001020408102040800820408000010204081020401E1F5F46586895430352C20000000049454E44AE426082
+file data
+])
+
+AT_CLEANUP
+
diff --git a/tests/del-all-v1.at b/tests/del-all-v1.at
new file mode 100644
index 0000000..c668f67
--- a/dev/null
+++ b/tests/del-all-v1.at
@@ -0,0 +1,50 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([delete all tags (v1)])
+AT_KEYWORDS([delete v1 del-all del-all-v1])
+
+AT_CHECK([
+genfile -f file -s $abs_srcdir/id3v1 10k
+dd if=file of=file.orig bs=1024 count=10 2>/dev/null
+echo delete
+idest -d file
+echo structure
+idest -i file
+echo tags
+idest file | sed 's/ *$//'
+echo file data
+cmp file file.orig
+],
+[0],
+[delete
+structure
+file: file
+ntags: 0
+tags
+title:
+album:
+track:
+comment:
+artist:
+year:
+genre:
+file data
+])
+
+AT_CLEANUP
+
+
diff --git a/tests/del-all-v12.at b/tests/del-all-v12.at
new file mode 100644
index 0000000..0538413
--- a/dev/null
+++ b/tests/del-all-v12.at
@@ -0,0 +1,42 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([delete all tags (v1-2)])
+AT_KEYWORDS([delete v1-2 del-all del-all-v12])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 -s $abs_srcdir/id3v1 10k
+off=`idest -i file | sed -n '/^length/{s/length: //p;q}'`
+dd if=file of=file.orig bs=1 count=10240 skip=$off 2>/dev/null
+echo delete
+idest -d file
+echo structure
+idest -i file
+echo tags
+idest -a file | sed 's/ *$//'
+echo file data
+cmp file file.orig
+],
+[0],
+[delete
+structure
+file: file
+ntags: 0
+tags
+file data
+])
+
+AT_CLEANUP
diff --git a/tests/del-all-v2.at b/tests/del-all-v2.at
new file mode 100644
index 0000000..125eb3c
--- a/dev/null
+++ b/tests/del-all-v2.at
@@ -0,0 +1,42 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([delete all tags (v2)])
+AT_KEYWORDS([delete v2 del-all del-all-v2])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 10k
+off=`idest -i file | sed -n 's/length: //p'`
+dd if=file of=file.orig bs=1 skip=$off 2>/dev/null
+echo delete
+idest -d file
+echo structure
+idest -i file
+echo tags
+idest -a file | sed 's/ *$//'
+echo file data
+cmp file file.orig
+],
+[0],
+[delete
+structure
+file: file
+ntags: 0
+tags
+file data
+])
+
+AT_CLEANUP
diff --git a/tests/del-frame-v1.at b/tests/del-frame-v1.at
new file mode 100644
index 0000000..755913d
--- a/dev/null
+++ b/tests/del-frame-v1.at
@@ -0,0 +1,52 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([delete frame tags (v1)])
+AT_KEYWORDS([delete v1 del-frame del-frame-v1])
+
+AT_CHECK([
+genfile -f file -s $abs_srcdir/id3v1 10k
+dd if=file of=file.orig bs=1024 count=10 2>/dev/null
+echo delete
+idest -d -F comment,track file
+echo structure
+idest -i file
+echo tags
+idest file | sed 's/ *$//'
+echo file data
+dd if=file of=file.mod bs=1024 count=10 2>/dev/null
+cmp file.mod file.orig
+],
+[0],
+[delete
+structure
+file: file
+ntags: 1
+version: 1.0
+offset: 10240
+length: 128
+tags
+title: File
+album: Idest Test Suite
+track:
+comment:
+artist: Sergey Poznyakoff
+year: 2011
+genre: Other
+file data
+])
+
+AT_CLEANUP
diff --git a/tests/del-frame-v2.at b/tests/del-frame-v2.at
new file mode 100644
index 0000000..49a5d0b
--- a/dev/null
+++ b/tests/del-frame-v2.at
@@ -0,0 +1,70 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([delete frame tags (v2)])
+AT_KEYWORDS([delete v2 del-frame del-frame-v2])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 10k
+off=`idest -i file | sed -n 's/length: //p'`
+dd if=file of=file.orig bs=1 skip=$off 2>/dev/null
+echo delete
+idest -d -F TRCK,comment,WXXX:author,APIC:::'68x68 sample image' file
+echo structure
+idest -i file > struct
+off=`sed -n 's/length: //p' struct`
+sed 's/length: .*/length: X/' struct
+echo all tags
+idest -a file | sed 's/ *$//'
+echo file data
+dd if=file of=file.mod bs=1 skip=$off 2>/dev/null
+cmp file.mod file.orig
+],
+[0],
+[delete
+structure
+file: file
+ntags: 1
+version: 2.4.0
+offset: 0
+length: X
+all tags
+TIT2: File
+TALB: Idest Test Suite
+TPE1: Sergey Poznyakoff
+TDRC: 2011
+TCON: Sample headers
+TCOP: This file is part of Idest Copyright (C) 2009-2011 Sergey Poznyakoff Idest is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Idest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Idest. If not, see <http://www.gnu.org/licenses/>.
+TENC: Idest
+USLT:eng:: IdEst is an ID3 Edit and Scripting Tool, a command line utility for
+manipulating ID3 tags. ID3 tag is a metadata container which supplies
+related information for a MP3 audio file. It allows information such
+as the title, artist, album, track number, etc. to be stored in the file
+itself.
+
+The idest utility allows to create new tags, and to view,
+modify or delete the existing ones. When compiled with Guile,
+IdEst allows you to write programs of arbitrary complexity for
+manipulating ID3 tags and to apply them to any number of files.
+WPUB: http://www.gnu.org.ua/software/idest
+WXXX:documentation: http://www.gnu.org.ua/software/idest/manual
+APIC:image/png:5:32x32 sample image: 89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7AF4000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DB071C093A2D7365CBF80000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000954944415458C3ED56D10A002108D3E8FF7F79F7D421125D696107FA16452E5D6E0C00141885826309003313339BF7AFAC40F55EB0FAE2AD1568C9019095CBFF226102D0D1FA6EF97E2F8F72122680049000AE96E3DE749B9D5B5229DD7EE0E4B07419125D21A90DF2CCE801653691169C911991EBE32D98EDF5F65FA0135AE5D8ED07BC04ADAB64EB116DD4822F12A6214900E1001E26BD48441311DC6B0000000049454E44AE426082
+file data
+])
+
+AT_CLEANUP
+
+
diff --git a/tests/set-v1-01.at b/tests/set-v1-01.at
new file mode 100644
index 0000000..1471759
--- a/dev/null
+++ b/tests/set-v1-01.at
@@ -0,0 +1,52 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([update existing fields (v1)])
+AT_KEYWORDS([set v1 update set-v1-01])
+
+AT_CHECK([
+genfile -f file -s $abs_srcdir/id3v1 10k
+cp file file.bak
+idest --set title='Something' album='set v1 01' \
+ comment='Update test' file || exit 1
+echo structure
+idest -i file
+echo tags
+idest file
+echo file data
+dd if=file of=file.mod bs=1024 count=10 2>/dev/null
+dd if=file.bak of=file.orig bs=1024 count=10 2>/dev/null
+cmp file.mod file.orig
+],
+[0],
+[structure
+file: file
+ntags: 1
+version: 1.1
+offset: 10240
+length: 128
+tags
+title: Something
+album: set v1 01
+track: 1
+comment:XXX:: Update test
+artist: Sergey Poznyakoff
+year: 2011
+genre: Other
+file data
+])
+
+AT_CLEANUP
diff --git a/tests/set-v2-01.at b/tests/set-v2-01.at
new file mode 100644
index 0000000..b3eae02
--- a/dev/null
+++ b/tests/set-v2-01.at
@@ -0,0 +1,70 @@
+# This file is part of idest -*- autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Idest is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Idest is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with idest. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([update existing fields (v2)])
+AT_KEYWORDS([set v2 update set-v2-01])
+
+AT_CHECK([
+genfile -f file -p $abs_srcdir/id3v2 10k
+off=`idest -i file | sed -n 's/length: //p'`
+dd if=file of=file.orig bs=1 skip=$off 2>/dev/null
+idest --set title='set v2 01' comment:eng:='Update test' file || exit 1
+echo structure
+idest -i file > struct
+off=`sed -n 's/length: //p' struct`
+sed 's/length: .*/length: X/' struct
+echo all tags
+idest -a file | sed 's/ *$//'
+echo file data
+dd if=file of=file.mod bs=1 skip=$off 2>/dev/null
+cmp file.mod file.orig
+],
+[0],
+[structure
+file: file
+ntags: 1
+version: 2.4.0
+offset: 0
+length: X
+all tags
+TIT2: set v2 01
+TALB: Idest Test Suite
+TRCK: 1
+COMM:eng:: Update test
+TPE1: Sergey Poznyakoff
+TDRC: 2011
+TCON: Sample headers
+TCOP: This file is part of Idest Copyright (C) 2009-2011 Sergey Poznyakoff Idest is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Idest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Idest. If not, see <http://www.gnu.org/licenses/>.
+TENC: Idest
+USLT:eng:: IdEst is an ID3 Edit and Scripting Tool, a command line utility for
+manipulating ID3 tags. ID3 tag is a metadata container which supplies
+related information for a MP3 audio file. It allows information such
+as the title, artist, album, track number, etc. to be stored in the file
+itself.
+
+The idest utility allows to create new tags, and to view,
+modify or delete the existing ones. When compiled with Guile,
+IdEst allows you to write programs of arbitrary complexity for
+manipulating ID3 tags and to apply them to any number of files.
+WPUB: http://www.gnu.org.ua/software/idest
+WXXX:documentation: http://www.gnu.org.ua/software/idest/manual
+WXXX:author: http://gray.gnu.org.ua
+APIC:image/png:5:32x32 sample image: 89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7AF4000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DB071C093A2D7365CBF80000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000954944415458C3ED56D10A002108D3E8FF7F79F7D421125D696107FA16452E5D6E0C00141885826309003313339BF7AFAC40F55EB0FAE2AD1568C9019095CBFF226102D0D1FA6EF97E2F8F72122680049000AE96E3DE749B9D5B5229DD7EE0E4B07419125D21A90DF2CCE801653691169C911991EBE32D98EDF5F65FA0135AE5D8ED07BC04ADAB64EB116DD4822F12A6214900E1001E26BD48441311DC6B0000000049454E44AE426082
+APIC:image/png:0:68x68 sample image: 89504E470D0A1A0A0000000D4948445200000044000000440806000000381393B2000000017352474200AECE1CE900000006624B474400FF00FF00FFA0BDA793000000097048597300000B1300000B1301009A9C180000000774494D4507DB071C0A0032D982A62D0000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000FE4944415478DAEDDADB0E82300C005047F8FF5FAE6F8410196C949B397D3266A9DDB1EB345A22223E628A0101102040800001020408102040800001020408100104081020408000B923C6EC84A594E9F11B7F141CFF7573BDB53B32404E9C21F3B63C7AACF6E65AAEFBB57EB9A6A5CE316B03B5625BF3CC9FAF6DF4311DB2267EB4E0963CB5773922EE1BAAF3176B3D326B455FDD15A77E0EC93C8257CDAFD7DE32B54D6775D2F886CDD6D6651FA921B3D55B8BDB9A15A59443F92FEB90E514CF2A744F9E8CABBDD68D43668BF70CB688D8BC427B72F40ED9E27FAABECB0001020408102040800001020408102040800820408000010204081020401E1F5F46586895430352C20000000049454E44AE426082
+file data
+])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index f00c5b2..9860967 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -37,6 +37,20 @@ m4_include([info-v2-00.at])
m4_include([info-v12-00.at])
m4_include([set-v1-00.at])
+m4_include([set-v1-01.at])
m4_include([set-v2-00.at])
+m4_include([set-v2-01.at])
+
+m4_include([del-all-v1.at])
+m4_include([del-all-v2.at])
+m4_include([del-all-v12.at])
+
+m4_include([del-frame-v1.at])
+m4_include([del-frame-v2.at])
+
+m4_include([copy-v1-00.at])
+m4_include([copy-v2-00.at])
+m4_include([copy-v12-00.at])
+
# End of testsuite.at

Return to:

Send suggestions and report system problems to the System administrator.