clean up some debugging output.
[kugel-rb.git] / apps / playlist_viewer.c
blob0d5935480444725d87987be5fe472456907f2091
1 /***************************************************************************
3 * __________ __ ___.
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * \/ \/ \/ \/ \/
9 * $Id$
11 * Copyright (C) 2003 Hardeep Sidhu
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
23 * Kevin Ferrare 2005/10/16
24 * multi-screen support, rewrote a lot of code
26 #include <string.h>
27 #include <sprintf.h>
28 #include "playlist.h"
29 #include "audio.h"
30 #include "screens.h"
31 #include "status.h"
32 #include "settings.h"
33 #include "icons.h"
34 #include "menu.h"
35 #include "plugin.h"
36 #include "keyboard.h"
37 #include "filetypes.h"
38 #include "onplay.h"
39 #include "talk.h"
40 #include "misc.h"
41 #include "action.h"
42 #include "debug.h"
43 #include "backlight.h"
45 #include "lang.h"
47 #include "playlist_viewer.h"
48 #include "playlist_catalog.h"
49 #include "icon.h"
50 #include "list.h"
51 #include "statusbar.h"
52 #include "splash.h"
53 #include "playlist_menu.h"
54 #include "action.h"
56 /* Maximum number of tracks we can have loaded at one time */
57 #define MAX_PLAYLIST_ENTRIES 200
59 /* The number of items between the selected one and the end/start of
60 * the buffer under which the buffer must reload */
61 #define MIN_BUFFER_MARGIN (screens[0].nb_lines+1)
63 /* Information about a specific track */
64 struct playlist_entry {
65 char *name; /* Formatted track name */
66 int index; /* Playlist index */
67 int display_index; /* Display index */
68 bool queued; /* Is track queued? */
69 bool skipped; /* Is track marked as bad? */
72 enum direction
74 FORWARD,
75 BACKWARD
78 struct playlist_buffer
80 char *name_buffer; /* Buffer used to store track names */
81 int buffer_size; /* Size of name buffer */
83 int first_index; /* Real index of first track loaded inside
84 the buffer */
86 enum direction direction; /* Direction of the buffer (if the buffer
87 was loaded BACKWARD, the last track in
88 the buffer has a real index < to the
89 real index of the the first track)*/
91 struct playlist_entry tracks[MAX_PLAYLIST_ENTRIES];
92 int num_loaded; /* Number of track entries loaded in buffer */
95 /* Global playlist viewer settings */
96 struct playlist_viewer {
97 struct playlist_info* playlist; /* playlist being viewed */
98 int num_tracks; /* Number of tracks in playlist */
99 int current_playing_track; /* Index of current playing track */
100 int selected_track; /* The selected track, relative (first is 0)*/
101 int move_track; /* Playlist index of track to move or -1 */
102 struct playlist_buffer buffer;
105 static struct playlist_viewer viewer;
107 /* Used when viewing playlists on disk */
108 static struct playlist_info temp_playlist;
110 static void playlist_buffer_init(struct playlist_buffer *pb, char *names_buffer,
111 int names_buffer_size);
112 static void playlist_buffer_load_entries(struct playlist_buffer * pb, int index,
113 enum direction direction);
114 static int playlist_entry_load(struct playlist_entry *entry, int index,
115 char* name_buffer, int remaining_size);
117 static struct playlist_entry * playlist_buffer_get_track(struct playlist_buffer *pb,
118 int index);
120 static bool playlist_viewer_init(struct playlist_viewer * viewer,
121 const char* filename, bool reload);
123 static void format_name(char* dest, const char* src);
124 static void format_line(const struct playlist_entry* track, char* str,
125 int len);
127 static bool update_playlist(bool force);
128 static int onplay_menu(int index);
129 static bool viewer_menu(void);
130 static int save_playlist_func(void);
132 static void playlist_buffer_init(struct playlist_buffer *pb, char *names_buffer,
133 int names_buffer_size)
135 pb->name_buffer=names_buffer;
136 pb->buffer_size=names_buffer_size;
137 pb->first_index=0;
138 pb->num_loaded=0;
142 * Loads the entries following 'index' in the playlist buffer
144 static void playlist_buffer_load_entries(struct playlist_buffer *pb, int index,
145 enum direction direction)
147 int num_entries = viewer.num_tracks;
148 char* p = pb->name_buffer;
149 int remaining = pb->buffer_size;
150 int i;
152 pb->first_index = index;
153 if (num_entries > MAX_PLAYLIST_ENTRIES)
154 num_entries = MAX_PLAYLIST_ENTRIES;
156 for(i=0; i<num_entries; i++)
158 int len = playlist_entry_load(&(pb->tracks[i]), index, p, remaining);
159 if (len < 0)
161 /* Out of name buffer space */
162 num_entries = i;
163 break;
166 p += len;
167 remaining -= len;
169 if(direction==FORWARD)
170 index++;
171 else
172 index--;
173 index+=viewer.num_tracks;
174 index%=viewer.num_tracks;
176 pb->direction=direction;
177 pb->num_loaded = i;
180 static void playlist_buffer_load_entries_screen(struct playlist_buffer * pb,
181 enum direction direction)
183 if(direction==FORWARD)
185 int min_start=viewer.selected_track-2*screens[0].nb_lines;
186 while(min_start<0)
187 min_start+=viewer.num_tracks;
188 min_start %= viewer.num_tracks;
189 playlist_buffer_load_entries(pb, min_start, FORWARD);
191 else
193 int max_start=viewer.selected_track+2*screens[0].nb_lines;
194 max_start%=viewer.num_tracks;
195 playlist_buffer_load_entries(pb, max_start, BACKWARD);
199 static int playlist_entry_load(struct playlist_entry *entry, int index,
200 char* name_buffer, int remaining_size)
202 struct playlist_track_info info;
203 int len;
205 /* Playlist viewer orders songs based on display index. We need to
206 convert to real playlist index to access track */
207 index = (index + playlist_get_first_index(viewer.playlist)) %
208 viewer.num_tracks;
209 if (playlist_get_track_info(viewer.playlist, index, &info) < 0)
210 return -1;
212 len = strlen(info.filename) + 1;
214 if (len <= remaining_size)
216 strcpy(name_buffer, info.filename);
218 entry->name = name_buffer;
219 entry->index = info.index;
220 entry->display_index = info.display_index;
221 entry->queued = info.attr & PLAYLIST_ATTR_QUEUED;
222 entry->skipped = info.attr & PLAYLIST_ATTR_SKIPPED;
223 return len;
225 return -1;
228 static int playlist_buffer_get_index(struct playlist_buffer *pb, int index)
230 int buffer_index;
231 if(pb->direction==FORWARD)
233 if(index>=pb->first_index)
234 buffer_index=index-pb->first_index;
235 else /* rotation : track0 in buffer + requested track */
236 buffer_index=(viewer.num_tracks-pb->first_index)+(index);
238 else
240 if(index<=pb->first_index)
241 buffer_index=pb->first_index-index;
242 else /* rotation : track0 in buffer + dist from the last track
243 to the requested track (num_tracks-requested track) */
244 buffer_index=(pb->first_index)+(viewer.num_tracks-index);
246 return(buffer_index);
249 #define distance(a, b) \
250 a>b? (a) - (b) : (b) - (a)
251 static bool playlist_buffer_needs_reload(struct playlist_buffer* pb,
252 int track_index)
254 if(pb->num_loaded==viewer.num_tracks)
255 return(false);
256 int selected_index=playlist_buffer_get_index(pb, track_index);
257 int first_buffer_index=playlist_buffer_get_index(pb, pb->first_index);
258 int distance_beginning=distance(selected_index, first_buffer_index);
259 if(distance_beginning<MIN_BUFFER_MARGIN)
260 return(true);
262 if(pb->num_loaded - distance_beginning < MIN_BUFFER_MARGIN)
263 return(true);
264 return(false);
267 static struct playlist_entry * playlist_buffer_get_track(struct playlist_buffer *pb,
268 int index)
270 int buffer_index=playlist_buffer_get_index(pb, index);
271 return(&(pb->tracks[buffer_index]));
274 /* Initialize the playlist viewer. */
275 static bool playlist_viewer_init(struct playlist_viewer * viewer,
276 const char* filename, bool reload)
278 char* buffer;
279 size_t buffer_size;
280 bool is_playing = audio_status() & (AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE);
281 bool have_list = filename || is_playing;
282 if (!have_list && (global_status.resume_index != -1))
284 /* Try to restore the list from control file */
285 have_list = (playlist_resume() != -1);
287 if (!have_list && (playlist_amount() > 0))
289 /*If dynamic playlist still exists, view it anyway even
290 if playback has reached the end of the playlist */
291 have_list = true;
293 if (!have_list)
295 /* Nothing to view, exit */
296 gui_syncsplash(HZ, str(LANG_CATALOG_NO_PLAYLISTS));
297 return false;
300 buffer = plugin_get_buffer(&buffer_size);
301 if (!buffer)
302 return false;
304 if (!filename)
305 viewer->playlist = NULL;
306 else
308 /* Viewing playlist on disk */
309 const char *dir, *file;
310 char *temp_ptr;
311 char *index_buffer = NULL;
312 ssize_t index_buffer_size = 0;
314 viewer->playlist = &temp_playlist;
316 /* Separate directory from filename */
317 temp_ptr = strrchr(filename+1,'/');
318 if (temp_ptr)
320 *temp_ptr = 0;
321 dir = filename;
322 file = temp_ptr + 1;
324 else
326 dir = "/";
327 file = filename+1;
330 if (is_playing)
332 /* Something is playing, use half the plugin buffer for playlist
333 indices */
334 index_buffer_size = buffer_size / 2;
335 index_buffer = buffer;
338 playlist_create_ex(viewer->playlist, dir, file, index_buffer,
339 index_buffer_size, buffer+index_buffer_size,
340 buffer_size-index_buffer_size);
342 if (temp_ptr)
343 *temp_ptr = '/';
345 buffer += index_buffer_size;
346 buffer_size -= index_buffer_size;
348 playlist_buffer_init(&viewer->buffer, buffer, buffer_size );
350 viewer->move_track = -1;
352 if (!reload)
354 if (viewer->playlist)
355 viewer->selected_track = 0;
356 else
357 viewer->selected_track = playlist_get_display_index() - 1;
360 if (!update_playlist(true))
361 return false;
362 return true;
365 /* Format trackname for display purposes */
366 static void format_name(char* dest, const char* src)
368 switch (global_settings.playlist_viewer_track_display)
370 case 0:
371 default:
373 /* Only display the filename */
374 char* p = strrchr(src, '/');
376 strcpy(dest, p+1);
378 /* Remove the extension */
379 strrsplt(dest, '.');
381 break;
383 case 1:
384 /* Full path */
385 strcpy(dest, src);
386 break;
390 /* Format display line */
391 static void format_line(const struct playlist_entry* track, char* str,
392 int len)
394 char name[MAX_PATH];
395 char *skipped = "";
397 format_name(name, track->name);
399 if (track->skipped)
400 skipped = "(ERR) ";
402 if (global_settings.playlist_viewer_indices)
403 /* Display playlist index */
404 snprintf(str, len, "%d. %s%s", track->display_index, skipped, name);
405 else
406 snprintf(str, len, "%s%s", skipped, name);
410 /* Update playlist in case something has changed or forced */
411 static bool update_playlist(bool force)
413 if (!viewer.playlist)
414 playlist_get_resume_info(&viewer.current_playing_track);
415 else
416 viewer.current_playing_track = -1;
417 int nb_tracks=playlist_amount_ex(viewer.playlist);
418 force=force || nb_tracks != viewer.num_tracks;
419 if (force)
421 /* Reload tracks */
422 viewer.num_tracks = nb_tracks;
423 if (viewer.num_tracks <= 0)
424 return false;
425 playlist_buffer_load_entries_screen(&viewer.buffer, FORWARD);
426 if (viewer.buffer.num_loaded <= 0)
427 return false;
429 return true;
432 /* Menu of playlist commands. Invoked via ON+PLAY on main viewer screen.
433 Returns -1 if USB attached, 0 if no playlist change, and 1 if playlist
434 changed. */
435 static int onplay_menu(int index)
437 int result, ret = 0;
438 struct playlist_entry * current_track=
439 playlist_buffer_get_track(&viewer.buffer, index);
440 MENUITEM_STRINGLIST(menu_items, ID2P(LANG_PLAYLIST), NULL,
441 ID2P(LANG_REMOVE), ID2P(LANG_MOVE),
442 ID2P(LANG_CATALOG_ADD_TO), ID2P(LANG_CATALOG_ADD_TO_NEW));
443 bool current = (current_track->index == viewer.current_playing_track);
445 result = do_menu(&menu_items, NULL, NULL, false);
446 if (result == MENU_ATTACHED_USB)
448 ret = -1;
450 else if (result >= 0)
452 /* Abort current move */
453 viewer.move_track = -1;
455 switch (result)
457 case 0:
458 /* delete track */
459 playlist_delete(viewer.playlist, current_track->index);
460 if (current)
462 if (playlist_amount_ex(viewer.playlist) <= 0)
463 audio_stop();
464 else
466 /* Start playing new track except if it's the lasttrack
467 track in the playlist and repeat mode is disabled */
468 current_track =
469 playlist_buffer_get_track(&viewer.buffer, index);
470 if (current_track->display_index!=viewer.num_tracks ||
471 global_settings.repeat_mode == REPEAT_ALL)
473 #if CONFIG_CODEC != SWCODEC
474 talk_buffer_steal(); /* will use the mp3 buffer */
475 #endif
476 audio_play(0);
477 viewer.current_playing_track = -1;
481 ret = 1;
482 break;
483 case 1:
484 /* move track */
485 viewer.move_track = current_track->index;
486 ret = 0;
487 break;
488 case 2: /* add to catalog */
489 case 3: /* add to a new one */
490 catalog_add_to_a_playlist(current_track->name,
491 FILE_ATTR_AUDIO,
492 result==3, NULL);
493 ret = 0;
494 break;
497 return ret;
500 /* Menu of viewer options. Invoked via F1(r) or Menu(p). */
501 MENUITEM_SETTING(show_icons, &global_settings.playlist_viewer_icons, NULL);
502 MENUITEM_SETTING(show_indices, &global_settings.playlist_viewer_indices, NULL);
503 MENUITEM_SETTING(track_display,
504 &global_settings.playlist_viewer_track_display, NULL);
505 MENUITEM_FUNCTION(save_playlist_item, 0, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
506 save_playlist_func, 0, NULL, Icon_NOICON);
507 MAKE_MENU(viewer_settings_menu, ID2P(LANG_PLAYLISTVIEWER_SETTINGS),
508 NULL, Icon_Playlist,
509 &show_icons, &show_indices, &track_display, &save_playlist_item);
510 static bool viewer_menu(void)
512 return do_menu(&viewer_settings_menu, NULL, NULL, false) == MENU_ATTACHED_USB;
515 /* Save playlist to disk */
516 static int save_playlist_func(void)
518 save_playlist_screen(viewer.playlist);
519 return 0;
522 /* View current playlist */
523 bool playlist_viewer(void)
525 return playlist_viewer_ex(NULL);
528 static int get_track_num( struct playlist_viewer * local_viewer,
529 int selected_item )
531 if( local_viewer->move_track >= 0 )
533 if( local_viewer->selected_track == selected_item )
535 return local_viewer->move_track;
537 else if( local_viewer->selected_track > selected_item
538 && selected_item >= local_viewer->move_track )
540 return selected_item+1;
542 else if( local_viewer->selected_track < selected_item
543 && selected_item <= local_viewer->move_track )
545 return selected_item-1;
548 return selected_item;
551 static char *playlist_callback_name(int selected_item,
552 void *data,
553 char *buffer,
554 size_t buffer_len)
556 struct playlist_viewer * local_viewer = (struct playlist_viewer *)data;
558 int track_num = get_track_num(local_viewer, selected_item);
559 struct playlist_entry *track =
560 playlist_buffer_get_track(&(local_viewer->buffer), track_num);
562 format_line(track, buffer, buffer_len);
564 return(buffer);
568 static int playlist_callback_icons(int selected_item, void *data)
570 struct playlist_viewer * local_viewer=(struct playlist_viewer *)data;
572 int track_num = get_track_num(local_viewer, selected_item);
573 struct playlist_entry *track=
574 playlist_buffer_get_track(&(local_viewer->buffer), track_num);
576 if (track->index == local_viewer->current_playing_track)
578 /* Current playing track */
579 return Icon_Audio;
581 else if (track->index == local_viewer->move_track)
583 /* Track we are moving */
584 return Icon_Moving;
586 else if (track->queued)
588 /* Queued track */
589 return Icon_Queued;
591 else
592 return Icon_NOICON;
595 /* Main viewer function. Filename identifies playlist to be viewed. If NULL,
596 view current playlist. */
597 bool playlist_viewer_ex(const char* filename)
599 bool ret = false; /* return value */
600 bool exit=false; /* exit viewer */
601 int button;
602 struct gui_synclist playlist_lists;
603 if (!playlist_viewer_init(&viewer, filename, false))
604 goto exit;
606 gui_synclist_init(&playlist_lists, playlist_callback_name,
607 &viewer, false, 1, NULL);
608 gui_synclist_set_icon_callback(&playlist_lists,
609 global_settings.playlist_viewer_icons?
610 &playlist_callback_icons:NULL);
611 gui_synclist_set_nb_items(&playlist_lists, viewer.num_tracks);
612 gui_synclist_select_item(&playlist_lists, viewer.selected_track);
613 gui_synclist_set_title(&playlist_lists, str(LANG_PLAYLIST), Icon_Playlist);
614 gui_synclist_draw(&playlist_lists);
615 while (!exit)
617 int track;
619 if (global_status.resume_index != -1 && !viewer.playlist)
620 playlist_get_resume_info(&track);
621 else
622 track = -1;
624 if (track != viewer.current_playing_track ||
625 playlist_amount_ex(viewer.playlist) != viewer.num_tracks)
627 /* Playlist has changed (new track started?) */
628 if (!update_playlist(false))
629 goto exit;
630 /*Needed because update_playlist gives wrong value when
631 playing is stopped*/
632 viewer.current_playing_track = track;
633 gui_synclist_set_nb_items(&playlist_lists, viewer.num_tracks);
634 /* Abort move on playlist change */
635 viewer.move_track = -1;
636 gui_synclist_draw(&playlist_lists);
639 /* Timeout so we can determine if play status has changed */
640 button = get_action(CONTEXT_TREE,HZ/2);
641 if( (gui_synclist_do_button(&playlist_lists, &button,LIST_WRAP_UNLESS_HELD)) )
643 viewer.selected_track=gui_synclist_get_sel_pos(&playlist_lists);
644 if(playlist_buffer_needs_reload(&viewer.buffer,
645 viewer.selected_track))
646 playlist_buffer_load_entries_screen(&viewer.buffer,
647 button==ACTION_STD_NEXT?
648 FORWARD
650 BACKWARD
652 gui_synclist_draw(&playlist_lists);
654 switch (button)
656 case ACTION_TREE_WPS:
657 case ACTION_STD_CANCEL:
659 if (viewer.move_track >= 0)
661 viewer.selected_track = viewer.move_track;
662 gui_synclist_select_item(&playlist_lists, viewer.move_track);
663 viewer.move_track = -1;
664 gui_synclist_draw(&playlist_lists);
666 else
667 exit = true;
668 break;
670 case ACTION_STD_OK:
672 struct playlist_entry * current_track =
673 playlist_buffer_get_track(&viewer.buffer,
674 viewer.selected_track);
675 if (viewer.move_track >= 0)
677 /* Move track */
678 int ret_val;
680 ret_val = playlist_move(viewer.playlist, viewer.move_track,
681 current_track->index);
682 if (ret_val < 0)
683 gui_syncsplash(HZ, (unsigned char *)"%s %s",
684 str(LANG_MOVE), str(LANG_FAILED));
685 update_playlist(true);
686 viewer.move_track = -1;
688 else if (!viewer.playlist)
690 /* play new track */
691 playlist_start(current_track->index, 0);
692 update_playlist(false);
694 else
696 /* New playlist */
697 if (playlist_set_current(viewer.playlist) < 0)
698 goto exit;
700 playlist_start(current_track->index, 0);
702 /* Our playlist is now the current list */
703 if (!playlist_viewer_init(&viewer, NULL, true))
704 goto exit;
706 gui_synclist_draw(&playlist_lists);
708 break;
710 case ACTION_STD_CONTEXT:
712 /* ON+PLAY menu */
713 int ret_val;
715 ret_val = onplay_menu(viewer.selected_track);
717 if (ret_val < 0)
719 ret = true;
720 goto exit;
722 else if (ret > 0)
724 /* Playlist changed */
725 gui_synclist_del_item(&playlist_lists);
726 update_playlist(true);
727 if (viewer.num_tracks <= 0)
728 exit = true;
729 if(viewer.selected_track >= viewer.num_tracks)
730 viewer.selected_track = viewer.num_tracks-1;
732 gui_synclist_draw(&playlist_lists);
733 break;
735 case ACTION_STD_MENU:
736 if (viewer_menu())
738 ret = true;
739 goto exit;
741 gui_synclist_set_icon_callback(
742 &playlist_lists,
743 global_settings.playlist_viewer_icons?
744 &playlist_callback_icons:NULL
746 gui_synclist_draw(&playlist_lists);
747 break;
749 case ACTION_NONE:
750 gui_syncstatusbar_draw(&statusbars, false);
751 break;
753 default:
754 if(default_event_handler(button) == SYS_USB_CONNECTED)
756 ret = true;
757 goto exit;
759 break;
763 exit:
764 if (viewer.playlist)
765 playlist_close(viewer.playlist);
766 return ret;
769 static char *playlist_search_callback_name(int selected_item, void * data,
770 char *buffer, size_t buffer_len)
772 (void)buffer_len; /* this should probably be used */
773 int *found_indicies = (int*)data;
774 static struct playlist_track_info track;
775 playlist_get_track_info(viewer.playlist, found_indicies[selected_item], &track);
776 format_name(buffer, track.filename);
777 return(buffer);
780 bool search_playlist(void)
782 char search_str[32] = "";
783 bool ret = false, exit = false;
784 int i, playlist_count;
785 int found_indicies[MAX_PLAYLIST_ENTRIES],found_indicies_count = 0;
786 int button;
787 struct gui_synclist playlist_lists;
788 struct playlist_track_info track;
790 if (!playlist_viewer_init(&viewer, 0, false))
791 return ret;
792 if (kbd_input(search_str,sizeof(search_str)) == -1)
793 return ret;
794 lcd_clear_display();
795 playlist_count = playlist_amount_ex(viewer.playlist);
796 for (i=0;(i<playlist_count)&&(found_indicies_count<MAX_PLAYLIST_ENTRIES);i++)
798 gui_syncsplash(0, str(LANG_PLAYLIST_SEARCH_MSG),found_indicies_count,
799 str(LANG_OFF_ABORT));
800 if (action_userabort(TIMEOUT_NOBLOCK))
802 if (!found_indicies_count)
803 return ret;
804 break;
806 playlist_get_track_info(viewer.playlist,i,&track);
807 if (strcasestr(track.filename,search_str))
809 found_indicies[found_indicies_count++] = track.index;
812 if (!found_indicies_count)
814 return ret;
816 backlight_on();
817 gui_synclist_init(&playlist_lists, playlist_search_callback_name,
818 found_indicies, false, 1, NULL);
819 gui_synclist_set_icon_callback(&playlist_lists, NULL);
820 gui_synclist_set_nb_items(&playlist_lists, found_indicies_count);
821 gui_synclist_select_item(&playlist_lists, 0);
822 gui_synclist_draw(&playlist_lists);
823 while (!exit)
825 button = get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
826 if (gui_synclist_do_button(&playlist_lists, &button, LIST_WRAP_UNLESS_HELD))
827 continue;
828 switch (button)
830 case ACTION_STD_CANCEL:
831 exit = true;
832 break;
834 case ACTION_STD_OK:
835 playlist_start(
836 found_indicies[gui_synclist_get_sel_pos(&playlist_lists)]
837 ,0);
838 exit = 1;
839 break;
840 case ACTION_NONE:
841 break;
842 default:
843 if(default_event_handler(button) == SYS_USB_CONNECTED)
845 ret = true;
846 exit = true;
848 break;
851 return ret;