From 10f739f6f3d35189516362841f7e868899150d56 Mon Sep 17 00:00:00 2001 From: Moritz Grimm Date: Sat, 3 Jan 2015 23:19:28 +0100 Subject: [PATCH] Add option -m to disable active metadata updates Requested by cmodyssey via ticket #1620: "Allow ezstream to stop it sending metadata information by configuration" --- doc/ezstream-file.sh.1.in.in | 8 +++++++- doc/ezstream.1.in.in | 4 +++- src/ezstream-file.sh.in | 10 +++++++--- src/ezstream.c | 15 +++++++++++++-- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/doc/ezstream-file.sh.1.in.in b/doc/ezstream-file.sh.1.in.in index c2c1b11..f537bab 100644 --- a/doc/ezstream-file.sh.1.in.in +++ b/doc/ezstream-file.sh.1.in.in @@ -23,7 +23,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl hnqVv +.Op Fl hmnqVv .Op Fl T Ar cfg_template .Op Ar .Ek @@ -62,6 +62,12 @@ binary. .It Fl h Print a summary of available command line parameters with short descriptions and exit. +.It Fl m +.Po +Passed to +.Nm ezstream . +.Pc +Disable all metadata updates and keep existing metadata in streams untouched. .It Fl n .Po Passed to diff --git a/doc/ezstream.1.in.in b/doc/ezstream.1.in.in index e1b0bac..a6b8f01 100644 --- a/doc/ezstream.1.in.in +++ b/doc/ezstream.1.in.in @@ -24,7 +24,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl hnqVv +.Op Fl hmnqVv .Fl c Ar configfile .Ek .Nm @@ -52,6 +52,8 @@ Use the XML configuration in .It Fl h Print a summary of available command line parameters with short descriptions and exit. +.It Fl m +Disable all metadata updates and keep existing metadata in streams untouched. .It Fl n Normalize metadata strings by removing excess whitespaces. .It Fl q diff --git a/src/ezstream-file.sh.in b/src/ezstream-file.sh.in index 1f9eb2e..ea6f2f6 100644 --- a/src/ezstream-file.sh.in +++ b/src/ezstream-file.sh.in @@ -21,10 +21,10 @@ _myname="$(basename $0)" _filename_placeholder="%FILENAME%" -_opt_string="hnqT:Vv" +_opt_string="hmnqT:Vv" print_usage() { - echo "usage: ${_myname} [-hnqVv] [-T cfg_template] [file ...]" >&2 + echo "usage: ${_myname} [-hmnqVv] [-T cfg_template] [file ...]" >&2 } print_usage_help() @@ -32,6 +32,7 @@ print_usage_help() cat << __EOT >&2 -h print this help and exit + -m [ezstream] disable metadata updates -n [ezstream] normalize metadata strings -q [ezstream] suppress STDERR output from external en-/decoders -T template run ezstream using template for configuration @@ -45,6 +46,7 @@ See the ezstream-file.sh(1) manual for detailed information. __EOT } +_metadisable="" _normalize="" _quiet="" _verbose="" @@ -64,6 +66,8 @@ do print_usage_help exit 0 ;; + -m) + _metadisable="-m"; shift ;; -n) _normalize="-n"; shift ;; -q) @@ -140,6 +144,6 @@ else done fi -${EZSTREAM} ${_normalize} ${_quiet} ${_verbose} -c "${_cfg}" +${EZSTREAM} ${_metadisable} ${_normalize} ${_quiet} ${_verbose} -c "${_cfg}" exit $? diff --git a/src/ezstream.c b/src/ezstream.c index 06bb65e..9841f01 100644 --- a/src/ezstream.c +++ b/src/ezstream.c @@ -50,6 +50,7 @@ char *__progname; #endif /* HAVE___PROGNAME */ int nFlag; +int mFlag; int qFlag; int sFlag; int vFlag; @@ -477,6 +478,9 @@ setMetadata(shout_t *shout, metadata_t *mdata, char **mdata_copy) abort(); } + if (mFlag) + return (SHOUTERR_SUCCESS); + if (mdata == NULL) return 1; @@ -948,6 +952,8 @@ streamFile(shout_t *shout, const char *fileName) } if (ret == STREAM_UPDMDATA || queryMetadata) { queryMetadata = 0; + if (mFlag) + continue; if (metadataFromProgram) { char *mdataStr = NULL; metadata_t *prog_mdata; @@ -1086,7 +1092,7 @@ ez_shutdown(int exitval) void usage(void) { - printf("usage: %s [-hnqVv] -c configfile\n", __progname); + printf("usage: %s [-hmnqVv] -c configfile\n", __progname); printf(" %s -s [playlist]\n", __progname); } @@ -1096,6 +1102,7 @@ usageHelp(void) printf("\n"); printf(" -c configfile use XML configuration in configfile (mandatory)\n"); printf(" -h display this additional help and exit\n"); + printf(" -m disable metadata updates\n"); printf(" -n normalize metadata strings\n"); printf(" -q suppress STDERR output from external en-/decoders\n"); printf(" -s [playlist] read lines from playlist (or STDIN), shuffle and print them to\n"); @@ -1133,11 +1140,12 @@ main(int argc, char *argv[]) __progname = getProgname(argv[0]); pezConfig = getEZConfig(); + mFlag = 0; nFlag = 0; qFlag = 0; vFlag = 0; - while ((c = local_getopt(argc, argv, "c:hnqsVv")) != -1) { + while ((c = local_getopt(argc, argv, "c:hmnqsVv")) != -1) { switch (c) { case 'c': if (configFile != NULL) { @@ -1151,6 +1159,9 @@ main(int argc, char *argv[]) usage(); usageHelp(); return (ez_shutdown(0)); + case 'm': + mFlag = 1; + break; case 'n': nFlag = 1; break;