summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-12-07 14:20:37 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-12-07 14:20:37 +0000
commit8f032aed52c08a22f238e91bbcafd12a637c3326 (patch)
tree0150e6977769b4c122b9ac20222f5f825d4089c2 /apps/tree.c
parentdc96fcfb0e8690216638bc781da2bf4ae21fe374 (diff)
downloadrockbox-8f032aed52c08a22f238e91bbcafd12a637c3326.zip
rockbox-8f032aed52c08a22f238e91bbcafd12a637c3326.tar.gz
rockbox-8f032aed52c08a22f238e91bbcafd12a637c3326.tar.bz2
rockbox-8f032aed52c08a22f238e91bbcafd12a637c3326.tar.xz
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
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/apps/tree.c b/apps/tree.c
index cf12c4a..87a0392 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);
}
}