mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Better bookmark resume handling, in particular when resuming a directory. If Load Last Bookmark is set to Yes and the last bookmarked file could not be found, play the selected file instead. When selecting a bookmark for a missing file in the bookmark list, show a message that resume isn't possible (and don't play any selected file if Load Last Bookmark is set to Ask).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16267 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
05e82a45da
commit
04dc828c9f
4 changed files with 31 additions and 19 deletions
|
@ -404,7 +404,16 @@ bool bookmark_autoload(const char* file)
|
||||||
|
|
||||||
if (bookmark != NULL)
|
if (bookmark != NULL)
|
||||||
{
|
{
|
||||||
return play_bookmark(bookmark);
|
if (!play_bookmark(bookmark))
|
||||||
|
{
|
||||||
|
/* Selected bookmark not found. */
|
||||||
|
gui_syncsplash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Act as if autoload was done even if it failed, since the
|
||||||
|
* user did make an active selection.
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -418,7 +427,7 @@ bool bookmark_autoload(const char* file)
|
||||||
bool bookmark_load(const char* file, bool autoload)
|
bool bookmark_load(const char* file, bool autoload)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char* bookmark = NULL;;
|
char* bookmark = NULL;
|
||||||
|
|
||||||
if(autoload)
|
if(autoload)
|
||||||
{
|
{
|
||||||
|
@ -438,7 +447,12 @@ bool bookmark_load(const char* file, bool autoload)
|
||||||
|
|
||||||
if (bookmark != NULL)
|
if (bookmark != NULL)
|
||||||
{
|
{
|
||||||
return play_bookmark(bookmark);
|
if (!play_bookmark(bookmark))
|
||||||
|
{
|
||||||
|
/* Selected bookmark not found. */
|
||||||
|
gui_syncsplash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -875,9 +889,8 @@ static bool play_bookmark(const char* bookmark)
|
||||||
&global_settings.playlist_shuffle,
|
&global_settings.playlist_shuffle,
|
||||||
global_filename))
|
global_filename))
|
||||||
{
|
{
|
||||||
bookmark_play(global_temp_buffer, index, offset, seed,
|
return bookmark_play(global_temp_buffer, index, offset, seed,
|
||||||
global_filename);
|
global_filename);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -27,8 +27,6 @@ bool bookmark_create_menu(void);
|
||||||
bool bookmark_mrb_load(void);
|
bool bookmark_mrb_load(void);
|
||||||
bool bookmark_autoload(const char* file);
|
bool bookmark_autoload(const char* file);
|
||||||
bool bookmark_load(const char* file, bool autoload);
|
bool bookmark_load(const char* file, bool autoload);
|
||||||
void bookmark_play(char* resume_file, int index, int offset, int seed,
|
|
||||||
char *filename);
|
|
||||||
bool bookmark_exist(void);
|
bool bookmark_exist(void);
|
||||||
|
|
||||||
#endif /* __BOOKMARK_H__ */
|
#endif /* __BOOKMARK_H__ */
|
||||||
|
|
23
apps/tree.c
23
apps/tree.c
|
@ -1076,11 +1076,12 @@ void tree_mem_init(void)
|
||||||
tree_get_filetypes(&filetypes, &filetypes_count);
|
tree_get_filetypes(&filetypes, &filetypes_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bookmark_play(char *resume_file, int index, int offset, int seed,
|
bool bookmark_play(char *resume_file, int index, int offset, int seed,
|
||||||
char *filename)
|
char *filename)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char* suffix = strrchr(resume_file, '.');
|
char* suffix = strrchr(resume_file, '.');
|
||||||
|
bool started = false;
|
||||||
|
|
||||||
if (suffix != NULL &&
|
if (suffix != NULL &&
|
||||||
(!strcasecmp(suffix, ".m3u") || !strcasecmp(suffix, ".m3u8")))
|
(!strcasecmp(suffix, ".m3u") || !strcasecmp(suffix, ".m3u8")))
|
||||||
|
@ -1090,7 +1091,7 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
|
||||||
/* check that the file exists */
|
/* check that the file exists */
|
||||||
int fd = open(resume_file, O_RDONLY);
|
int fd = open(resume_file, O_RDONLY);
|
||||||
if(fd<0)
|
if(fd<0)
|
||||||
return;
|
return false;
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
slash = strrchr(resume_file,'/');
|
slash = strrchr(resume_file,'/');
|
||||||
|
@ -1108,6 +1109,7 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
|
||||||
if (global_settings.playlist_shuffle)
|
if (global_settings.playlist_shuffle)
|
||||||
playlist_shuffle(seed, -1);
|
playlist_shuffle(seed, -1);
|
||||||
playlist_start(index,offset);
|
playlist_start(index,offset);
|
||||||
|
started = true;
|
||||||
}
|
}
|
||||||
*slash='/';
|
*slash='/';
|
||||||
}
|
}
|
||||||
|
@ -1128,7 +1130,7 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
|
||||||
peek_filename = playlist_peek(index);
|
peek_filename = playlist_peek(index);
|
||||||
|
|
||||||
if (peek_filename == NULL)
|
if (peek_filename == NULL)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (strcmp(strrchr(peek_filename, '/') + 1, filename))
|
if (strcmp(strrchr(peek_filename, '/') + 1, filename))
|
||||||
{
|
{
|
||||||
|
@ -1137,7 +1139,7 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
|
||||||
peek_filename = playlist_peek(i);
|
peek_filename = playlist_peek(i);
|
||||||
|
|
||||||
if (peek_filename == NULL)
|
if (peek_filename == NULL)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (!strcmp(strrchr(peek_filename, '/') + 1, filename))
|
if (!strcmp(strrchr(peek_filename, '/') + 1, filename))
|
||||||
break;
|
break;
|
||||||
|
@ -1145,19 +1147,16 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
|
||||||
if (i < playlist_amount())
|
if (i < playlist_amount())
|
||||||
index = i;
|
index = i;
|
||||||
else
|
else
|
||||||
{
|
return false;
|
||||||
/* File not found, so bail out. Maybe not the best
|
|
||||||
* message; perhaps "Bookmarked file not found"?
|
|
||||||
*/
|
|
||||||
gui_syncsplash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
playlist_start(index,offset);
|
playlist_start(index,offset);
|
||||||
|
started = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
start_wps=true;
|
if (started)
|
||||||
|
start_wps = true;
|
||||||
|
return started;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void say_filetype(int attr)
|
static void say_filetype(int attr)
|
||||||
|
|
|
@ -82,6 +82,8 @@ struct tree_context* tree_get_context(void);
|
||||||
void tree_flush(void);
|
void tree_flush(void);
|
||||||
void tree_restore(void);
|
void tree_restore(void);
|
||||||
|
|
||||||
|
bool bookmark_play(char* resume_file, int index, int offset, int seed,
|
||||||
|
char *filename);
|
||||||
|
|
||||||
extern struct gui_synclist tree_lists;
|
extern struct gui_synclist tree_lists;
|
||||||
extern struct gui_syncstatusbar statusbars;
|
extern struct gui_syncstatusbar statusbars;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue