summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c52
1 files changed, 50 insertions, 2 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index bc486d1a38..d552e41826 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -63,6 +63,7 @@
63#include "eq_menu.h" 63#include "eq_menu.h"
64#endif 64#endif
65#include "playlist_menu.h" 65#include "playlist_menu.h"
66#include "playlist_catalog.h"
66 67
67static int context; 68static int context;
68static char* selected_file = NULL; 69static char* selected_file = NULL;
@@ -222,6 +223,50 @@ static bool view_playlist(void)
222 return result; 223 return result;
223} 224}
224 225
226bool cat_add_to_a_playlist(void)
227{
228 return catalog_add_to_a_playlist(selected_file, selected_file_attr,
229 false);
230}
231
232bool cat_add_to_a_new_playlist(void)
233{
234 return catalog_add_to_a_playlist(selected_file, selected_file_attr, true);
235}
236
237static bool cat_playlist_options(void)
238{
239 struct menu_item items[3];
240 int m, i=0, result;
241 bool ret = false;
242
243 if ((audio_status() & AUDIO_STATUS_PLAY && context == CONTEXT_WPS) ||
244 context == CONTEXT_TREE)
245 {
246 if (context == CONTEXT_WPS)
247 {
248 items[i].desc = ID2P(LANG_CATALOG_VIEW);
249 items[i].function = catalog_view_playlists;
250 i++;
251 }
252
253 items[i].desc = ID2P(LANG_CATALOG_ADD_TO);
254 items[i].function = cat_add_to_a_playlist;
255 i++;
256 items[i].desc = ID2P(LANG_CATALOG_ADD_TO_NEW);
257 items[i].function = cat_add_to_a_new_playlist;
258 i++;
259 }
260
261 m = menu_init( items, i, NULL, NULL, NULL, NULL );
262 result = menu_show(m);
263 if(result >= 0)
264 ret = items[result].function();
265 menu_exit(m);
266
267 return ret;
268}
269
225/* Sub-menu for playlist options */ 270/* Sub-menu for playlist options */
226static bool playlist_options(void) 271static bool playlist_options(void)
227{ 272{
@@ -773,9 +818,9 @@ static int onplay_callback(int key, int menu)
773int onplay(char* file, int attr, int from) 818int onplay(char* file, int attr, int from)
774{ 819{
775#if CONFIG_CODEC == SWCODEC 820#if CONFIG_CODEC == SWCODEC
776 struct menu_item items[13]; /* increase this if you add entries! */ 821 struct menu_item items[14]; /* increase this if you add entries! */
777#else 822#else
778 struct menu_item items[11]; 823 struct menu_item items[12];
779#endif 824#endif
780 int m, i=0, result; 825 int m, i=0, result;
781#ifdef HAVE_LCD_COLOR 826#ifdef HAVE_LCD_COLOR
@@ -803,6 +848,9 @@ int onplay(char* file, int attr, int from)
803 items[i].desc = ID2P(LANG_PLAYLIST); 848 items[i].desc = ID2P(LANG_PLAYLIST);
804 items[i].function = playlist_options; 849 items[i].function = playlist_options;
805 i++; 850 i++;
851 items[i].desc = ID2P(LANG_CATALOG);
852 items[i].function = cat_playlist_options;
853 i++;
806 } 854 }
807 855
808 if (context == CONTEXT_WPS) 856 if (context == CONTEXT_WPS)