summaryrefslogtreecommitdiffabout
path: root/src/idop.c
authorSergey Poznyakoff <gray@gnu.org.ua>2011-07-08 10:13:17 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-07-08 10:13:17 (GMT)
commitb6d80895594816fcb9f3a7f69a513f985db89272 (patch) (side-by-side diff)
treea14599a1363bf1d9f7496dcc1b293e58207541cb /src/idop.c
parent882dea6f58a2283dcdf0fafa0a9272abbece48d0 (diff)
downloadidest-b6d80895594816fcb9f3a7f69a513f985db89272.tar.gz
idest-b6d80895594816fcb9f3a7f69a513f985db89272.tar.bz2
Implement the --info option.
* NEWS: Update. * configure.ac: Version 1.2.90 * doc/idest.texi: Document the --info option. * libid3tag/file.c (id3_file_struct_ntags) (id3_file_struct_iterate): New functions. * libid3tag/file.h (id3_file_struct_ntags) (id3_file_struct_iterate): New protos. (id3_file_struct_iterator_t): New data type. * src/cmdline.opt: New option --info. * src/idest.h (info_id3): New proto. (del_id3v2): Remove. * src/idop.c (info_id3): New function. * src/main.c (id3_mode): Add info_id3.
Diffstat (limited to 'src/idop.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/idop.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/idop.c b/src/idop.c
index f7d9d4e..7b7f978 100644
--- a/src/idop.c
+++ b/src/idop.c
@@ -15,6 +15,7 @@
along with Idest. If not, see <http://www.gnu.org/licenses/>. */
#include "idest.h"
+#include <file.h>
#include <signal.h>
void
@@ -281,7 +282,33 @@ query_tags(const char *name)
id3_file_close(file);
}
+static int
+prinfo(struct id3_tag *tag, unsigned long location,
+ id3_length_t length, void *data)
+{
+ unsigned int ver = id3_tag_version(tag);
+ printf("version: %u.%u\n",
+ ID3_TAG_VERSION_MAJOR(ver),
+ ID3_TAG_VERSION_MINOR(ver));
+ printf("offset: %lu\n", location);
+ printf("length: %lu\n", length);
+ return 0;
+}
+
void
-del_id3v2(const char *name)
+info_id3(const char *name)
{
+ struct id3_file *file;
+ unsigned long ntags;
+
+ file = id3_file_open(name, ID3_FILE_MODE_READONLY);
+ if (!file)
+ error(1, errno, "cannot open file %s", name);
+ ntags = id3_file_struct_ntags(file);
+ printf("file: %s\n", name);
+ printf("ntags: %lu\n", ntags);
+ id3_file_struct_iterate(file, prinfo, NULL);
+ id3_file_close(file);
}
+
+

Return to:

Send suggestions and report system problems to the System administrator.