diff options
-rw-r--r-- | apps/bookmark.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c index 0ab78cd83f..5bb87ac25e 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -93,7 +93,7 @@ static char* get_bookmark_info(int list_index, | |||
93 | size_t buffer_len); | 93 | size_t buffer_len); |
94 | static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume); | 94 | static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume); |
95 | static bool system_check(void); | 95 | static bool system_check(void); |
96 | static bool write_bookmark(bool create_bookmark_file); | 96 | static bool write_bookmark(bool create_bookmark_file, char *bookmark); |
97 | static int get_bookmark_count(const char* bookmark_file_name); | 97 | static int get_bookmark_count(const char* bookmark_file_name); |
98 | 98 | ||
99 | static char global_temp_buffer[MAX_PATH+1]; | 99 | static char global_temp_buffer[MAX_PATH+1]; |
@@ -110,7 +110,7 @@ static char global_filename[MAX_PATH]; | |||
110 | /* ----------------------------------------------------------------------- */ | 110 | /* ----------------------------------------------------------------------- */ |
111 | bool bookmark_create_menu(void) | 111 | bool bookmark_create_menu(void) |
112 | { | 112 | { |
113 | write_bookmark(true); | 113 | write_bookmark(true, create_bookmark()); |
114 | return false; | 114 | return false; |
115 | } | 115 | } |
116 | 116 | ||
@@ -162,20 +162,27 @@ bool bookmark_mrb_load() | |||
162 | /* ----------------------------------------------------------------------- */ | 162 | /* ----------------------------------------------------------------------- */ |
163 | bool bookmark_autobookmark(void) | 163 | bool bookmark_autobookmark(void) |
164 | { | 164 | { |
165 | char* bookmark; | ||
165 | if (!system_check()) | 166 | if (!system_check()) |
166 | return false; | 167 | return false; |
167 | 168 | ||
168 | audio_pause(); /* first pause playback */ | 169 | audio_pause(); /* first pause playback */ |
170 | bookmark = create_bookmark(); | ||
171 | /* Workaround for inability to speak when paused: all callers will | ||
172 | just do audio_stop() when we return, so we can do it right | ||
173 | away. This makes it possible to speak the "Create a Bookmark?" | ||
174 | prompt and the "Bookmark Created" splash. */ | ||
175 | audio_stop(); | ||
169 | switch (global_settings.autocreatebookmark) | 176 | switch (global_settings.autocreatebookmark) |
170 | { | 177 | { |
171 | case BOOKMARK_YES: | 178 | case BOOKMARK_YES: |
172 | return write_bookmark(true); | 179 | return write_bookmark(true, bookmark); |
173 | 180 | ||
174 | case BOOKMARK_NO: | 181 | case BOOKMARK_NO: |
175 | return false; | 182 | return false; |
176 | 183 | ||
177 | case BOOKMARK_RECENT_ONLY_YES: | 184 | case BOOKMARK_RECENT_ONLY_YES: |
178 | return write_bookmark(false); | 185 | return write_bookmark(false, bookmark); |
179 | } | 186 | } |
180 | #ifdef HAVE_LCD_BITMAP | 187 | #ifdef HAVE_LCD_BITMAP |
181 | const char *lines[]={ID2P(LANG_AUTO_BOOKMARK_QUERY)}; | 188 | const char *lines[]={ID2P(LANG_AUTO_BOOKMARK_QUERY)}; |
@@ -195,9 +202,9 @@ bool bookmark_autobookmark(void) | |||
195 | if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) | 202 | if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) |
196 | { | 203 | { |
197 | if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) | 204 | if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) |
198 | return write_bookmark(false); | 205 | return write_bookmark(false, bookmark); |
199 | else | 206 | else |
200 | return write_bookmark(true); | 207 | return write_bookmark(true, bookmark); |
201 | } | 208 | } |
202 | return false; | 209 | return false; |
203 | } | 210 | } |
@@ -209,15 +216,9 @@ bool bookmark_autobookmark(void) | |||
209 | /* resume_index*resume_offset*resume_seed*resume_first_index* */ | 216 | /* resume_index*resume_offset*resume_seed*resume_first_index* */ |
210 | /* resume_file*milliseconds*MP3 Title* */ | 217 | /* resume_file*milliseconds*MP3 Title* */ |
211 | /* ------------------------------------------------------------------------*/ | 218 | /* ------------------------------------------------------------------------*/ |
212 | static bool write_bookmark(bool create_bookmark_file) | 219 | static bool write_bookmark(bool create_bookmark_file, char *bookmark) |
213 | { | 220 | { |
214 | bool success=false; | 221 | bool success=false; |
215 | char* bookmark; | ||
216 | |||
217 | if (!system_check()) | ||
218 | return false; /* something didn't happen correctly, do nothing */ | ||
219 | |||
220 | bookmark = create_bookmark(); | ||
221 | if (!bookmark) | 222 | if (!bookmark) |
222 | return false; /* something didn't happen correctly, do nothing */ | 223 | return false; /* something didn't happen correctly, do nothing */ |
223 | 224 | ||
@@ -321,6 +322,9 @@ static char* create_bookmark() | |||
321 | int resume_index = 0; | 322 | int resume_index = 0; |
322 | char *file; | 323 | char *file; |
323 | 324 | ||
325 | if (!system_check()) | ||
326 | return NULL; /* something didn't happen correctly, do nothing */ | ||
327 | |||
324 | /* grab the currently playing track */ | 328 | /* grab the currently playing track */ |
325 | struct mp3entry *id3 = audio_current_track(); | 329 | struct mp3entry *id3 = audio_current_track(); |
326 | if(!id3) | 330 | if(!id3) |