mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2025-01-03 14:56:35 -05:00
Look for non-absolute filenames relative to the playlist
This commit is contained in:
parent
4c4bf8ffce
commit
d59108b825
@ -643,8 +643,11 @@ streamFile(stream_t stream, const char *fileName)
|
|||||||
int
|
int
|
||||||
streamPlaylist(stream_t stream)
|
streamPlaylist(stream_t stream)
|
||||||
{
|
{
|
||||||
const char *song;
|
int ret;
|
||||||
char lastSong[PATH_MAX];
|
const char *song_next;
|
||||||
|
char song_prev[PATH_MAX];
|
||||||
|
char *song_path;
|
||||||
|
char tmp_path[2 * PATH_MAX];
|
||||||
cfg_intake_t cfg_intake = stream_get_cfg_intake(stream);
|
cfg_intake_t cfg_intake = stream_get_cfg_intake(stream);
|
||||||
|
|
||||||
if (playlist == NULL) {
|
if (playlist == NULL) {
|
||||||
@ -678,12 +681,30 @@ streamPlaylist(stream_t stream)
|
|||||||
cfg_intake_get_shuffle(cfg_intake))
|
cfg_intake_get_shuffle(cfg_intake))
|
||||||
playlist_shuffle(playlist);
|
playlist_shuffle(playlist);
|
||||||
|
|
||||||
while ((song = playlist_get_next(playlist)) != NULL) {
|
while ((song_next = playlist_get_next(playlist)) != NULL) {
|
||||||
strlcpy(lastSong, song, sizeof(lastSong));
|
strlcpy(song_prev, song_next, sizeof(song_prev));
|
||||||
if (!streamFile(stream, song))
|
|
||||||
|
if ('/' == song_next[0])
|
||||||
|
(void)snprintf(tmp_path, sizeof(tmp_path), "%s",
|
||||||
|
song_next);
|
||||||
|
else
|
||||||
|
(void)snprintf(tmp_path, sizeof(tmp_path), "%s/%s",
|
||||||
|
playlist_get_location(playlist), song_next);
|
||||||
|
|
||||||
|
song_path = realpath(tmp_path, NULL);
|
||||||
|
if (NULL == song_path) {
|
||||||
|
log_warning("%s: %s", song_next, strerror(errno));
|
||||||
return (0);
|
return (0);
|
||||||
|
}
|
||||||
|
ret = streamFile(stream, song_path);
|
||||||
|
free(song_path);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
return (0);
|
||||||
|
|
||||||
if (quit)
|
if (quit)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (rereadPlaylist) {
|
if (rereadPlaylist) {
|
||||||
rereadPlaylist = rereadPlaylist_notify = 0;
|
rereadPlaylist = rereadPlaylist_notify = 0;
|
||||||
if (CFG_INTAKE_PROGRAM == cfg_intake_get_type(cfg_intake))
|
if (CFG_INTAKE_PROGRAM == cfg_intake_get_type(cfg_intake))
|
||||||
@ -694,7 +715,7 @@ streamPlaylist(stream_t stream)
|
|||||||
if (cfg_intake_get_shuffle(cfg_intake))
|
if (cfg_intake_get_shuffle(cfg_intake))
|
||||||
playlist_shuffle(playlist);
|
playlist_shuffle(playlist);
|
||||||
else {
|
else {
|
||||||
playlist_goto_entry(playlist, lastSong);
|
playlist_goto_entry(playlist, song_prev);
|
||||||
playlist_skip_next(playlist);
|
playlist_skip_next(playlist);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user