From 0ceb4491da0ea042f5ec559b0992ee396a6930d7 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Wed, 8 Sep 2004 00:55:16 +0000 Subject: [PATCH] rename metaflac *-vc-* options to *-tag-* ones, only ones remain but deprecated --- src/metaflac/options.c | 56 +++++++++++++++++++++++++++++++++++--------------- src/metaflac/usage.c | 39 +++++++++++++++-------------------- test/test_metaflac.sh | 36 ++++++++++++++++---------------- 3 files changed, 75 insertions(+), 56 deletions(-) diff --git a/src/metaflac/options.c b/src/metaflac/options.c index 7aa042c..fb0ca47 100644 --- a/src/metaflac/options.c +++ b/src/metaflac/options.c @@ -56,14 +56,22 @@ struct share__option long_options_[] = { { "set-channels", 1, 0, 0 }, /* undocumented */ { "set-bps", 1, 0, 0 }, /* undocumented */ { "set-total-samples", 1, 0, 0 }, /* undocumented */ - { "show-vc-vendor", 0, 0, 0 }, - { "show-vc-field", 1, 0, 0 }, - { "remove-vc-all", 0, 0, 0 }, - { "remove-vc-field", 1, 0, 0 }, - { "remove-vc-firstfield", 1, 0, 0 }, - { "set-vc-field", 1, 0, 0 }, - { "import-vc-from", 1, 0, 0 }, - { "export-vc-to", 1, 0, 0 }, + { "show-vendor-tag", 0, 0, 0 }, + { "show-tag", 1, 0, 0 }, + { "remove-all-tags", 0, 0, 0 }, + { "remove-tag", 1, 0, 0 }, + { "remove-first-tag", 1, 0, 0 }, + { "set-tag", 1, 0, 0 }, + { "import-tags-from", 1, 0, 0 }, + { "export-tags-to", 1, 0, 0 }, + { "show-vc-vendor", 0, 0, 0 }, /* deprecated */ + { "show-vc-field", 1, 0, 0 }, /* deprecated */ + { "remove-vc-all", 0, 0, 0 }, /* deprecated */ + { "remove-vc-field", 1, 0, 0 }, /* deprecated */ + { "remove-vc-firstfield", 1, 0, 0 }, /* deprecated */ + { "set-vc-field", 1, 0, 0 }, /* deprecated */ + { "import-vc-from", 1, 0, 0 }, /* deprecated */ + { "export-vc-to", 1, 0, 0 }, /* deprecated */ { "import-cuesheet-from", 1, 0, 0 }, { "export-cuesheet-to", 1, 0, 0 }, { "add-seekpoint", 1, 0, 0 }, @@ -441,11 +449,15 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else undocumented_warning(opt); } - else if(0 == strcmp(opt, "show-vc-vendor")) { + else if(0 == strcmp(opt, "show-vendor-tag") || 0 == strcmp(opt, "show-vc-vendor")) { + if(0 == strcmp(opt, "show-vc-vendor")) + fprintf(stderr, "WARNING: --%s is deprecated, the new name is --show-vendor-tag\n", opt); (void) append_shorthand_operation(options, OP__SHOW_VC_VENDOR); } - else if(0 == strcmp(opt, "show-vc-field")) { + else if(0 == strcmp(opt, "show-tag") || 0 == strcmp(opt, "show-vc-field")) { const char *violation; + if(0 == strcmp(opt, "show-vc-field")) + fprintf(stderr, "WARNING: --%s is deprecated, the new name is --show-tag\n", opt); op = append_shorthand_operation(options, OP__SHOW_VC_FIELD); FLAC__ASSERT(0 != option_argument); if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) { @@ -454,11 +466,15 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi ok = false; } } - else if(0 == strcmp(opt, "remove-vc-all")) { + else if(0 == strcmp(opt, "remove-all-tags") || 0 == strcmp(opt, "remove-vc-all")) { + if(0 == strcmp(opt, "remove-vc-all")) + fprintf(stderr, "WARNING: --%s is deprecated, the new name is --remove-all-tags\n", opt); (void) append_shorthand_operation(options, OP__REMOVE_VC_ALL); } - else if(0 == strcmp(opt, "remove-vc-field")) { + else if(0 == strcmp(opt, "remove-tag") || 0 == strcmp(opt, "remove-vc-field")) { const char *violation; + if(0 == strcmp(opt, "remove-vc-field")) + fprintf(stderr, "WARNING: --%s is deprecated, the new name is --remove-tag\n", opt); op = append_shorthand_operation(options, OP__REMOVE_VC_FIELD); FLAC__ASSERT(0 != option_argument); if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) { @@ -467,8 +483,10 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi ok = false; } } - else if(0 == strcmp(opt, "remove-vc-firstfield")) { + else if(0 == strcmp(opt, "remove-first-tag") || 0 == strcmp(opt, "remove-vc-firstfield")) { const char *violation; + if(0 == strcmp(opt, "remove-vc-firstfield")) + fprintf(stderr, "WARNING: --%s is deprecated, the new name is --remove-first-tag\n", opt); op = append_shorthand_operation(options, OP__REMOVE_VC_FIRSTFIELD); FLAC__ASSERT(0 != option_argument); if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) { @@ -477,8 +495,10 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi ok = false; } } - else if(0 == strcmp(opt, "set-vc-field")) { + else if(0 == strcmp(opt, "set-tag") || 0 == strcmp(opt, "set-vc-field")) { const char *violation; + if(0 == strcmp(opt, "set-vc-field")) + fprintf(stderr, "WARNING: --%s is deprecated, the new name is --set-tag\n", opt); op = append_shorthand_operation(options, OP__SET_VC_FIELD); FLAC__ASSERT(0 != option_argument); if(!parse_vorbis_comment_field(option_argument, &(op->argument.vc_field.field), &(op->argument.vc_field.field_name), &(op->argument.vc_field.field_value), &(op->argument.vc_field.field_value_length), &violation)) { @@ -487,7 +507,9 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi ok = false; } } - else if(0 == strcmp(opt, "import-vc-from")) { + else if(0 == strcmp(opt, "import-tags-from") || 0 == strcmp(opt, "import-vc-from")) { + if(0 == strcmp(opt, "import-vc-from")) + fprintf(stderr, "WARNING: --%s is deprecated, the new name is --import-tags-from\n", opt); op = append_shorthand_operation(options, OP__IMPORT_VC_FROM); FLAC__ASSERT(0 != option_argument); if(!parse_filename(option_argument, &(op->argument.filename.value))) { @@ -495,7 +517,9 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi ok = false; } } - else if(0 == strcmp(opt, "export-vc-to")) { + else if(0 == strcmp(opt, "export-tags-to") || 0 == strcmp(opt, "export-vc-to")) { + if(0 == strcmp(opt, "export-vc-to")) + fprintf(stderr, "WARNING: --%s is deprecated, the new name is --export-tags-to\n", opt); op = append_shorthand_operation(options, OP__EXPORT_VC_TO); FLAC__ASSERT(0 != option_argument); if(!parse_filename(option_argument, &(op->argument.filename.value))) { diff --git a/src/metaflac/usage.c b/src/metaflac/usage.c index 321e236..0b067a2 100644 --- a/src/metaflac/usage.c +++ b/src/metaflac/usage.c @@ -114,32 +114,27 @@ int long_usage(const char *message, ...) fprintf(out, "--show-bps Show the # of bits per sample from the STREAMINFO block.\n"); fprintf(out, "--show-total-samples Show the total # of samples from the STREAMINFO block.\n"); fprintf(out, "\n"); - fprintf(out, "--show-vc-vendor Show the vendor string from the VORBIS_COMMENT block.\n"); - fprintf(out, "--show-vc-field=name Show all Vorbis comment fields where the the field name\n"); - fprintf(out, " matches 'name'.\n"); - fprintf(out, "--remove-vc-field=name Remove all Vorbis comment fields whose field name\n"); - fprintf(out, " is 'name'.\n"); - fprintf(out, "--remove-vc-firstfield=name Remove first Vorbis comment field whose field\n"); - fprintf(out, " name is 'name'.\n"); - fprintf(out, "--remove-vc-all Remove all Vorbis comment fields, leaving only the\n"); - fprintf(out, " vendor string in the VORBIS_COMMENT block.\n"); - fprintf(out, "--set-vc-field=field Add a Vorbis comment field. The field must comply with\n"); - fprintf(out, " the Vorbis comment spec, of the form \"NAME=VALUE\". If\n"); - fprintf(out, " there is currently no VORBIS_COMMENT block, one will be\n"); - fprintf(out, " created.\n"); - fprintf(out, "--import-vc-from=file Import Vorbis comments from a file. Use '-' for stdin.\n"); - fprintf(out, " Each line should be of the form NAME=VALUE. Multi-\n"); - fprintf(out, " line comments are currently not supported. Specify\n"); - fprintf(out, " --remove-vc-all and/or --no-utf8-convert before\n"); - fprintf(out, " --import-vc-from if necessary.\n"); - fprintf(out, "--export-vc-to=file Export Vorbis comments to a file. Use '-' for stdin.\n"); - fprintf(out, " Each line will be of the form NAME=VALUE. Specify\n"); + fprintf(out, "--show-vendor-tag Show the vendor string from the VORBIS_COMMENT block.\n"); + fprintf(out, "--show-tag=NAME Show all tags where the the field name matches 'NAME'.\n"); + fprintf(out, "--remove-tag=NAME Remove all tags whose field name is 'NAME'.\n"); + fprintf(out, "--remove-first-tag=NAME Remove first tag whose field name is 'NAME'.\n"); + fprintf(out, "--remove-all-tags Remove all tags, leaving only the vendor string.\n"); + fprintf(out, "--set-tag=FIELD Add a tag. The FIELD must comply with the Vorbis comment\n"); + fprintf(out, " spec, of the form \"NAME=VALUE\". If there is currently\n"); + fprintf(out, " no tag block, one will be created.\n"); + fprintf(out, "--import-tags-from=FILE Import tags from a file. Use '-' for stdin. Each line\n"); + fprintf(out, " should be of the form NAME=VALUE. Multi-line comments\n"); + fprintf(out, " are currently not supported. Specify --remove-all-tags\n"); + fprintf(out, " and/or --no-utf8-convert before --import-tags-from if\n"); + fprintf(out, " necessary.\n"); + fprintf(out, "--export-tags-to=FILE Export tags to a file. Use '-' for stdin. Each line\n"); + fprintf(out, " will be of the form NAME=VALUE. Specify\n"); fprintf(out, " --no-utf8-convert if necessary.\n"); - fprintf(out, "--import-cuesheet-from=file Import a cuesheet from a file. Only one FLAC\n"); + fprintf(out, "--import-cuesheet-from=FILE Import a cuesheet from a file. Only one FLAC\n"); fprintf(out, " file may be specified. A seekpoint will be added for\n"); fprintf(out, " each index point in the cuesheet to the SEEKTABLE unless\n"); fprintf(out, " --no-cued-seekpoints is specified.\n"); - fprintf(out, "--export-cuesheet-to=file Export CUESHEET block to a cuesheet file, suitable\n"); + fprintf(out, "--export-cuesheet-to=FILE Export CUESHEET block to a cuesheet file, suitable\n"); fprintf(out, " for use by CD authoring software. Use '-' for stdin.\n"); fprintf(out, " Only one FLAC file may be specified on the command line.\n"); fprintf(out, "--add-replay-gain Calculates the title and album gains/peaks of the given\n"); diff --git a/test/test_metaflac.sh b/test/test_metaflac.sh index 547d79d..6c5c353 100755 --- a/test/test_metaflac.sh +++ b/test/test_metaflac.sh @@ -98,14 +98,14 @@ check_exit check_flac # some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore: -(set -x && run_metaflac --set-vc-field="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile) +(set -x && run_metaflac --set-tag="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile) check_exit check_flac (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile) check_exit -(set -x && run_metaflac --set-vc-field="ARTIST=Chuck_Woolery" $flacfile) +(set -x && run_metaflac --set-tag="ARTIST=Chuck_Woolery" $flacfile) check_exit check_flac @@ -115,31 +115,31 @@ check_exit (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile) check_exit -(set -x && run_metaflac --set-vc-field="ARTIST=Vern" $flacfile) +(set -x && run_metaflac --set-tag="ARTIST=Vern" $flacfile) check_exit check_flac (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile) check_exit -(set -x && run_metaflac --set-vc-field="TITLE=He_who_smelt_it_dealt_it" $flacfile) +(set -x && run_metaflac --set-tag="TITLE=He_who_smelt_it_dealt_it" $flacfile) check_exit check_flac (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile) check_exit -(set -x && run_metaflac --show-vc-vendor --show-vc-field=ARTIST $flacfile) +(set -x && run_metaflac --show-vendor-tag --show-tag=ARTIST $flacfile) check_exit -(set -x && run_metaflac --remove-vc-firstfield=ARTIST $flacfile) +(set -x && run_metaflac --remove-first-tag=ARTIST $flacfile) check_exit check_flac (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile) check_exit -(set -x && run_metaflac --remove-vc-field=ARTIST $flacfile) +(set -x && run_metaflac --remove-tag=ARTIST $flacfile) check_exit check_flac @@ -178,7 +178,7 @@ check_flac check_exit check_flac -(set -x && run_metaflac --remove-vc-all $flacfile) +(set -x && run_metaflac --remove-all-tags $flacfile) check_exit check_flac @@ -218,55 +218,55 @@ check_flac check_exit check_flac -(set -x && run_metaflac --set-vc-field="f=0123456789abcdefghij" $flacfile) +(set -x && run_metaflac --set-tag="f=0123456789abcdefghij" $flacfile) check_exit check_flac (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile) check_exit -(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile) +(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile) check_exit check_flac (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile) check_exit -(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcde" $flacfile) +(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcde" $flacfile) check_exit check_flac (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile) check_exit -(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0" $flacfile) +(set -x && run_metaflac --remove-all-tags --set-tag="f=0" $flacfile) check_exit check_flac (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile) check_exit -(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789" $flacfile) +(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile) check_exit check_flac (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile) check_exit -(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile) +(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile) check_exit check_flac (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile) check_exit -(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789" $flacfile) +(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile) check_exit check_flac (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile) check_exit -(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghij" $flacfile) +(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghij" $flacfile) check_exit check_flac (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile) check_exit -(set -x && echo "TITLE=Tittle" | run_metaflac --import-vc-from=- $flacfile) +(set -x && echo "TITLE=Tittle" | run_metaflac --import-tags-from=- $flacfile) check_exit check_flac (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile) @@ -276,7 +276,7 @@ cat > vc.txt << EOF artist=Fartist artist=artits EOF -(set -x && run_metaflac --import-vc-from=vc.txt $flacfile) +(set -x && run_metaflac --import-tags-from=vc.txt $flacfile) check_exit check_flac (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile) -- 2.7.4