diff options
author | Max Kellermann <max@duempel.org> | 2012-02-12 19:45:13 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-02-12 19:48:02 +0100 |
commit | f8eece22c81f75206f938526994f87b6091fcf3d (patch) | |
tree | 73599c43d9cbabe6da5dcd52c17a44b94a78c60e /src/playlist | |
parent | df563db29406ee47a9d45ae5a01ef03cc52be478 (diff) | |
download | mpd-f8eece22c81f75206f938526994f87b6091fcf3d.tar.gz mpd-f8eece22c81f75206f938526994f87b6091fcf3d.tar.xz mpd-f8eece22c81f75206f938526994f87b6091fcf3d.zip |
playlist/embcue: ignore "FILE", always point to container song file
An embedded CUE sheet must always point to the song file it is
contained in.
Diffstat (limited to '')
-rw-r--r-- | src/playlist/embcue_playlist_plugin.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/playlist/embcue_playlist_plugin.c b/src/playlist/embcue_playlist_plugin.c index b05b98e49..6d9a957f9 100644 --- a/src/playlist/embcue_playlist_plugin.c +++ b/src/playlist/embcue_playlist_plugin.c @@ -45,6 +45,13 @@ struct embcue_playlist { struct playlist_provider base; /** + * This is an override for the CUE's "FILE". An embedded CUE + * sheet must always point to the song file it is contained + * in. + */ + char *filename; + + /** * The value of the file's "CUESHEET" tag. */ char *cuesheet; @@ -97,6 +104,8 @@ embcue_playlist_open_uri(const char *uri, return NULL; } + playlist->filename = g_path_get_basename(uri); + playlist->next = playlist->cuesheet; playlist->parser = cue_parser_new(); @@ -110,6 +119,7 @@ embcue_playlist_close(struct playlist_provider *_playlist) cue_parser_free(playlist->parser); g_free(playlist->cuesheet); + g_free(playlist->filename); g_free(playlist); } @@ -137,11 +147,14 @@ embcue_playlist_read(struct playlist_provider *_playlist) cue_parser_feed(playlist->parser, line); song = cue_parser_get(playlist->parser); if (song != NULL) - return song; + return song_replace_uri(song, playlist->filename); } cue_parser_finish(playlist->parser); - return cue_parser_get(playlist->parser); + song = cue_parser_get(playlist->parser); + if (song != NULL) + song = song_replace_uri(song, playlist->filename); + return song; } static const char *const embcue_playlist_suffixes[] = { |