Skip to content

Commit

Permalink
Option to resume from recent bookmark
Browse files Browse the repository at this point in the history
Change-Id: I23443cde26d259e9b05f5e268c123e42af169863
  • Loading branch information
bahusoid committed Mar 6, 2024
1 parent b51c44d commit c7c2d4a
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 3 deletions.
6 changes: 6 additions & 0 deletions apps/bookmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ static char* get_mrb_path(char* dirbuf, int dirbuf_sz)
return dirbuf;
}

bool bookmark_mrb_autoload()
{
char max_path[MAX_PATH];
return bookmark_load(get_mrb_path(max_path, MAX_PATH), true);
}

/* ----------------------------------------------------------------------- */
/* Gives the user a list of the Most Recent Bookmarks. This is an */
/* interface function */
Expand Down
1 change: 1 addition & 0 deletions apps/bookmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ int bookmark_load_menu(void);
bool bookmark_autobookmark(bool prompt_ok);
bool bookmark_create_menu(void);
bool bookmark_mrb_load(void);
bool bookmark_mrb_autoload(void);
int bookmark_autoload(const char* file);
bool bookmark_load(const char* file, bool autoload);
bool bookmark_exists(void);
Expand Down
14 changes: 14 additions & 0 deletions apps/lang/english.lang
Original file line number Diff line number Diff line change
Expand Up @@ -16641,3 +16641,17 @@
*: "Go to Last Album"
</voice>
</phrase>
<phrase>
id: LANG_BOOKMARK_SETTINGS_RESUME_RECENT_BOOKMARK
desc: prompt for user to decide whether to resume playback from recent bookmark instead of playlist_control file
user: core
<source>
*: "Resume Recent Bookmark"
</source>
<dest>
*: "Resume Recent Bookmark"
</dest>
<voice>
*: "Resume Recent Bookmark"
</voice>
</phrase>
3 changes: 2 additions & 1 deletion apps/menus/settings_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,10 @@ MENUITEM_SETTING(autocreatebookmark,
MENUITEM_SETTING(autoupdatebookmark, &global_settings.autoupdatebookmark, NULL);
MENUITEM_SETTING(autoloadbookmark, &global_settings.autoloadbookmark, NULL);
MENUITEM_SETTING(usemrb, &global_settings.usemrb, NULL);
MENUITEM_SETTING(resume_mrb, &global_settings.resume_from_recent_bookmark, NULL);
MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
Icon_Bookmark,
&autocreatebookmark, &autoupdatebookmark, &autoloadbookmark, &usemrb);
&autocreatebookmark, &autoupdatebookmark, &autoloadbookmark, &usemrb, &resume_mrb);
/* BOOKMARK MENU */
/***********************************/

Expand Down
4 changes: 4 additions & 0 deletions apps/root_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ static int wpsscrn(void* param)
talk_shutup();
ret_val = gui_wps_show();
}
else if (global_settings.resume_from_recent_bookmark && global_settings.usemrb && bookmark_mrb_autoload())
{
ret_val = gui_wps_show();
}
else if ( global_status.resume_index != -1 )
{
DEBUGF("Resume index %X crc32 %lX offset %lX\n",
Expand Down
4 changes: 2 additions & 2 deletions apps/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ struct user_settings
bool autoupdatebookmark;/* auto update option */
int usemrb; /* use MRB list: 0=No, 1=Yes, 2=One per playlist,
3=One per playlist and track */

bool resume_from_recent_bookmark;
#ifdef HAVE_DIRCACHE
bool dircache; /* enable directory cache */
#endif
Expand Down Expand Up @@ -652,7 +652,7 @@ struct user_settings
bool spdif_enable; /* S/PDIF power on/off */
#endif
#ifdef HAVE_USB_CHARGING_ENABLE
int usb_charging;
int usb_charging;
#endif
/* device settings */
#ifdef HAVE_LCD_CONTRAST
Expand Down
2 changes: 2 additions & 0 deletions apps/settings_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,8 @@ const struct settings_list settings[] = {
ID2P(LANG_SET_BOOL_YES),
ID2P(LANG_BOOKMARK_SETTINGS_ONE_PER_PLAYLIST),
ID2P(LANG_BOOKMARK_SETTINGS_ONE_PER_TRACK)),
OFFON_SETTING(0, resume_from_recent_bookmark, LANG_BOOKMARK_SETTINGS_RESUME_RECENT_BOOKMARK,
false, "resume most-recent-bookmark", NULL),
/* peak meter */
TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS, peak_meter_clip_hold,
LANG_PM_CLIP_HOLD, 60, "peak meter clip hold", "eternal",
Expand Down

0 comments on commit c7c2d4a

Please sign in to comment.