1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

... also fix ezstream in this regard: No need to complain when receiving such

an empty line, and not receiving any output should not be a fatal error.
Consider the latter to be "end-of-playlist", too.


git-svn-id: https://svn.xiph.org/trunk/ezstream@16526 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
moritz 2009-08-29 09:14:12 +00:00
parent c5da3377ac
commit 322b88412f
2 changed files with 18 additions and 10 deletions

5
NEWS
View File

@ -5,6 +5,11 @@ Changes in 0.5.6, released on XXXX-XX-XX:
Failure to open a resource (e.g. a media file) is no longer fatal Failure to open a resource (e.g. a media file) is no longer fatal
and operation will continue as far as possible. Idea from dhorton. and operation will continue as far as possible. Idea from dhorton.
(Ticket #1585) (Ticket #1585)
* 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.
- [FIX] Do not complain when receiving an empty line from a playlist
program.
* examples/: * examples/:
- [NEW] Add a real-world example playlist script with logging feature. - [NEW] Add a real-world example playlist script with logging feature.

View File

@ -499,15 +499,20 @@ playlist_run_program(playlist_t *pl)
} }
if (fgets(buf, (int)sizeof(buf), filep) == NULL) { if (fgets(buf, (int)sizeof(buf), filep) == NULL) {
if (ferror(filep)) int errnum = errno;
printf("%s: Error while reading output from program '%s': %s\n",
__progname, pl->filename, strerror(errno));
pclose(filep); pclose(filep);
printf("%s: FATAL: External program '%s' not (or no longer) usable.\n",
__progname, pl->filename); if (ferror(filep)) {
printf("%s: Error while reading output from program '%s': %s\n",
__progname, pl->filename, strerror(errnum));
exit(1); exit(1);
} }
/* No output (end of playlist.) */
return (NULL);
}
pclose(filep); pclose(filep);
if (strlen(buf) == sizeof(buf) - 1) { if (strlen(buf) == sizeof(buf) - 1) {
@ -518,11 +523,9 @@ playlist_run_program(playlist_t *pl)
buf[strcspn(buf, "\n")] = '\0'; buf[strcspn(buf, "\n")] = '\0';
buf[strcspn(buf, "\r")] = '\0'; buf[strcspn(buf, "\r")] = '\0';
if (buf[0] == '\0') { if (buf[0] == '\0')
printf("%s: Empty line received from program '%s'\n", /* Empty line (end of playlist.) */
__progname, pl->filename);
return (NULL); return (NULL);
}
if (pl->prog_track != NULL) if (pl->prog_track != NULL)
xfree(pl->prog_track); xfree(pl->prog_track);