Provide the option to automatically update existing bookmark files on stop, without creating ones that don't already exist.

Idea from FS#6272, but implemented differently. If you set "Update on stop" then it will check if the bookmark file exists on stop, and if so, write a new one without prompting. If the file doesn't exist, it will do whatever the "Bookmark on stop" setting tells it to do.

This works quite well if you have an audiobook/podcast/etc folder/playlist: just bookmark it manually once and it will get bookmarked automatically after that, without creating bookmarks for regular music.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27294 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Torne Wuff 2010-07-05 16:39:00 +00:00
parent d265bcf965
commit db1b823ac3
5 changed files with 24 additions and 1 deletions

View file

@ -166,16 +166,21 @@ bool bookmark_mrb_load()
bool bookmark_autobookmark(bool prompt_ok)
{
char* bookmark;
bool update = false;
if (!system_check())
return false;
audio_pause(); /* first pause playback */
if (global_settings.autoupdatebookmark && bookmark_exist())
update = true;
bookmark = create_bookmark();
/* Workaround for inability to speak when paused: all callers will
just do audio_stop() when we return, so we can do it right
away. This makes it possible to speak the "Create a Bookmark?"
prompt and the "Bookmark Created" splash. */
audio_stop();
if (update)
return write_bookmark(true, bookmark);
switch (global_settings.autocreatebookmark)
{
case BOOKMARK_YES:

View file

@ -12605,3 +12605,17 @@
touchscreen: "Cancel"
</voice>
</phrase>
<phrase>
id: LANG_BOOKMARK_SETTINGS_AUTOUPDATE
desc: prompt for user to decide whether to update bookmarks
user: core
<source>
*: "Update on Stop"
</source>
<dest>
*: "Update on Stop"
</dest>
<voice>
*: "Update on Stop"
</voice>
</phrase>

View file

@ -347,11 +347,12 @@ static int bmark_callback(int action,const struct menu_item_ex *this_item)
}
MENUITEM_SETTING(autocreatebookmark,
&global_settings.autocreatebookmark, bmark_callback);
MENUITEM_SETTING(autoupdatebookmark, &global_settings.autoupdatebookmark, NULL);
MENUITEM_SETTING(autoloadbookmark, &global_settings.autoloadbookmark, NULL);
MENUITEM_SETTING(usemrb, &global_settings.usemrb, NULL);
MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
Icon_Bookmark,
&autocreatebookmark, &autoloadbookmark, &usemrb);
&autocreatebookmark, &autoupdatebookmark, &autoloadbookmark, &usemrb);
/* BOOKMARK MENU */
/***********************************/

View file

@ -604,6 +604,7 @@ struct user_settings
/* auto bookmark settings */
int autoloadbookmark; /* auto load option: 0=off, 1=ask, 2=on */
int autocreatebookmark; /* auto create option: 0=off, 1=ask, 2=on */
bool autoupdatebookmark;/* auto update option */
int usemrb; /* use MRB list: 0=No, 1=Yes*/
#ifdef HAVE_DIRCACHE

View file

@ -989,6 +989,8 @@ const struct settings_list settings[] = {
ID2P(LANG_SET_BOOL_NO), ID2P(LANG_SET_BOOL_YES),
ID2P(LANG_ASK), ID2P(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_YES),
ID2P(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_ASK)),
OFFON_SETTING(0, autoupdatebookmark, LANG_BOOKMARK_SETTINGS_AUTOUPDATE,
false, "autoupdate bookmarks", NULL),
CHOICE_SETTING(0, autoloadbookmark, LANG_BOOKMARK_SETTINGS_AUTOLOAD,
BOOKMARK_NO, "autoload bookmarks", off_on_ask, NULL, 3,
ID2P(LANG_SET_BOOL_NO), ID2P(LANG_SET_BOOL_YES),