summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index 28bf7de8ae..7ad22d5d70 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -173,8 +173,12 @@ static bool add_to_playlist(int position, bool queue)
173 playlist_create(NULL, NULL); 173 playlist_create(NULL, NULL);
174 174
175 /* always set seed before inserting shuffled */ 175 /* always set seed before inserting shuffled */
176 if (position == PLAYLIST_INSERT_SHUFFLED) 176 if (position == PLAYLIST_INSERT_SHUFFLED || position == PLAYLIST_INSERT_LAST_SHUFFLED)
177 {
177 srand(current_tick); 178 srand(current_tick);
179 if (position == PLAYLIST_INSERT_LAST_SHUFFLED)
180 playlist_set_last_shuffled_start();
181 }
178 182
179#ifdef HAVE_TAGCACHE 183#ifdef HAVE_TAGCACHE
180 if (context == CONTEXT_ID3DB) 184 if (context == CONTEXT_ID3DB)
@@ -355,6 +359,10 @@ MENUITEM_FUNCTION(i_shuf_pl_item, MENU_FUNC_USEPARAM,
355 ID2P(LANG_INSERT_SHUFFLED), playlist_insert_func, 359 ID2P(LANG_INSERT_SHUFFLED), playlist_insert_func,
356 (intptr_t*)PLAYLIST_INSERT_SHUFFLED, treeplaylist_callback, 360 (intptr_t*)PLAYLIST_INSERT_SHUFFLED, treeplaylist_callback,
357 Icon_Playlist); 361 Icon_Playlist);
362MENUITEM_FUNCTION(i_last_shuf_pl_item, MENU_FUNC_USEPARAM,
363 ID2P(LANG_INSERT_LAST_SHUFFLED), playlist_insert_func,
364 (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED, treeplaylist_callback,
365 Icon_Playlist);
358/* queue items */ 366/* queue items */
359MENUITEM_FUNCTION(q_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE), 367MENUITEM_FUNCTION(q_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE),
360 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT, 368 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT,
@@ -369,6 +377,10 @@ MENUITEM_FUNCTION(q_shuf_pl_item, MENU_FUNC_USEPARAM,
369 ID2P(LANG_QUEUE_SHUFFLED), playlist_queue_func, 377 ID2P(LANG_QUEUE_SHUFFLED), playlist_queue_func,
370 (intptr_t*)PLAYLIST_INSERT_SHUFFLED, 378 (intptr_t*)PLAYLIST_INSERT_SHUFFLED,
371 treeplaylist_wplayback_callback, Icon_Playlist); 379 treeplaylist_wplayback_callback, Icon_Playlist);
380MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM,
381 ID2P(LANG_QUEUE_LAST_SHUFFLED), playlist_queue_func,
382 (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED,
383 treeplaylist_callback, Icon_Playlist);
372/* replace playlist */ 384/* replace playlist */
373MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_REPLACE), 385MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_REPLACE),
374 playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE, 386 playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE,
@@ -388,10 +400,12 @@ MAKE_ONPLAYMENU( tree_playlist_menu, ID2P(LANG_PLAYLIST),
388 /* insert */ 400 /* insert */
389 &i_pl_item, &i_first_pl_item, 401 &i_pl_item, &i_first_pl_item,
390 &i_last_pl_item, &i_shuf_pl_item, 402 &i_last_pl_item, &i_shuf_pl_item,
403 &i_last_shuf_pl_item,
391 404
392 /* queue */ 405 /* queue */
393 &q_pl_item, &q_first_pl_item, &q_last_pl_item, 406 &q_pl_item, &q_first_pl_item, &q_last_pl_item,
394 &q_shuf_pl_item, 407 &q_shuf_pl_item,
408 &q_last_shuf_pl_item,
395 409
396 /* replace */ 410 /* replace */
397 &replace_pl_item 411 &replace_pl_item
@@ -439,6 +453,15 @@ static int treeplaylist_callback(int action,
439 } 453 }
440 return ACTION_EXIT_MENUITEM; 454 return ACTION_EXIT_MENUITEM;
441 } 455 }
456 else if (this_item == &i_last_shuf_pl_item || this_item == &q_last_shuf_pl_item)
457 {
458 if ((playlist_amount() > 0) && (audio_status() & AUDIO_STATUS_PLAY) && (selected_file_attr & ATTR_DIRECTORY))
459 {
460 return action;
461 }
462 else
463 return ACTION_EXIT_MENUITEM;
464 }
442 break; 465 break;
443 } 466 }
444 return action; 467 return action;