1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C)2003 by Benjamin Metzler
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
17 ****************************************************************************/
24 #include "applimits.h"
55 #if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
59 #define MAX_BOOKMARKS 10
60 #define MAX_BOOKMARK_SIZE 350
61 #define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark"
63 /* Used to buffer bookmarks while displaying the bookmark list. */
71 bool show_dont_resume
;
76 static bool add_bookmark(const char* bookmark_file_name
, const char* bookmark
,
78 static bool check_bookmark(const char* bookmark
);
79 static char* create_bookmark(void);
80 static bool delete_bookmark(const char* bookmark_file_name
, int bookmark_id
);
81 static void say_bookmark(const char* bookmark
,
83 static bool play_bookmark(const char* bookmark
);
84 static bool generate_bookmark_file_name(const char *in
);
85 static const char* skip_token(const char* s
);
86 static const char* int_token(const char* s
, int* dest
);
87 static const char* long_token(const char* s
, long* dest
);
88 static const char* bool_token(const char* s
, bool* dest
);
89 static bool parse_bookmark(const char *bookmark
,
93 int *resume_first_index
,
95 unsigned int resume_file_size
,
100 static int buffer_bookmarks(struct bookmark_list
* bookmarks
, int first_line
);
101 static char* get_bookmark_info(int list_index
, void* data
, char *buffer
);
102 static char* select_bookmark(const char* bookmark_file_name
, bool show_dont_resume
);
103 static bool system_check(void);
104 static bool write_bookmark(bool create_bookmark_file
);
105 static int get_bookmark_count(const char* bookmark_file_name
);
107 static char global_temp_buffer
[MAX_PATH
+1];
108 /* File name created by generate_bookmark_file_name */
109 static char global_bookmark_file_name
[MAX_PATH
];
110 static char global_read_buffer
[MAX_BOOKMARK_SIZE
];
111 /* Bookmark created by create_bookmark*/
112 static char global_bookmark
[MAX_BOOKMARK_SIZE
];
113 /* Filename from parsed bookmark (can be made local where needed) */
114 static char global_filename
[MAX_PATH
];
116 /* ----------------------------------------------------------------------- */
117 /* This is the interface function from the main menu. */
118 /* ----------------------------------------------------------------------- */
119 bool bookmark_create_menu(void)
121 write_bookmark(true);
125 /* ----------------------------------------------------------------------- */
126 /* This function acts as the load interface from the main menu */
127 /* This function determines the bookmark file name and then loads that file*/
128 /* for the user. The user can then select a bookmark to load. */
129 /* If no file/directory is currently playing, the menu item does not work. */
130 /* ----------------------------------------------------------------------- */
131 bool bookmark_load_menu(void)
135 char* name
= playlist_get_name(NULL
, global_temp_buffer
,
136 sizeof(global_temp_buffer
));
137 if (generate_bookmark_file_name(name
))
139 char* bookmark
= select_bookmark(global_bookmark_file_name
, false);
141 if (bookmark
!= NULL
)
143 return play_bookmark(bookmark
);
151 /* ----------------------------------------------------------------------- */
152 /* Gives the user a list of the Most Recent Bookmarks. This is an */
153 /* interface function */
154 /* ----------------------------------------------------------------------- */
155 bool bookmark_mrb_load()
157 char* bookmark
= select_bookmark(RECENT_BOOKMARK_FILE
, false);
159 if (bookmark
!= NULL
)
161 return play_bookmark(bookmark
);
167 /* ----------------------------------------------------------------------- */
168 /* This function handles an autobookmark creation. This is an interface */
170 /* ----------------------------------------------------------------------- */
171 bool bookmark_autobookmark(void)
176 audio_pause(); /* first pause playback */
177 switch (global_settings
.autocreatebookmark
)
180 return write_bookmark(true);
185 case BOOKMARK_RECENT_ONLY_YES
:
186 return write_bookmark(false);
188 #ifdef HAVE_LCD_BITMAP
189 unsigned char *lines
[]={str(LANG_AUTO_BOOKMARK_QUERY
)};
190 struct text_message message
={(char **)lines
, 1};
192 unsigned char *lines
[]={str(LANG_AUTO_BOOKMARK_QUERY
),
193 str(LANG_RESUME_CONFIRM_PLAYER
)};
194 struct text_message message
={(char **)lines
, 2};
197 show_main_backdrop(); /* switch to main backdrop as we may come from wps */
199 #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
200 show_remote_main_backdrop();
202 gui_syncstatusbar_draw(&statusbars
, false);
203 if(gui_syncyesno_run(&message
, NULL
, NULL
)==YESNO_YES
)
205 if (global_settings
.autocreatebookmark
== BOOKMARK_RECENT_ONLY_ASK
)
206 return write_bookmark(false);
208 return write_bookmark(true);
213 /* ----------------------------------------------------------------------- */
214 /* This function takes the current current resume information and writes */
215 /* that to the beginning of the bookmark file. */
216 /* This file will contain N number of bookmarks in the following format: */
217 /* resume_index*resume_offset*resume_seed*resume_first_index* */
218 /* resume_file*milliseconds*MP3 Title* */
219 /* ------------------------------------------------------------------------*/
220 static bool write_bookmark(bool create_bookmark_file
)
226 return false; /* something didn't happen correctly, do nothing */
228 bookmark
= create_bookmark();
230 return false; /* something didn't happen correctly, do nothing */
232 if (global_settings
.usemrb
)
233 success
= add_bookmark(RECENT_BOOKMARK_FILE
, bookmark
, true);
236 /* writing the bookmark */
237 if (create_bookmark_file
)
239 char* name
= playlist_get_name(NULL
, global_temp_buffer
,
240 sizeof(global_temp_buffer
));
241 if (generate_bookmark_file_name(name
))
243 success
= add_bookmark(global_bookmark_file_name
, bookmark
, false);
247 gui_syncsplash(HZ
, str(success
? LANG_BOOKMARK_CREATE_SUCCESS
248 : LANG_BOOKMARK_CREATE_FAILURE
));
253 /* ----------------------------------------------------------------------- */
254 /* This function adds a bookmark to a file. */
255 /* ------------------------------------------------------------------------*/
256 static bool add_bookmark(const char* bookmark_file_name
, const char* bookmark
,
259 int temp_bookmark_file
= 0;
260 int bookmark_file
= 0;
261 int bookmark_count
= 0;
262 char* playlist
= NULL
;
268 /* Opening up a temp bookmark file */
269 snprintf(global_temp_buffer
, sizeof(global_temp_buffer
),
270 "%s.tmp", bookmark_file_name
);
271 temp_bookmark_file
= open(global_temp_buffer
,
272 O_WRONLY
| O_CREAT
| O_TRUNC
);
273 if (temp_bookmark_file
< 0)
274 return false; /* can't open the temp file */
276 if (most_recent
&& (global_settings
.usemrb
== BOOKMARK_UNIQUE_ONLY
))
278 playlist
= strchr(bookmark
,'/');
279 cp
= strrchr(bookmark
,';');
284 /* Writing the new bookmark to the begining of the temp file */
285 write(temp_bookmark_file
, bookmark
, strlen(bookmark
));
286 write(temp_bookmark_file
, "\n", 1);
289 /* Reading in the previous bookmarks and writing them to the temp file */
290 bookmark_file
= open(bookmark_file_name
, O_RDONLY
);
291 if (bookmark_file
>= 0)
293 while (read_line(bookmark_file
, global_read_buffer
,
294 sizeof(global_read_buffer
)) > 0)
296 /* The MRB has a max of MAX_BOOKMARKS in it */
297 /* This keeps it from getting too large */
298 if (most_recent
&& (bookmark_count
>= MAX_BOOKMARKS
))
301 cp
= strchr(global_read_buffer
,'/');
302 tmp
= strrchr(global_read_buffer
,';');
303 if (check_bookmark(global_read_buffer
) &&
304 (!unique
|| len
!= tmp
-cp
|| strncmp(playlist
,cp
,len
)))
307 write(temp_bookmark_file
, global_read_buffer
,
308 strlen(global_read_buffer
));
309 write(temp_bookmark_file
, "\n", 1);
312 close(bookmark_file
);
314 close(temp_bookmark_file
);
316 remove(bookmark_file_name
);
317 rename(global_temp_buffer
, bookmark_file_name
);
323 /* ----------------------------------------------------------------------- */
324 /* This function takes the system resume data and formats it into a valid */
326 /* ----------------------------------------------------------------------- */
327 static char* create_bookmark()
329 int resume_index
= 0;
332 /* grab the currently playing track */
333 struct mp3entry
*id3
= audio_current_track();
337 /* Get some basic resume information */
338 /* queue_resume and queue_resume_index are not used and can be ignored.*/
339 playlist_get_resume_info(&resume_index
);
341 /* Get the currently playing file minus the path */
342 /* This is used when displaying the available bookmarks */
343 file
= strrchr(id3
->path
,'/');
347 /* create the bookmark */
348 snprintf(global_bookmark
, sizeof(global_bookmark
),
349 "%d;%ld;%d;%d;%ld;%d;%d;%s;%s",
352 playlist_get_seed(NULL
),
355 global_settings
.repeat_mode
,
356 global_settings
.playlist_shuffle
,
357 playlist_get_name(NULL
, global_temp_buffer
,
358 sizeof(global_temp_buffer
)),
361 /* checking to see if the bookmark is valid */
362 if (check_bookmark(global_bookmark
))
363 return global_bookmark
;
368 static bool check_bookmark(const char* bookmark
)
370 return parse_bookmark(bookmark
,
371 NULL
,NULL
,NULL
, NULL
,
376 /* ----------------------------------------------------------------------- */
377 /* This function will determine if an autoload is necessary. This is an */
378 /* interface function. */
379 /* ------------------------------------------------------------------------*/
380 bool bookmark_autoload(const char* file
)
384 if(global_settings
.autoloadbookmark
== BOOKMARK_NO
)
387 /*Checking to see if a bookmark file exists.*/
388 if(!generate_bookmark_file_name(file
))
392 fd
= open(global_bookmark_file_name
, O_RDONLY
);
396 if(global_settings
.autoloadbookmark
== BOOKMARK_YES
)
398 return bookmark_load(global_bookmark_file_name
, true);
402 char* bookmark
= select_bookmark(global_bookmark_file_name
, true);
406 return bookmark_load(global_bookmark_file_name
, true);
413 /* ----------------------------------------------------------------------- */
414 /* This function loads the bookmark information into the resume memory. */
415 /* This is an interface function. */
416 /* ------------------------------------------------------------------------*/
417 bool bookmark_load(const char* file
, bool autoload
)
420 char* bookmark
= NULL
;;
424 fd
= open(file
, O_RDONLY
);
427 if(read_line(fd
, global_read_buffer
, sizeof(global_read_buffer
)) > 0)
428 bookmark
=global_read_buffer
;
434 /* This is not an auto-load, so list the bookmarks */
435 bookmark
= select_bookmark(file
, false);
438 if (bookmark
!= NULL
)
440 return play_bookmark(bookmark
);
447 static int get_bookmark_count(const char* bookmark_file_name
)
450 int file
= open(bookmark_file_name
, O_RDONLY
);
455 /* Get the requested bookmark */
456 while(read_line(file
, global_read_buffer
, sizeof(global_read_buffer
)) > 0)
465 static int buffer_bookmarks(struct bookmark_list
* bookmarks
, int first_line
)
467 char* dest
= ((char*) bookmarks
) + bookmarks
->buffer_size
- 1;
469 int file
= open(bookmarks
->filename
, O_RDONLY
);
476 if ((first_line
!= 0) && ((size_t) filesize(file
) < bookmarks
->buffer_size
477 - sizeof(*bookmarks
) - (sizeof(char*) * bookmarks
->total_count
)))
479 /* Entire file fits in buffer */
483 bookmarks
->start
= first_line
;
484 bookmarks
->count
= 0;
485 bookmarks
->reload
= false;
487 while(read_line(file
, global_read_buffer
, sizeof(global_read_buffer
)) > 0)
491 if (read_count
>= first_line
)
493 dest
-= strlen(global_read_buffer
) + 1;
495 if (dest
< ((char*) bookmarks
) + sizeof(*bookmarks
)
496 + (sizeof(char*) * (bookmarks
->count
+ 1)))
501 strcpy(dest
, global_read_buffer
);
502 bookmarks
->items
[bookmarks
->count
] = dest
;
508 return bookmarks
->start
+ bookmarks
->count
;
511 static char* get_bookmark_info(int list_index
, void* data
, char *buffer
)
513 struct bookmark_list
* bookmarks
= (struct bookmark_list
*) data
;
514 int index
= list_index
/ 2;
515 int resume_index
= 0;
516 long resume_time
= 0;
517 bool shuffle
= false;
519 if (bookmarks
->show_dont_resume
)
523 return list_index
% 2 == 0
524 ? (char*) str(LANG_BOOKMARK_DONT_RESUME
) : " ";
530 if (bookmarks
->reload
|| (index
>= bookmarks
->start
+ bookmarks
->count
)
531 || (index
< bookmarks
->start
))
533 int read_index
= index
;
535 /* Using count as a guide on how far to move could possibly fail
536 * sometimes. Use byte count if that is a problem?
541 /* Move count * 3 / 4 items in the direction the user is moving,
542 * but don't go too close to the end.
544 int offset
= bookmarks
->count
;
545 int max
= bookmarks
->total_count
- (bookmarks
->count
/ 2);
547 if (read_index
< bookmarks
->start
)
552 read_index
= index
- offset
/ 4;
554 if (read_index
> max
)
565 if (buffer_bookmarks(bookmarks
, read_index
) <= index
)
571 if (!parse_bookmark(bookmarks
->items
[index
- bookmarks
->start
],
572 &resume_index
, NULL
, NULL
, NULL
, NULL
, 0, &resume_time
, NULL
,
573 &shuffle
, global_filename
))
575 return list_index
% 2 == 0 ? (char*) str(LANG_BOOKMARK_INVALID
) : " ";
578 if (list_index
% 2 == 0)
580 char* dot
= strrchr(global_filename
, '.');
587 return global_filename
;
593 format_time(time_buf
, sizeof(time_buf
), resume_time
);
594 snprintf(buffer
, MAX_PATH
, "%s, %d%s", time_buf
, resume_index
+ 1,
595 shuffle
? (char*) str(LANG_BOOKMARK_SHUFFLE
) : "");
600 /* ----------------------------------------------------------------------- */
601 /* This displays a the bookmarks in a file and allows the user to */
602 /* select one to play. */
603 /* ------------------------------------------------------------------------*/
604 static char* select_bookmark(const char* bookmark_file_name
, bool show_dont_resume
)
606 struct bookmark_list
* bookmarks
;
607 struct gui_synclist list
;
615 bookmarks
= plugin_get_buffer(&size
);
616 bookmarks
->buffer_size
= size
;
617 bookmarks
->show_dont_resume
= show_dont_resume
;
618 bookmarks
->filename
= bookmark_file_name
;
619 bookmarks
->start
= 0;
620 gui_synclist_init(&list
, &get_bookmark_info
, (void*) bookmarks
, false, 2);
621 gui_synclist_set_title(&list
, str(LANG_BOOKMARK_SELECT_BOOKMARK
),
623 gui_syncstatusbar_draw(&statusbars
, true);
627 gui_syncstatusbar_draw(&statusbars
, false);
631 int count
= get_bookmark_count(bookmark_file_name
);
632 bookmarks
->total_count
= count
;
634 if (bookmarks
->total_count
< 1)
636 /* No more bookmarks, delete file and exit */
637 gui_syncsplash(HZ
, str(LANG_BOOKMARK_LOAD_EMPTY
));
638 remove(bookmark_file_name
);
642 if (bookmarks
->show_dont_resume
)
648 gui_synclist_set_nb_items(&list
, count
* 2);
652 /* Selected item has been deleted */
654 gui_synclist_select_item(&list
, item
* 2);
657 buffer_bookmarks(bookmarks
, bookmarks
->start
);
658 gui_synclist_draw(&list
);
662 action
= get_action(CONTEXT_BOOKMARKSCREEN
, HZ
/ 2);
663 gui_synclist_do_button(&list
, action
, LIST_WRAP_UNLESS_HELD
);
664 item
= gui_synclist_get_sel_pos(&list
) / 2;
666 if (bookmarks
->show_dont_resume
)
671 if (item
!= last_item
&& talk_menus_enabled())
677 talk_id(LANG_BOOKMARK_DONT_RESUME
, true);
681 say_bookmark(bookmarks
->items
[item
- bookmarks
->start
], item
);
685 if (action
== ACTION_STD_CONTEXT
)
687 MENUITEM_STRINGLIST(menu_items
, ID2P(LANG_BOOKMARK_CONTEXT_MENU
),
688 NULL
, ID2P(LANG_BOOKMARK_CONTEXT_RESUME
),
689 ID2P(LANG_BOOKMARK_CONTEXT_DELETE
));
690 static const int menu_actions
[] =
692 ACTION_STD_OK
, ACTION_BMS_DELETE
694 int selection
= do_menu(&menu_items
, NULL
);
698 if (selection
>= 0 && selection
<=
699 (int) (sizeof(menu_actions
) / sizeof(menu_actions
[0])))
701 action
= menu_actions
[selection
];
710 return bookmarks
->items
[item
- bookmarks
->start
];
713 /* Else fall through */
715 case ACTION_TREE_WPS
:
716 case ACTION_STD_CANCEL
:
720 case ACTION_BMS_DELETE
:
723 delete_bookmark(bookmark_file_name
, item
);
724 bookmarks
->reload
= true;
731 if (default_event_handler(action
) == SYS_USB_CONNECTED
)
743 /* ----------------------------------------------------------------------- */
744 /* This function takes a location in a bookmark file and deletes that */
746 /* ------------------------------------------------------------------------*/
747 static bool delete_bookmark(const char* bookmark_file_name
, int bookmark_id
)
749 int temp_bookmark_file
= 0;
750 int bookmark_file
= 0;
751 int bookmark_count
= 0;
753 /* Opening up a temp bookmark file */
754 snprintf(global_temp_buffer
, sizeof(global_temp_buffer
),
755 "%s.tmp", bookmark_file_name
);
756 temp_bookmark_file
= open(global_temp_buffer
,
757 O_WRONLY
| O_CREAT
| O_TRUNC
);
759 if (temp_bookmark_file
< 0)
760 return false; /* can't open the temp file */
762 /* Reading in the previous bookmarks and writing them to the temp file */
763 bookmark_file
= open(bookmark_file_name
, O_RDONLY
);
764 if (bookmark_file
>= 0)
766 while (read_line(bookmark_file
, global_read_buffer
,
767 sizeof(global_read_buffer
)) > 0)
769 if (bookmark_id
!= bookmark_count
)
771 write(temp_bookmark_file
, global_read_buffer
,
772 strlen(global_read_buffer
));
773 write(temp_bookmark_file
, "\n", 1);
777 close(bookmark_file
);
779 close(temp_bookmark_file
);
781 remove(bookmark_file_name
);
782 rename(global_temp_buffer
, bookmark_file_name
);
787 /* ----------------------------------------------------------------------- */
788 /* This function parses a bookmark, says the voice UI part of it. */
789 /* ------------------------------------------------------------------------*/
790 static void say_bookmark(const char* bookmark
,
796 bool enqueue
= false; /* only the first voice is not queued */
798 if (!parse_bookmark(bookmark
, &resume_index
, NULL
, NULL
, NULL
,
799 dir
, sizeof(dir
), &ms
, NULL
, NULL
, NULL
))
801 talk_id(LANG_BOOKMARK_INVALID
, true);
805 /* disabled, because transition between talkbox and voice UI clip is not nice */
807 if (global_settings
.talk_dir
>= 3)
808 { /* "talkbox" enabled */
809 char* last
= strrchr(dir
, '/');
811 { /* compose filename for talkbox */
812 strncpy(last
+ 1, dir_thumbnail_name
, sizeof(dir
)-(last
-dir
)-1);
813 talk_file(dir
, enqueue
);
818 talk_id(VOICE_EXT_BMARK
, enqueue
);
819 talk_number(bookmark_id
+ 1, true);
820 talk_id(VOICE_BOOKMARK_SELECT_INDEX_TEXT
, true);
821 talk_number(resume_index
+ 1, true);
822 talk_id(VOICE_BOOKMARK_SELECT_TIME_TEXT
, true);
824 talk_value(ms
/ 60000, UNIT_MIN
, true);
825 talk_value((ms
% 60000) / 1000, UNIT_SEC
, true);
828 /* ----------------------------------------------------------------------- */
829 /* This function parses a bookmark and then plays it. */
830 /* ------------------------------------------------------------------------*/
831 static bool play_bookmark(const char* bookmark
)
837 if (parse_bookmark(bookmark
,
843 sizeof(global_temp_buffer
),
845 &global_settings
.repeat_mode
,
846 &global_settings
.playlist_shuffle
,
849 bookmark_play(global_temp_buffer
, index
, offset
, seed
,
857 static const char* skip_token(const char* s
)
859 while (*s
&& *s
!= ';')
872 static const char* int_token(const char* s
, int* dest
)
879 return skip_token(s
);
882 static const char* long_token(const char* s
, long* dest
)
886 *dest
= atoi(s
); /* Should be atol, but we don't have it. */
889 return skip_token(s
);
892 static const char* bool_token(const char* s
, bool* dest
)
896 *dest
= atoi(s
) != 0;
899 return skip_token(s
);
902 /* ----------------------------------------------------------------------- */
903 /* This function takes a bookmark and parses it. This function also */
904 /* validates the bookmark. Passing in NULL for an output variable */
905 /* indicates that value is not requested. */
906 /* ----------------------------------------------------------------------- */
907 static bool parse_bookmark(const char *bookmark
,
911 int *resume_first_index
,
913 unsigned int resume_file_size
,
915 int * repeat_mode
, bool *shuffle
,
918 const char* s
= bookmark
;
921 s
= int_token(s
, resume_index
);
922 s
= int_token(s
, resume_offset
);
923 s
= int_token(s
, resume_seed
);
924 s
= int_token(s
, resume_first_index
);
925 s
= long_token(s
, ms
);
926 s
= int_token(s
, repeat_mode
);
927 s
= bool_token(s
, shuffle
);
934 end
= strchr(s
, ';');
936 if (resume_file
!= NULL
)
938 size_t len
= (end
== NULL
) ? strlen(s
) : (size_t) (end
- s
);
940 len
= MIN(resume_file_size
- 1, len
);
941 strncpy(resume_file
, s
, len
);
942 resume_file
[len
] = 0;
945 if (end
!= NULL
&& file_name
!= NULL
)
948 strncpy(file_name
, end
, MAX_PATH
- 1);
949 file_name
[MAX_PATH
- 1] = 0;
955 /* ----------------------------------------------------------------------- */
956 /* This function is used by multiple functions and is used to generate a */
957 /* bookmark named based off of the input. */
958 /* Changing this function could result in how the bookmarks are stored. */
959 /* it would be here that the centralized/decentralized bookmark code */
960 /* could be placed. */
961 /* ----------------------------------------------------------------------- */
962 static bool generate_bookmark_file_name(const char *in
)
964 int len
= strlen(in
);
966 /* if this is a root dir MP3, rename the bookmark file root_dir.bmark */
967 /* otherwise, name it based on the in variable */
968 if (!strcmp("/", in
))
969 strcpy(global_bookmark_file_name
, "/root_dir.bmark");
972 strcpy(global_bookmark_file_name
, in
);
973 if(global_bookmark_file_name
[len
-1] == '/')
975 strcpy(&global_bookmark_file_name
[len
], ".bmark");
981 /* ----------------------------------------------------------------------- */
982 /* Returns true if a bookmark file exists for the current playlist */
983 /* ----------------------------------------------------------------------- */
984 bool bookmark_exist(void)
990 char* name
= playlist_get_name(NULL
, global_temp_buffer
,
991 sizeof(global_temp_buffer
));
992 if (generate_bookmark_file_name(name
))
994 int fd
=open(global_bookmark_file_name
, O_RDONLY
);
1006 /* ----------------------------------------------------------------------- */
1007 /* Checks the current state of the system and returns if it is in a */
1008 /* bookmarkable state. */
1009 /* ----------------------------------------------------------------------- */
1011 /* ----------------------------------------------------------------------- */
1013 /* return bool: Indicates if the system was in a bookmarkable state */
1014 /* ----------------------------------------------------------------------- */
1015 static bool system_check(void)
1017 int resume_index
= 0;
1018 struct mp3entry
*id3
= audio_current_track();
1022 /* no track playing */
1026 /* Checking to see if playing a queued track */
1027 if (playlist_get_resume_info(&resume_index
) == -1)
1029 /* something bad happened while getting the queue information */
1032 else if (playlist_modified(NULL
))
1034 /* can't bookmark while in the queue */