From 8f032aed52c08a22f238e91bbcafd12a637c3326 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Tue, 7 Dec 2004 14:20:37 +0000 Subject: Patch #911756 by Steve Cundari, bookmark follows repositioned MP3 file git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5481 a1c6a512-1295-4272-9138-f99709370657 --- apps/tree.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'apps/tree.c') diff --git a/apps/tree.c b/apps/tree.c index cf12c4abc2..87a039223e 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -1795,12 +1795,15 @@ void tree_init(void) dircache = buffer_alloc(max_files_in_dir * sizeof(struct entry)); } -void bookmark_play(char *resume_file, int index, int offset, int seed) +void bookmark_play(char *resume_file, int index, int offset, int seed, + char *filename) { + int i; int len=strlen(resume_file); if (!strcasecmp(&resume_file[len-4], ".m3u")) { + /* Playlist playback */ char* slash; // check that the file exists int fd = open(resume_file, O_RDONLY); @@ -1829,12 +1832,30 @@ void bookmark_play(char *resume_file, int index, int offset, int seed) } else { + /* Directory playback */ lastdir[0]='\0'; if (playlist_create(resume_file, NULL) != -1) { resume_directory(resume_file); if (global_settings.playlist_shuffle) playlist_shuffle(seed, -1); + + /* Check if the file is at the same spot in the directory, + else search for it */ + if ((strcmp(strrchr(playlist_peek(index) + 1,'/') + 1, + filename))) + { + for ( i=0; i < playlist_amount(); i++ ) + { + if ((strcmp(strrchr(playlist_peek(i) + 1,'/') + 1, + filename)) == 0) + break; + } + if (i < playlist_amount()) + index = i; + else + return; + } playlist_start(index,offset); } } -- cgit v1.2.3