Commit 10f739f6 authored by Moritz Grimm's avatar Moritz Grimm
Browse files

Add option -m to disable active metadata updates

Requested by cmodyssey via ticket #1620:
"Allow ezstream to stop it sending metadata information by configuration"
parent f04c3951
......@@ -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
......
......@@ -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
......
......@@ -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 $?
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment