1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-12-04 14:46:31 -05:00

Teach ezstream a different mode of operation, as a one-shot line shuffling tool.

git-svn-id: https://svn.xiph.org/trunk/ezstream@16537 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
moritz 2009-08-30 21:55:24 +00:00
parent c59c0c9847
commit 000320afa5
3 changed files with 56 additions and 2 deletions

2
NEWS
View File

@ -12,6 +12,8 @@ Changes in 0.5.6, released on 2009-08-31:
and operation will continue until 100 subsequent errors. Based on
an idea from dhorton.
(Ticket #1585)
- [NEW] New command line option -s: Make ezstream function as a line-
based shuffling utility.
* src/playlist.c:
- [MISC] Consider no output from a playlist program to be equivalent to an
empty line, indicating that the end of the playlist is reached.

View File

@ -27,6 +27,11 @@
.Op Fl hnqVv
.Fl c Ar configfile
.Ek
.Nm
.Bk -words
.Fl s
.Op Ar playlist
.Ek
.Sh DESCRIPTION
The
.Nm
@ -44,7 +49,6 @@ reading from standard input, and can be used from the command line.
.It Fl c Ar configfile
Use the XML configuration in
.Ar configfile .
.Pq Mandatory.
.It Fl h
Print a summary of available command line parameters with short descriptions
and exit.
@ -53,6 +57,18 @@ Normalize metadata strings by removing excess whitespaces.
.It Fl q
Be more quiet.
Suppress the output that external programs send to standard error.
.It Fl s Op Ar playlist
Run
.Nm
as a line-based shuffling utility.
If no
.Ar playlist
argument is given, a list of media file names is read from standard input
instead of an input file.
After successfully reading the entire list, it is shuffled and printed to
standard output, and
.Nm
will exit.
.It Fl V
Print the
.Nm

View File

@ -51,6 +51,7 @@ char *__progname;
int nFlag;
int qFlag;
int sFlag;
int vFlag;
int metadataFromProgram;
@ -1073,6 +1074,7 @@ void
usage(void)
{
printf("usage: %s [-hnqVv] -c configfile\n", __progname);
printf(" %s -s [playlist]\n", __progname);
}
void
@ -1083,6 +1085,8 @@ usageHelp(void)
printf(" -h display this additional help and exit\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");
printf(" STDOUT, then exit\n");
printf(" -V print the version number and exit\n");
printf(" -v verbose output (use twice for more effect)\n");
printf("\n");
@ -1120,7 +1124,7 @@ main(int argc, char *argv[])
qFlag = 0;
vFlag = 0;
while ((c = local_getopt(argc, argv, "c:hnqVv")) != -1) {
while ((c = local_getopt(argc, argv, "c:hnqsVv")) != -1) {
switch (c) {
case 'c':
if (configFile != NULL) {
@ -1140,6 +1144,9 @@ main(int argc, char *argv[])
case 'q':
qFlag = 1;
break;
case 's':
sFlag = 1;
break;
case 'V':
printf("%s\n", PACKAGE_STRING);
return (ez_shutdown(0));
@ -1156,6 +1163,35 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
if (sFlag) {
playlist_t *pl;
const char *entry;
switch (argc) {
case 0:
pl = playlist_read(NULL);
if (pl == NULL)
return (ez_shutdown(1));
break;
case 1:
pl = playlist_read(argv[0]);
if (pl == NULL)
return (ez_shutdown(1));
break;
default:
printf("Error: Too many arguments.\n");
return (ez_shutdown(2));
}
playlist_shuffle(pl);
while ((entry = playlist_get_next(pl)) != NULL)
printf("%s\n", entry);
playlist_free(&pl);
return (ez_shutdown(0));
}
if (configFile == NULL) {
printf("You must supply a config file with the -c argument.\n");
usage();