summaryrefslogtreecommitdiffabout
path: root/src/idop.c
blob: bb9f1c3f717743fb199deb454100803212c1a302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
/* This file is part of Idest.
   Copyright (C) 2009-2011, 2015-2017 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/>. */

#include "idest.h"
#include <file.h>
#include <signal.h>
#include <ctype.h>

gl_list_t input_list, output_list, filter_list;

void
input_list_add_assignment(const char *name, const char *value)
{
	struct ed_item *itm;

	if (!input_list)
		input_list = ed_list_create();
	itm = ed_item_from_frame_spec(name, strlen(name));
	itm->value = xstrdup(value);
	gl_list_add_last(input_list, itm);
}

void
parse_ed_items(gl_list_t *plist, const char *arg)
{
	gl_list_t list;
	if (!*plist)
		*plist = ed_list_create();
	list = *plist;
	while (*arg) {
		struct ed_item *itm;
 		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, ",");
	}
}

void
parse_filter_items(const char *arg)
{
	parse_ed_items(&filter_list, arg);
}

void
query_filter_list_init()
{
	if (all_frames)
		filter_list = NULL;
	else if (!filter_list)
		parse_filter_items(DEFAULT_ED_LIST);
}	

void
output_list_append(struct ed_item const *item, struct ed_item const *ref)
{
	struct ed_item *elt = ed_item_dup(item);
	if (!output_list)
		output_list = ed_list_create();
	elt->ref = ref;
	gl_list_add_last(output_list, elt);
}

void
output_list_print()
{
	gl_list_iterator_t itr;
	const void *p;

	if (all_frames) {
		if (!output_list)
			return;
		itr = gl_list_iterator(output_list);
		while (gl_list_iterator_next(&itr, &p, NULL)) {
			const struct ed_item *item = p;
			ed_item_print(item);
		}
		gl_list_iterator_free(&itr);
	} else {
		itr = gl_list_iterator(filter_list);
		while (gl_list_iterator_next(&itr, &p, NULL)) {
			int printed = 0;
			const struct ed_item *input_item = p;
			if (output_list) {
				gl_list_iterator_t oitr;
				oitr = gl_list_iterator(output_list);
				while (gl_list_iterator_next(&oitr, &p, NULL)) {
					const struct ed_item *output_item = p;
					if (output_item->ref == input_item) {
						ed_item_print(output_item);
						printed = 1;
					}
				}
				gl_list_iterator_free(&oitr);
			}
			if (!printed)
				ed_item_print(input_item);
		}
		gl_list_iterator_free(&itr);
	}
}

void
output_list_free()
{
	if (output_list) {
		gl_list_free(output_list);
		output_list = NULL;
	}
}

#define DESCR_COLUMN 24
static int
describe_frame(const struct idest_frametab *ft, void *data)
{
	struct id3_frametype const *frametype;
	int n;
	
	frametype = id3_frametype_lookup(ft->id, 4);
	assert(frametype != NULL);
	printf("%s", ft->id);
	n = 0;
	if (ft->qc) {
		int i;
		for (i = 0; i < ft->qc; i++)
			n += printf(":%s", ft->qv[i]);
	}
	do
		putchar(' ');
	while (n++ < DESCR_COLUMN);
	
	printf("%s\n", frametype->description);
	return 0;
}

void
list_supported_frames(void)
{
	if (filter_list) {
		gl_list_iterator_t itr;
		const void *p;
		
		itr = gl_list_iterator(filter_list);

		while (gl_list_iterator_next(&itr, &p, NULL)) {
			const struct ed_item *item = p;
			const struct idest_frametab *ft =
				idest_frame_lookup(item->id);
			if (!ft)
				error(1, 0, "no such frame: %s",
				      item->id);
			describe_frame(ft, NULL);
		}
		gl_list_iterator_free(&itr);
	} else
		frametab_enumerate(describe_frame, NULL, 1);
}

void
safe_id3_file_update_and_close(struct id3_file *file)
{
        sigset_t set, oldset;

        sigemptyset(&set);
        sigaddset(&set, SIGINT);
        sigaddset(&set, SIGTERM);

        sigprocmask(SIG_BLOCK, &set, &oldset);
        id3_file_update(file);
        id3_file_close(file);
        sigprocmask(SIG_SETMASK, &oldset, NULL);
}

static int
frame_encoding_is_8bit(struct id3_frame const *frame)
{
	union id3_field const *field;
	
	if (!frame)
		return 0;
	field = id3_frame_field(frame, 0);
	if (!field)
		return 0;
	return id3_field_gettextencoding(field) == ID3_FIELD_TEXTENCODING_ISO_8859_1;
}

static int
frame_is_genre(struct id3_frame const *frame)
{
	if (!frame)
		return 0;
	return strcmp(frame->id, ID3_FRAME_GENRE) == 0;
}

char *
idest_ucs4_cvt(id3_ucs4_t const *ucs4, struct id3_frame const *frame)
{
	if (broken_8bit_charset && frame_encoding_is_8bit(frame)) {		
		char *tempval = (char*)id3_ucs4_latin1duplicate(ucs4);
		char *output;
		int rc = utf8_convert(idest_conv_recode, tempval, &output);
		free(tempval);
		if (rc == 0) 
			return output;
		error(0, 0, "can't recode value from %s to %s",
		      broken_8bit_charset, "utf-8");
	}
	return (char*) id3_ucs4_utf8duplicate(ucs4);
}

static void
add_stringlist(gl_list_t list, union id3_field *field,
	       struct id3_frame const *frame,
	       size_t *psize)
{
	unsigned i, nstrings = id3_field_getnstrings(field);
	size_t size = 0;
	
	for (i = 0; i < nstrings; i++) {
		id3_ucs4_t const *ucs4;
		char *str;
		
		ucs4 = id3_field_getstrings(field, i);
		if (!ucs4)
			continue;
		if (frame_is_genre(frame))
			ucs4 = id3_genre_name(ucs4);
		str = idest_ucs4_cvt(ucs4, frame);
		size += strlen(str);
		gl_list_add_last(list, str);
	}
	if (psize)
		*psize = size;
}

char *
field_binary_to_string(union id3_field *field)
{
	size_t size = field->binary.length * 2 + 1;
	char *ret, *p;
	size_t i;
	
	ret = xmalloc(size);
	for (i = 0, p = ret; i < field->binary.length; i++, p += 2)
		sprintf(p, "%02X", field->binary.data[i]);
	*p = 0;
	return ret;
}

int
field_binary_from_string(union id3_field *field, const char *str)
{
	char xdig[] = "0123456789ABCDEF";
	size_t len, i;
	
	if (field->type != ID3_FIELD_TYPE_BINARYDATA)
		return IDEST_ERR_BADTYPE;
	len = strlen(str);
	if (len % 2)
		return IDEST_ERR_BADCONV;
	len /= 2;
	field->binary.length = len;
	field->binary.data = xmalloc(len);
	for (i = 0; i < len; i++) {
		unsigned char b;
		char *p;
		
		p = strchr(xdig, toupper(*str++));
		if (!p) {
			free(field->binary.data);
			field->binary.length = 0;
			field->binary.data = NULL;
			return IDEST_ERR_BADCONV;
		}
		b = (p - xdig) << 4;

		p = strchr(xdig, toupper(*str++));
		if (!p) {
			free(field->binary.data);
			field->binary.length = 0;
			field->binary.data = NULL;
			return IDEST_ERR_BADCONV;
		}
		b |= p - xdig;
		
		field->binary.data[i] = b;
	}
	return IDEST_OK;
}

char *
field_to_string(union id3_field *field, struct id3_frame const *frame)
{
	id3_ucs4_t const *ucs4;
	char *ret = NULL;
	char buf[128];
	
	switch (id3_field_type(field)) {
	case ID3_FIELD_TYPE_TEXTENCODING:
	case ID3_FIELD_TYPE_INT8:
	case ID3_FIELD_TYPE_INT16:
	case ID3_FIELD_TYPE_INT24:
	case ID3_FIELD_TYPE_INT32:
		snprintf(buf, sizeof(buf), "%ld", field->number.value);
		ret = xstrdup(buf);
		break;
		
	case ID3_FIELD_TYPE_LATIN1:
	case ID3_FIELD_TYPE_LATIN1FULL:
		/* FIXME */
		ret = xstrdup((char*)id3_field_getlatin1(field));
		break;
		
	case ID3_FIELD_TYPE_LATIN1LIST:
		/* FIXME */
		break;
		
	case ID3_FIELD_TYPE_STRING:
		ucs4 = id3_field_getstring(field);;
		if (ucs4) 
			ret = idest_ucs4_cvt(ucs4, frame);
		break;
		
	case ID3_FIELD_TYPE_STRINGFULL:
		ucs4 = id3_field_getfullstring(field);
		ret = idest_ucs4_cvt(ucs4, frame);
		break;

	case ID3_FIELD_TYPE_STRINGLIST: {
		gl_list_t list;
		size_t sz;
		gl_list_iterator_t itr;
		const void *p;
		
		list = new_string_list(true);
		add_stringlist(list, field, frame, &sz);
		ret = xmalloc(sz + 1);
		ret[0] = 0;
		itr = gl_list_iterator(list);
		while (gl_list_iterator_next(&itr, &p, NULL))
			strcat(ret, p);
		gl_list_iterator_free(&itr);
		gl_list_free(list);
		break;
	}
		
	case ID3_FIELD_TYPE_LANGUAGE:
	case ID3_FIELD_TYPE_FRAMEID:
	case ID3_FIELD_TYPE_DATE:
		ret = xstrdup(field->immediate.value);
		break;
		
	case ID3_FIELD_TYPE_INT32PLUS:
	case ID3_FIELD_TYPE_BINARYDATA:
		ret = field_binary_to_string(field);
		break;
	}
	return ret;
}

int
set_frame_value(struct id3_frame *frame, const struct ed_item *item)
{
	const struct idest_frametab *ft = idest_frame_lookup(frame->id);
	if (!ft)
		return IDEST_ERR_BADTYPE;
	return ft->encode(frame, item);
}

static int
build_tag_options(struct id3_tag *tag, unsigned long location,
		  id3_length_t length, void *data)
{
	unsigned int ver = id3_tag_version(tag);

	if (ID3_TAG_VERSION_MAJOR(ver) == 1)
		*(unsigned int*)data |= IDEST_ID3V_1;
	else
		*(unsigned int*)data |= IDEST_ID3V_2;
	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;
	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)
{
	struct id3_frame *frame;
	
	if (item->qc == 0 || cmp == NULL)
		frame = id3_tag_findframe(tag, item->id, 0);
	else {
		int i;
		for (i = 0; (frame = id3_tag_findframe(tag, item->id, i)); i++) {
			if (cmp(frame, item) == 0)
				break;
		}
	}
	return frame;
}


static int
update_frame(struct id3_tag *tag, const struct ed_item *item)
{
	const struct idest_frametab *ft = idest_frame_lookup(item->id);
	struct id3_frame *frame;

	if (!ft)
		return IDEST_ERR_BADTYPE;

	frame = find_matching_frame(tag, item, ft->cmp);
	if (!frame) {
		frame = id3_frame_new(item->id);
		if (id3_tag_attachframe(tag, frame))
			error(1, 0, "cannot attach new frame");
	}
	return ft->encode(frame, item);
}

static int
copy_source_tags(struct id3_tag *tag)
{
	int i;
	struct id3_frame *frame;

	if (!source_tag)
		return 0;

	for (i = 0; (frame = id3_tag_findframe(source_tag, NULL, i)); i++) {
		const struct idest_frametab *ft =
			idest_frame_lookup(frame->id);
		if (!ft) {
			if (verbose_option)
				error(0, 0,
				      "%s: unsupported frame", frame->id);
			continue;
		}
		if (!filter_list ||
		    ed_list_locate(filter_list, frame, ft->cmp)) {
			int rc;
			struct ed_item itm;
			
			ed_item_zero(&itm);
			itm.name = xstrdup(frame->id);
			memcpy(itm.id, frame->id, 4);
			if (ft->decode(&itm, frame)) {
				error(0, 0, "%s: decoding to %s failed",
				      frame->id, charset);
				continue;
			}
			rc = update_frame(tag, &itm);
			if (rc)
				error(0, 0,
				      "cannot set frame %s: %s",
				      frame->id, idest_strerror(rc));
			ed_item_free_content(&itm);
		}
	}
	return 1;
}

static int
update_frames(struct id3_tag *tag)
{
	gl_list_iterator_t itr;
	const void *p;
	int modified = 0;
	
	itr = gl_list_iterator(input_list);
	while (gl_list_iterator_next(&itr, &p, NULL)) {
		struct ed_item *item = (struct ed_item *) p;

		/* Recode value */
		if (item->value) {
			char *newval;
			if (utf8_convert(idest_conv_encode,
					 item->value, &newval) == 0) {
				free(item->value);
				item->value = newval;
			}
		}
			
		int rc = update_frame(tag, item);
		if (rc)
			error(1, 0,
			      "cannot set frame %s: %s",
			      item->id, idest_strerror(rc));
		modified = 1;
	}
	gl_list_iterator_free(&itr);
	return modified;
}

static void
fixup_charset(struct id3_tag *tag)
{
	struct id3_frame *frame;
	unsigned i;

	if (!broken_8bit_charset)
		return;

	for (i = 0; (frame = id3_tag_findframe(tag, NULL, i)); i++) {
		struct ed_item itm;
		const struct idest_frametab *ft =
			idest_frame_lookup(frame->id);

		if (!ft) {
			if (verbose_option)
				error(0, 0,
				      "%s: unsupported text frame",    
				      frame->id);
			continue;
		}

		if (!frame_encoding_is_8bit(frame))
			continue;
		
		ed_item_zero(&itm);
		itm.name = xstrdup(frame->id);
		memcpy(itm.id, frame->id, 4);
		if (ft->decode(&itm, frame)) {
			error(0, 0, "%s: decoding to %s failed",
			      frame->id, charset);
			continue;
		}
		if (!input_list)
			input_list = ed_list_create();
		gl_list_add_last(input_list, ed_item_dup(&itm));
		ed_item_free_content(&itm);
	}
}

void
set_tags(const char *name)
{
	struct id3_file *file;
	struct id3_tag *tag;
	int modified = 0;
	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 */

	modified |= copy_source_tags(tag);
	
	if (fixup_option) {
		fixup_charset(tag);
		id3_tag_options(tag,
				ID3_TAG_OPTION_UNSYNCHRONISATION
				| ID3_TAG_OPTION_COMPRESSION
				| ID3_TAG_OPTION_CRC, 0);
		modified |= 1;
	}

	if (input_list)
		modified |= update_frames(tag);

	/* FIXME */
	modified |= guile_transform(name, tag);

	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
		id3_file_close(file);
}

void
del_tags(const char *name)
{
	struct id3_file *file;
	struct id3_tag *tag;
	
	file = id3_file_open(name, ID3_FILE_MODE_READWRITE);
	if (!file)
		error(1, errno, "cannot open file %s", name);
	tag = id3_file_tag(file);
	if (!tag) 
		abort(); /* FIXME */
	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 =
				idest_frame_lookup(frame->id);
			if (ed_list_locate(filter_list,
					   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);
}

static void
show_tags(struct id3_tag *tag)
{
	struct id3_frame *frame;
	unsigned i;

	for (i = 0; (frame = id3_tag_findframe(tag, NULL, i)); i++) {
		const struct idest_frametab *ft =
			idest_frame_lookup(frame->id);
		if (!ft) {
			if (verbose_option)
				error(0, 0,
				      "%s: unsupported frame", frame->id);
			continue;
		}

		if (all_frames) {
			struct ed_item outitm;
			ed_item_zero(&outitm);
			if (describe_option) {
				struct id3_frametype const *frametype;
				frametype = id3_frametype_lookup(frame->id,
								 4);
				outitm.name = xstrdup(frametype->description);
			} else
				outitm.name = xstrdup(frame->id);
			memcpy(outitm.id, frame->id, 4);
			if (ft->decode(&outitm, frame)) {
				error(0, 0, "%s: decoding to %s failed",
				      frame->id, charset);
				continue;
			}
			output_list_append(&outitm, NULL);
			ed_item_free_content(&outitm);
		} else {
			struct ed_item const *ref;
			
			ref = ed_list_locate(filter_list, frame, ft->cmp);
			if (ref) {
				struct ed_item outitm;
				ed_item_zero(&outitm);
				outitm.name = xstrdup(ref->name);
				memcpy(outitm.id, ref->id, 4);
				if (ft->decode(&outitm, frame)) {
					error(0, 0,
					      "%s: decoding to %s failed",
					      frame->id,
					      charset);
					continue;
				}
				output_list_append(&outitm, ref);
				ed_item_free_content(&outitm);
			}
		}
	}
	output_list_print();
	output_list_free();
}

void
query_tags(const char *name)
{
	struct id3_file *file;
	struct id3_tag *tag;
	
	query_filter_list_init();	
	
	file = id3_file_open(name, ID3_FILE_MODE_READONLY);
	if (!file)
		error(1, errno, "cannot open file %s", name);

	tag = id3_file_tag(file);
	if (tag) {
		if (guile_list(name, tag) == 0)
			show_tags(tag);
	}
	
	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);
	unsigned int major = ID3_TAG_VERSION_MAJOR(ver);
	if (major > 1)
		printf("version: 2.%u.%u\n",
		       major, ID3_TAG_VERSION_MINOR(ver));
	else
		printf("version: %u.%u\n",
		       major, ID3_TAG_VERSION_MINOR(ver));
	printf("offset: %lu\n", location);
	printf("length: %lu\n", length);
	return 0;
}

void
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.