Hi, I tried the latest git version to test out the new cuesheet support. I've attached two patches which fixes some issues I encountered.
The first one fixes a segfault which occured when reading an invalid cuesheet. The second one fixes an issue where I could not play the last track in the cuesheet, by setting the correct end_ms and track time. - Jon Bergli Heier
From f4d1ff9d8247667fcd92cd3af940676c6930d46d Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier <snakeb...@jvnv.net> Date: Sat, 2 Jan 2010 03:36:22 +0100 Subject: [PATCH 1/2] Fix segfault in cue_playlist_plugin.c Signed-off-by: Jon Bergli Heier <snakeb...@jvnv.net> --- src/playlist/cue_playlist_plugin.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/playlist/cue_playlist_plugin.c b/src/playlist/cue_playlist_plugin.c index 4dd5a7c..f41776b 100644 --- a/src/playlist/cue_playlist_plugin.c +++ b/src/playlist/cue_playlist_plugin.c @@ -93,7 +93,7 @@ cue_playlist_read(struct playlist_provider *_playlist) ++playlist->next; filename = track_get_filename(track); - if (*filename == 0 || filename[0] == '.' || + if (filename == NULL || *filename == 0 || filename[0] == '.' || strchr(filename, '/') != NULL) { /* unsafe characters found, bail out */ tag_free(tag); -- 1.6.6
From 1ebbb0cb1a6b9a77957b9a5e92fe6eab8ab8e003 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier <snakeb...@jvnv.net> Date: Sat, 2 Jan 2010 04:49:52 +0100 Subject: [PATCH 2/2] Fix playing last track in cue sheet. Signed-off-by: Jon Bergli Heier <snakeb...@jvnv.net> --- src/playlist/cue_playlist_plugin.c | 33 +++++++++++++++++++++++++++++++-- 1 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/playlist/cue_playlist_plugin.c b/src/playlist/cue_playlist_plugin.c index f41776b..d2fc3e9 100644 --- a/src/playlist/cue_playlist_plugin.c +++ b/src/playlist/cue_playlist_plugin.c @@ -38,6 +38,8 @@ struct cue_playlist { struct Cd *cd; unsigned next; + + char *uri; }; static struct playlist_provider * @@ -60,6 +62,7 @@ cue_playlist_open_uri(const char *uri) playlist_provider_init(&playlist->base, &cue_playlist_plugin); playlist->cd = cd; playlist->next = 1; + playlist->uri = g_strdup(uri); return &playlist->base; } @@ -70,17 +73,30 @@ cue_playlist_close(struct playlist_provider *_playlist) struct cue_playlist *playlist = (struct cue_playlist *)_playlist; cd_delete(playlist->cd); + g_free(playlist->uri); g_free(playlist); } +static char *cue_get_track_filename(struct cue_playlist *playlist, char *filename) { + char *temp, *dirname; + + dirname = g_path_get_dirname(playlist->uri); + + temp = g_build_filename(dirname, filename, NULL); + + g_free(dirname); + + return temp; +} + static struct song * cue_playlist_read(struct playlist_provider *_playlist) { struct cue_playlist *playlist = (struct cue_playlist *)_playlist; struct Track *track; struct tag *tag; - const char *filename; - struct song *song; + const char *filename, *tempname; + struct song *song, *tempsong; track = cd_get_track(playlist->cd, playlist->next); if (track == NULL) @@ -106,6 +122,19 @@ cue_playlist_read(struct playlist_provider *_playlist) song->end_ms = ((track_get_start(track) + track_get_length(track)) * 1000) / 75; + if(song->start_ms == song->end_ms) { + tempname = cue_get_track_filename(playlist, filename); + tempsong = song_file_load(tempname, NULL); + + if(tempsong) { + song->end_ms = (unsigned)(song_get_duration(tempsong)*1000); + song->tag->time = (song->end_ms - song->start_ms) / 1000; + song_free(tempsong); + } + + g_free(tempname); + } + return song; } -- 1.6.6
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team