Hi folks,

I always wondered why there is no "metaflac --show-all-tags", in
parallel to --remove-all-tags. Attached you can find a patch for
your consideration. Sample output:

% metaflac --show-all-tags *.flac
01 Pigs on the wing (Part One).flac:ARTIST=Pink Floyd
01 Pigs on the wing (Part One).flac:TRACKNUMBER=01
01 Pigs on the wing (Part One).flac:ALBUM=Animals
01 Pigs on the wing (Part One).flac:TITLE=Pigs on the wing (Part One)
01 Pigs on the wing (Part One).flac:GENRE=Rock
01 Pigs on the wing (Part One).flac:DATE=1977
02 Dogs.flac:ARTIST=Pink Floyd
02 Dogs.flac:TRACKNUMBER=02
02 Dogs.flac:ALBUM=Animals
02 Dogs.flac:TITLE=Dogs
02 Dogs.flac:GENRE=Rock
02 Dogs.flac:DATE=1977
03 Pigs (three different ones).flac:ARTIST=Pink Floyd
03 Pigs (three different ones).flac:TRACKNUMBER=03
03 Pigs (three different ones).flac:ALBUM=Animals
03 Pigs (three different ones).flac:TITLE=Pigs (three different ones)
03 Pigs (three different ones).flac:GENRE=Rock
03 Pigs (three different ones).flac:DATE=1977
04 Sheep.flac:ARTIST=Pink Floyd
04 Sheep.flac:TRACKNUMBER=04
04 Sheep.flac:ALBUM=Animals
04 Sheep.flac:TITLE=Sheep
04 Sheep.flac:GENRE=Rock
04 Sheep.flac:DATE=1977
05 Pigs on the Wing (Part Two).flac:ARTIST=Pink Floyd
05 Pigs on the Wing (Part Two).flac:TRACKNUMBER=05
05 Pigs on the Wing (Part Two).flac:ALBUM=Animals
05 Pigs on the Wing (Part Two).flac:TITLE=Pigs on the Wing (Part Two)
05 Pigs on the Wing (Part Two).flac:GENRE=Rock
05 Pigs on the Wing (Part Two).flac:DATE=1977

Very convenient to get an overview, e.g. to look for typos.

Unfortunately I cannot access the git repository ("git.xiph.org took
too long to respond"), so I hope posting a patch here is OK.


Regards
Harri
Index: flac-1.3.3/src/metaflac/operations.c
===================================================================
--- flac-1.3.3.orig/src/metaflac/operations.c
+++ flac-1.3.3/src/metaflac/operations.c
@@ -357,6 +357,7 @@ FLAC__bool do_shorthand_operation(const
 		case OP__SET_TOTAL_SAMPLES:
 			ok = do_shorthand_operation__streaminfo(filename, prefix_with_filename, chain, operation, needs_write);
 			break;
+		case OP__SHOW_VC_ALL:
 		case OP__SHOW_VC_VENDOR:
 		case OP__SHOW_VC_FIELD:
 		case OP__REMOVE_VC_ALL:
Index: flac-1.3.3/src/metaflac/operations_shorthand_vorbiscomment.c
===================================================================
--- flac-1.3.3.orig/src/metaflac/operations_shorthand_vorbiscomment.c
+++ flac-1.3.3/src/metaflac/operations_shorthand_vorbiscomment.c
@@ -87,6 +87,9 @@ FLAC__bool do_shorthand_operation__vorbi
 		case OP__SHOW_VC_FIELD:
 			write_vc_fields(prefix_with_filename? filename : 0, operation->argument.vc_field_name.value, block->data.vorbis_comment.comments, block->data.vorbis_comment.num_comments, raw, stdout);
 			break;
+		case OP__SHOW_VC_ALL:
+			write_vc_fields(prefix_with_filename? filename : 0, 0, block->data.vorbis_comment.comments, block->data.vorbis_comment.num_comments, raw, stdout);
+			break;
 		case OP__REMOVE_VC_ALL:
 			ok = remove_vc_all(filename, block, needs_write);
 			break;
Index: flac-1.3.3/src/metaflac/options.c
===================================================================
--- flac-1.3.3.orig/src/metaflac/options.c
+++ flac-1.3.3/src/metaflac/options.c
@@ -65,6 +65,7 @@ struct share__option long_options_[] = {
 	{ "set-bps", 1, 0, 0 }, /* undocumented */
 	{ "set-total-samples", 1, 0, 0 }, /* undocumented */ /* WATCHOUT: used by test/test_flac.sh on windows */
 	{ "show-vendor-tag", 0, 0, 0 },
+	{ "show-all-tags", 0, 0, 0 },
 	{ "show-tag", 1, 0, 0 },
 	{ "remove-all-tags", 0, 0, 0 },
 	{ "remove-tag", 1, 0, 0 },
@@ -493,6 +494,9 @@ FLAC__bool parse_option(int option_index
 			ok = false;
 		}
 	}
+	else if(0 == strcmp(opt, "show-all-tags")) {
+		(void) append_shorthand_operation(options, OP__SHOW_VC_ALL);
+	}
 	else if(0 == strcmp(opt, "remove-all-tags")) {
 		(void) append_shorthand_operation(options, OP__REMOVE_VC_ALL);
 	}
Index: flac-1.3.3/src/metaflac/options.h
===================================================================
--- flac-1.3.3.orig/src/metaflac/options.h
+++ flac-1.3.3/src/metaflac/options.h
@@ -51,6 +51,7 @@ typedef enum {
 	OP__SET_CHANNELS,
 	OP__SET_BPS,
 	OP__SET_TOTAL_SAMPLES,
+	OP__SHOW_VC_ALL,
 	OP__SHOW_VC_VENDOR,
 	OP__SHOW_VC_FIELD,
 	OP__REMOVE_VC_ALL,
Index: flac-1.3.3/man/metaflac.sgml
===================================================================
--- flac-1.3.3.orig/man/metaflac.sgml
+++ flac-1.3.3/man/metaflac.sgml
@@ -219,6 +219,14 @@ manpage.1: manpage.sgml
         </listitem>
       </varlistentry>
       <varlistentry>
+        <term><option>--show-all-tags</option></term>
+        <listitem>
+          <para>
+	    Show all tags.
+	  </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
         <term><option>--remove-tag=name</option></term>
         <listitem>
           <para>
_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to