summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index b1b690222b..d864b3b2a9 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -43,11 +43,35 @@
43#include "playlist_viewer.h" 43#include "playlist_viewer.h"
44#include "talk.h" 44#include "talk.h"
45#include "onplay.h" 45#include "onplay.h"
46#include "filetypes.h"
46 47
47static char* selected_file = NULL; 48static char* selected_file = NULL;
48static int selected_file_attr = 0; 49static int selected_file_attr = 0;
49static int onplay_result = ONPLAY_OK; 50static int onplay_result = ONPLAY_OK;
50 51
52static bool list_viewers(void)
53{
54 struct menu_item menu[8];
55 int m, i, result;
56
57 i=filetype_load_menu(menu,sizeof(menu)/sizeof(*menu));
58 if (i)
59 {
60 m = menu_init( menu, i, NULL, NULL, NULL, NULL );
61 result = menu_show(m);
62 if (result >= 0)
63 {
64 menu_exit(m);
65 filetype_load_plugin(menu[result].desc,selected_file);
66 }
67 }
68 else
69 {
70 splash(HZ*2, true, "No viewers found");
71 }
72 return false;
73}
74
51/* For playlist options */ 75/* For playlist options */
52struct playlist_args { 76struct playlist_args {
53 int position; 77 int position;
@@ -625,7 +649,7 @@ bool create_dir(void)
625 649
626int onplay(char* file, int attr) 650int onplay(char* file, int attr)
627{ 651{
628 struct menu_item items[5]; /* increase this if you add entries! */ 652 struct menu_item items[6]; /* increase this if you add entries! */
629 int m, i=0, result; 653 int m, i=0, result;
630 654
631 onplay_result = ONPLAY_OK; 655 onplay_result = ONPLAY_OK;
@@ -635,6 +659,14 @@ int onplay(char* file, int attr)
635 selected_file = file; 659 selected_file = file;
636 selected_file_attr = attr; 660 selected_file_attr = attr;
637 661
662 if (!(attr & ATTR_DIRECTORY))
663 {
664 items[i].desc = str(LANG_ONPLAY_OPEN_WITH);
665 items[i].voice_id = LANG_ONPLAY_OPEN_WITH;
666 items[i].function = list_viewers;
667 i++;
668 }
669
638 if (((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || 670 if (((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) ||
639 (attr & ATTR_DIRECTORY) || 671 (attr & ATTR_DIRECTORY) ||
640 ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)) 672 ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U))