diff options
-rw-r--r-- | apps/misc.c | 26 | ||||
-rw-r--r-- | apps/misc.h | 2 | ||||
-rw-r--r-- | apps/onplay.c | 57 | ||||
-rw-r--r-- | apps/onplay.h | 3 | ||||
-rw-r--r-- | apps/playlist_catalog.c | 16 | ||||
-rw-r--r-- | apps/playlist_catalog.h | 6 | ||||
-rw-r--r-- | apps/playlist_viewer.c | 2 | ||||
-rw-r--r-- | apps/recorder/albumart.c | 26 | ||||
-rw-r--r-- | apps/tagtree.c | 61 | ||||
-rw-r--r-- | apps/tagtree.h | 3 | ||||
-rw-r--r-- | apps/tree.c | 7 |
11 files changed, 142 insertions, 67 deletions
diff --git a/apps/misc.c b/apps/misc.c index 93b5247ae9..e6c8a219ea 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -1387,6 +1387,32 @@ int string_option(const char *option, const char *const oplist[], bool ignore_ca | |||
1387 | return -1; | 1387 | return -1; |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | /* Make sure part of path only contain chars valid for a FAT32 long name. | ||
1391 | * Double quotes are replaced with single quotes, other unsupported chars | ||
1392 | * are replaced with an underscore. | ||
1393 | * | ||
1394 | * path - path to modify. | ||
1395 | * offset - where in path to start checking. | ||
1396 | * count - number of chars to check. | ||
1397 | */ | ||
1398 | void fix_path_part(char* path, int offset, int count) | ||
1399 | { | ||
1400 | static const char invalid_chars[] = "*/:<>?\\|"; | ||
1401 | int i; | ||
1402 | |||
1403 | path += offset; | ||
1404 | |||
1405 | for (i = 0; i <= count; i++, path++) | ||
1406 | { | ||
1407 | if (*path == 0) | ||
1408 | return; | ||
1409 | if (*path == '"') | ||
1410 | *path = '\''; | ||
1411 | else if (strchr(invalid_chars, *path)) | ||
1412 | *path = '_'; | ||
1413 | } | ||
1414 | } | ||
1415 | |||
1390 | /* open but with a builtin printf for assembling the path */ | 1416 | /* open but with a builtin printf for assembling the path */ |
1391 | int open_pathfmt(char *buf, size_t size, int oflag, const char *pathfmt, ...) | 1417 | int open_pathfmt(char *buf, size_t size, int oflag, const char *pathfmt, ...) |
1392 | { | 1418 | { |
diff --git a/apps/misc.h b/apps/misc.h index df2c649b0e..51684cb658 100644 --- a/apps/misc.h +++ b/apps/misc.h | |||
@@ -124,6 +124,8 @@ int split_string(char *str, const char needle, char *vector[], int vector_length | |||
124 | #ifndef O_PATH | 124 | #ifndef O_PATH |
125 | #define O_PATH 0x2000 | 125 | #define O_PATH 0x2000 |
126 | #endif | 126 | #endif |
127 | |||
128 | void fix_path_part(char* path, int offset, int count); | ||
127 | int open_pathfmt(char *buf, size_t size, int oflag, const char *pathfmt, ...); | 129 | int open_pathfmt(char *buf, size_t size, int oflag, const char *pathfmt, ...); |
128 | int open_utf8(const char* pathname, int flags); | 130 | int open_utf8(const char* pathname, int flags); |
129 | int string_option(const char *option, const char *const oplist[], bool ignore_case); | 131 | int string_option(const char *option, const char *const oplist[], bool ignore_case); |
diff --git a/apps/onplay.c b/apps/onplay.c index ce2b3310f3..f92ed76050 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -70,7 +70,8 @@ static const char *selected_file = NULL; | |||
70 | static char selected_file_path[MAX_PATH]; | 70 | static char selected_file_path[MAX_PATH]; |
71 | static int selected_file_attr = 0; | 71 | static int selected_file_attr = 0; |
72 | static int onplay_result = ONPLAY_OK; | 72 | static int onplay_result = ONPLAY_OK; |
73 | static bool (*ctx_playlist_insert)(int position, bool queue, bool create_new); | 73 | static bool (*ctx_current_playlist_insert)(int position, bool queue, bool create_new); |
74 | static int (*ctx_add_to_playlist)(const char* playlist, bool new_playlist); | ||
74 | extern struct menu_item_ex file_menu; /* settings_menu.c */ | 75 | extern struct menu_item_ex file_menu; /* settings_menu.c */ |
75 | 76 | ||
76 | /* redefine MAKE_MENU so the MENU_EXITAFTERTHISMENU flag can be added easily */ | 77 | /* redefine MAKE_MENU so the MENU_EXITAFTERTHISMENU flag can be added easily */ |
@@ -626,11 +627,11 @@ static int add_to_playlist(void* arg) | |||
626 | #ifdef HAVE_TAGCACHE | 627 | #ifdef HAVE_TAGCACHE |
627 | if (context == CONTEXT_ID3DB) | 628 | if (context == CONTEXT_ID3DB) |
628 | { | 629 | { |
629 | tagtree_insert_selection_playlist(position, queue); | 630 | tagtree_current_playlist_insert(position, queue); |
630 | } | 631 | } |
631 | else if (context == CONTEXT_STD && ctx_playlist_insert != NULL) | 632 | else if (context == CONTEXT_STD && ctx_current_playlist_insert != NULL) |
632 | { | 633 | { |
633 | ctx_playlist_insert(position, queue, false); | 634 | ctx_current_playlist_insert(position, queue, false); |
634 | } | 635 | } |
635 | else | 636 | else |
636 | #endif | 637 | #endif |
@@ -837,7 +838,7 @@ static int treeplaylist_callback(int action, | |||
837 | void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb)) | 838 | void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb)) |
838 | { | 839 | { |
839 | context = CONTEXT_STD; | 840 | context = CONTEXT_STD; |
840 | ctx_playlist_insert = playlist_insert_cb; | 841 | ctx_current_playlist_insert = playlist_insert_cb; |
841 | selected_file = path; | 842 | selected_file = path; |
842 | if (dir_exists(path)) | 843 | if (dir_exists(path)) |
843 | selected_file_attr = ATTR_DIRECTORY; | 844 | selected_file_attr = ATTR_DIRECTORY; |
@@ -850,13 +851,13 @@ void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb)) | |||
850 | static bool cat_add_to_a_playlist(void) | 851 | static bool cat_add_to_a_playlist(void) |
851 | { | 852 | { |
852 | return catalog_add_to_a_playlist(selected_file, selected_file_attr, | 853 | return catalog_add_to_a_playlist(selected_file, selected_file_attr, |
853 | false, NULL); | 854 | false, NULL, ctx_add_to_playlist); |
854 | } | 855 | } |
855 | 856 | ||
856 | static bool cat_add_to_a_new_playlist(void) | 857 | static bool cat_add_to_a_new_playlist(void) |
857 | { | 858 | { |
858 | return catalog_add_to_a_playlist(selected_file, selected_file_attr, | 859 | return catalog_add_to_a_playlist(selected_file, selected_file_attr, |
859 | true, NULL); | 860 | true, NULL, ctx_add_to_playlist); |
860 | } | 861 | } |
861 | 862 | ||
862 | static int cat_playlist_callback(int action, | 863 | static int cat_playlist_callback(int action, |
@@ -871,11 +872,12 @@ MAKE_ONPLAYMENU(cat_playlist_menu, ID2P(LANG_ADD_TO_PL), | |||
871 | cat_playlist_callback, Icon_Playlist, | 872 | cat_playlist_callback, Icon_Playlist, |
872 | &cat_add_to_list, &cat_add_to_new); | 873 | &cat_add_to_list, &cat_add_to_new); |
873 | 874 | ||
874 | void onplay_show_playlist_cat_menu(char* track_name) | 875 | void onplay_show_playlist_cat_menu(const char* track_name, int attr, void (*add_to_pl_cb)) |
875 | { | 876 | { |
876 | context = CONTEXT_STD; | 877 | context = CONTEXT_STD; |
878 | ctx_add_to_playlist = add_to_pl_cb; | ||
877 | selected_file = track_name; | 879 | selected_file = track_name; |
878 | selected_file_attr = FILE_ATTR_AUDIO; | 880 | selected_file_attr = attr; |
879 | do_menu(&cat_playlist_menu, NULL, NULL, false); | 881 | do_menu(&cat_playlist_menu, NULL, NULL, false); |
880 | } | 882 | } |
881 | 883 | ||
@@ -892,13 +894,6 @@ static int cat_playlist_callback(int action, | |||
892 | { | 894 | { |
893 | return ACTION_EXIT_MENUITEM; | 895 | return ACTION_EXIT_MENUITEM; |
894 | } | 896 | } |
895 | #ifdef HAVE_TAGCACHE | ||
896 | if (context == CONTEXT_ID3DB && | ||
897 | ((selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_AUDIO)) | ||
898 | { | ||
899 | return ACTION_EXIT_MENUITEM; | ||
900 | } | ||
901 | #endif | ||
902 | 897 | ||
903 | switch (action) | 898 | switch (action) |
904 | { | 899 | { |
@@ -2026,13 +2021,31 @@ int onplay(char* file, int attr, int from, bool hotkey) | |||
2026 | const struct menu_item_ex *menu; | 2021 | const struct menu_item_ex *menu; |
2027 | onplay_result = ONPLAY_OK; | 2022 | onplay_result = ONPLAY_OK; |
2028 | context = from; | 2023 | context = from; |
2029 | ctx_playlist_insert = NULL; | 2024 | ctx_current_playlist_insert = NULL; |
2030 | if (file == NULL) | 2025 | selected_file = NULL; |
2031 | selected_file = NULL; | 2026 | #ifdef HAVE_TAGCACHE |
2032 | else | 2027 | if (context == CONTEXT_ID3DB && |
2028 | (attr & FILE_ATTR_MASK) != FILE_ATTR_AUDIO) | ||
2033 | { | 2029 | { |
2034 | strmemccpy(selected_file_path, file, MAX_PATH); | 2030 | ctx_add_to_playlist = tagtree_add_to_playlist; |
2035 | selected_file = selected_file_path; | 2031 | if (file != NULL) |
2032 | { | ||
2033 | /* add a leading slash so that catalog_add_to_a_playlist | ||
2034 | later prefills the name when creating a new playlist */ | ||
2035 | snprintf(selected_file_path, MAX_PATH, "/%s", file); | ||
2036 | selected_file = selected_file_path; | ||
2037 | } | ||
2038 | } | ||
2039 | else | ||
2040 | #endif | ||
2041 | { | ||
2042 | ctx_add_to_playlist = NULL; | ||
2043 | if (file != NULL) | ||
2044 | { | ||
2045 | strmemccpy(selected_file_path, file, MAX_PATH); | ||
2046 | selected_file = selected_file_path; | ||
2047 | } | ||
2048 | |||
2036 | } | 2049 | } |
2037 | selected_file_attr = attr; | 2050 | selected_file_attr = attr; |
2038 | int menu_selection; | 2051 | int menu_selection; |
diff --git a/apps/onplay.h b/apps/onplay.h index 807bfe8cf7..ae23bdaefd 100644 --- a/apps/onplay.h +++ b/apps/onplay.h | |||
@@ -75,7 +75,8 @@ const struct hotkey_assignment *get_hotkey(int action); | |||
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | /* needed for the playlist viewer.. eventually clean this up */ | 77 | /* needed for the playlist viewer.. eventually clean this up */ |
78 | void onplay_show_playlist_cat_menu(char* track_name); | 78 | void onplay_show_playlist_cat_menu(const char* track_name, int attr, |
79 | void (*add_to_pl_cb)); | ||
79 | void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb)); | 80 | void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb)); |
80 | 81 | ||
81 | #endif | 82 | #endif |
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index c3cbc93a20..b6939208ac 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c | |||
@@ -389,9 +389,12 @@ bool catalog_view_playlists(void) | |||
389 | return (display_playlists(NULL, CATBROWSE_CATVIEW) >= 0); | 389 | return (display_playlists(NULL, CATBROWSE_CATVIEW) >= 0); |
390 | } | 390 | } |
391 | 391 | ||
392 | static int (*ctx_add_to_playlist)(const char* playlist, bool new_playlist); | ||
392 | bool catalog_add_to_a_playlist(const char* sel, int sel_attr, | 393 | bool catalog_add_to_a_playlist(const char* sel, int sel_attr, |
393 | bool new_playlist, char *m3u8name) | 394 | bool new_playlist, char *m3u8name, |
395 | void (*add_to_pl_cb)) | ||
394 | { | 396 | { |
397 | int result; | ||
395 | char playlist[MAX_PATH + 7]; /* room for /.m3u8\0*/ | 398 | char playlist[MAX_PATH + 7]; /* room for /.m3u8\0*/ |
396 | if ((browser_status & CATBROWSE_PLAYLIST) == CATBROWSE_PLAYLIST) | 399 | if ((browser_status & CATBROWSE_PLAYLIST) == CATBROWSE_PLAYLIST) |
397 | return false; | 400 | return false; |
@@ -437,8 +440,13 @@ bool catalog_add_to_a_playlist(const char* sel, int sel_attr, | |||
437 | return false; | 440 | return false; |
438 | } | 441 | } |
439 | 442 | ||
440 | if (add_to_playlist(playlist, new_playlist, sel, sel_attr) == 0) | 443 | if (add_to_pl_cb != NULL) |
441 | return true; | 444 | { |
445 | ctx_add_to_playlist = add_to_pl_cb; | ||
446 | result = ctx_add_to_playlist(playlist, new_playlist); | ||
447 | } | ||
442 | else | 448 | else |
443 | return false; | 449 | result = add_to_playlist(playlist, new_playlist, sel, sel_attr); |
450 | |||
451 | return (result == 0); | ||
444 | } | 452 | } |
diff --git a/apps/playlist_catalog.h b/apps/playlist_catalog.h index bb16e2dad9..fb71821093 100644 --- a/apps/playlist_catalog.h +++ b/apps/playlist_catalog.h | |||
@@ -41,9 +41,13 @@ bool catalog_view_playlists(void); | |||
41 | * new_playlist : whether we want to create a new playlist or add to an | 41 | * new_playlist : whether we want to create a new playlist or add to an |
42 | * existing one. | 42 | * existing one. |
43 | * m3u8name : filename to save the playlist to, NULL to show the keyboard | 43 | * m3u8name : filename to save the playlist to, NULL to show the keyboard |
44 | * add_to_pl_cb : can be NULL, or a function responsible for handling the | ||
45 | * insert operations itself, in case the caller wants full | ||
46 | * control over how and what files are actually added. | ||
44 | * ret : true if the file was successfully added | 47 | * ret : true if the file was successfully added |
45 | */ | 48 | */ |
46 | bool catalog_add_to_a_playlist(const char* sel, int sel_attr, | 49 | bool catalog_add_to_a_playlist(const char* sel, int sel_attr, |
47 | bool new_playlist, char* m3u8name); | 50 | bool new_playlist, char* m3u8name, |
51 | void (*add_to_pl_cb)); | ||
48 | 52 | ||
49 | #endif | 53 | #endif |
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index c9b027ea63..4e3d8bade2 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -630,7 +630,7 @@ static enum pv_onplay_result onplay_menu(int index) | |||
630 | break; | 630 | break; |
631 | case 1: | 631 | case 1: |
632 | /* add to catalog */ | 632 | /* add to catalog */ |
633 | onplay_show_playlist_cat_menu(current_track->name); | 633 | onplay_show_playlist_cat_menu(current_track->name, FILE_ATTR_AUDIO, NULL); |
634 | ret = PV_ONPLAY_UNCHANGED; | 634 | ret = PV_ONPLAY_UNCHANGED; |
635 | break; | 635 | break; |
636 | case 2: | 636 | case 2: |
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index c0d9e6d86f..50794c06c8 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c | |||
@@ -77,32 +77,6 @@ static char* strip_filename(char* buf, int buf_size, const char* fullpath) | |||
77 | return (sep + 1); | 77 | return (sep + 1); |
78 | } | 78 | } |
79 | 79 | ||
80 | /* Make sure part of path only contain chars valid for a FAT32 long name. | ||
81 | * Double quotes are replaced with single quotes, other unsupported chars | ||
82 | * are replaced with an underscore. | ||
83 | * | ||
84 | * path - path to modify. | ||
85 | * offset - where in path to start checking. | ||
86 | * count - number of chars to check. | ||
87 | */ | ||
88 | static void fix_path_part(char* path, int offset, int count) | ||
89 | { | ||
90 | static const char invalid_chars[] = "*/:<>?\\|"; | ||
91 | int i; | ||
92 | |||
93 | path += offset; | ||
94 | |||
95 | for (i = 0; i <= count; i++, path++) | ||
96 | { | ||
97 | if (*path == 0) | ||
98 | return; | ||
99 | if (*path == '"') | ||
100 | *path = '\''; | ||
101 | else if (strchr(invalid_chars, *path)) | ||
102 | *path = '_'; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | #ifdef USE_JPEG_COVER | 80 | #ifdef USE_JPEG_COVER |
107 | static const char * const extensions[] = { "jpeg", "jpg", "bmp" }; | 81 | static const char * const extensions[] = { "jpeg", "jpg", "bmp" }; |
108 | static const unsigned char extension_lens[] = { 4, 3, 3 }; | 82 | static const unsigned char extension_lens[] = { 4, 3, 3 }; |
diff --git a/apps/tagtree.c b/apps/tagtree.c index 11ea8ecf4e..85359cac04 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -2069,10 +2069,14 @@ int tagtree_get_filename(struct tree_context* c, char *buf, int buflen) | |||
2069 | return 0; | 2069 | return 0; |
2070 | } | 2070 | } |
2071 | 2071 | ||
2072 | static bool insert_all_playlist(struct tree_context *c, int position, bool queue) | 2072 | |
2073 | static bool insert_all_playlist(struct tree_context *c, | ||
2074 | const char* playlist, bool new_playlist, | ||
2075 | int position, bool queue) | ||
2073 | { | 2076 | { |
2074 | struct tagcache_search tcs; | 2077 | struct tagcache_search tcs; |
2075 | int i, n; | 2078 | int i, n; |
2079 | int fd = -1; | ||
2076 | unsigned long last_tick; | 2080 | unsigned long last_tick; |
2077 | char buf[MAX_PATH]; | 2081 | char buf[MAX_PATH]; |
2078 | 2082 | ||
@@ -2084,7 +2088,7 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue | |||
2084 | return false; | 2088 | return false; |
2085 | } | 2089 | } |
2086 | 2090 | ||
2087 | if (position == PLAYLIST_REPLACE) | 2091 | if (playlist == NULL && position == PLAYLIST_REPLACE) |
2088 | { | 2092 | { |
2089 | if (playlist_remove_all_tracks(NULL) == 0) | 2093 | if (playlist_remove_all_tracks(NULL) == 0) |
2090 | position = PLAYLIST_INSERT_LAST; | 2094 | position = PLAYLIST_INSERT_LAST; |
@@ -2094,6 +2098,19 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue | |||
2094 | return false; | 2098 | return false; |
2095 | } | 2099 | } |
2096 | } | 2100 | } |
2101 | else if (playlist != NULL) | ||
2102 | { | ||
2103 | if (new_playlist) | ||
2104 | fd = open_utf8(playlist, O_CREAT|O_WRONLY|O_TRUNC); | ||
2105 | else | ||
2106 | fd = open(playlist, O_CREAT|O_WRONLY|O_APPEND, 0666); | ||
2107 | |||
2108 | if(fd < 0) | ||
2109 | { | ||
2110 | cpu_boost(false); | ||
2111 | return false; | ||
2112 | } | ||
2113 | } | ||
2097 | 2114 | ||
2098 | last_tick = current_tick + HZ/2; /* Show splash after 0.5 seconds have passed */ | 2115 | last_tick = current_tick + HZ/2; /* Show splash after 0.5 seconds have passed */ |
2099 | splash_progress_set_delay(HZ / 2); /* wait 1/2 sec before progress */ | 2116 | splash_progress_set_delay(HZ / 2); /* wait 1/2 sec before progress */ |
@@ -2115,26 +2132,36 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue | |||
2115 | continue; | 2132 | continue; |
2116 | } | 2133 | } |
2117 | 2134 | ||
2118 | if (playlist_insert_track(NULL, buf, position, queue, false) < 0) | 2135 | if (playlist == NULL) |
2119 | { | 2136 | { |
2120 | logf("playlist_insert_track failed"); | 2137 | if (playlist_insert_track(NULL, buf, position, queue, false) < 0) |
2121 | break; | 2138 | { |
2139 | logf("playlist_insert_track failed"); | ||
2140 | break; | ||
2141 | } | ||
2122 | } | 2142 | } |
2143 | else if (fdprintf(fd, "%s\n", buf) <= 0) | ||
2144 | break; | ||
2145 | |||
2123 | yield(); | 2146 | yield(); |
2124 | 2147 | ||
2125 | if (position == PLAYLIST_INSERT_FIRST) | 2148 | if (playlist == NULL && position == PLAYLIST_INSERT_FIRST) |
2126 | { | 2149 | { |
2127 | position = PLAYLIST_INSERT; | 2150 | position = PLAYLIST_INSERT; |
2128 | } | 2151 | } |
2129 | } | 2152 | } |
2130 | playlist_sync(NULL); | 2153 | if (playlist == NULL) |
2154 | playlist_sync(NULL); | ||
2155 | else | ||
2156 | close(fd); | ||
2131 | tagcache_search_finish(&tcs); | 2157 | tagcache_search_finish(&tcs); |
2132 | cpu_boost(false); | 2158 | cpu_boost(false); |
2133 | 2159 | ||
2134 | return true; | 2160 | return true; |
2135 | } | 2161 | } |
2136 | 2162 | ||
2137 | bool tagtree_insert_selection_playlist(int position, bool queue) | 2163 | static bool tagtree_insert_selection(int position, bool queue, |
2164 | const char* playlist, bool new_playlist) | ||
2138 | { | 2165 | { |
2139 | char buf[MAX_PATH]; | 2166 | char buf[MAX_PATH]; |
2140 | int dirlevel = tc->dirlevel; | 2167 | int dirlevel = tc->dirlevel; |
@@ -2201,7 +2228,7 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
2201 | else | 2228 | else |
2202 | { | 2229 | { |
2203 | logf("insert_all_playlist"); | 2230 | logf("insert_all_playlist"); |
2204 | if (!insert_all_playlist(tc, position, queue)) | 2231 | if (!insert_all_playlist(tc, playlist, new_playlist, position, queue)) |
2205 | splash(HZ*2, ID2P(LANG_FAILED)); | 2232 | splash(HZ*2, ID2P(LANG_FAILED)); |
2206 | } | 2233 | } |
2207 | 2234 | ||
@@ -2214,6 +2241,20 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
2214 | return true; | 2241 | return true; |
2215 | } | 2242 | } |
2216 | 2243 | ||
2244 | |||
2245 | bool tagtree_current_playlist_insert(int position, bool queue) | ||
2246 | { | ||
2247 | return tagtree_insert_selection(position, queue, NULL, false); | ||
2248 | } | ||
2249 | |||
2250 | |||
2251 | int tagtree_add_to_playlist(const char* playlist, bool new_playlist) | ||
2252 | { | ||
2253 | if (!new_playlist) | ||
2254 | tagtree_load(tc); /* because display_playlists was called */ | ||
2255 | return tagtree_insert_selection(0, false, playlist, new_playlist) ? 0 : -1; | ||
2256 | } | ||
2257 | |||
2217 | static int tagtree_play_folder(struct tree_context* c) | 2258 | static int tagtree_play_folder(struct tree_context* c) |
2218 | { | 2259 | { |
2219 | int start_index = c->selected_item; | 2260 | int start_index = c->selected_item; |
@@ -2224,7 +2265,7 @@ static int tagtree_play_folder(struct tree_context* c) | |||
2224 | return -1; | 2265 | return -1; |
2225 | } | 2266 | } |
2226 | 2267 | ||
2227 | if (!insert_all_playlist(c, PLAYLIST_INSERT_LAST, false)) | 2268 | if (!insert_all_playlist(c, NULL, false, PLAYLIST_INSERT_LAST, false)) |
2228 | return -2; | 2269 | return -2; |
2229 | 2270 | ||
2230 | if (global_settings.playlist_shuffle) | 2271 | if (global_settings.playlist_shuffle) |
diff --git a/apps/tagtree.h b/apps/tagtree.h index 5c938b1541..6eaaf3dfac 100644 --- a/apps/tagtree.h +++ b/apps/tagtree.h | |||
@@ -39,7 +39,8 @@ void tagtree_exit(struct tree_context* c, bool is_visible); | |||
39 | int tagtree_load(struct tree_context* c); | 39 | int tagtree_load(struct tree_context* c); |
40 | char* tagtree_get_entry_name(struct tree_context *c, int id, | 40 | char* tagtree_get_entry_name(struct tree_context *c, int id, |
41 | char* buf, size_t bufsize); | 41 | char* buf, size_t bufsize); |
42 | bool tagtree_insert_selection_playlist(int position, bool queue); | 42 | bool tagtree_current_playlist_insert(int position, bool queue); |
43 | int tagtree_add_to_playlist(const char* playlist, bool new_playlist); | ||
43 | char *tagtree_get_title(struct tree_context* c); | 44 | char *tagtree_get_title(struct tree_context* c); |
44 | int tagtree_get_attr(struct tree_context* c); | 45 | int tagtree_get_attr(struct tree_context* c); |
45 | int tagtree_get_icon(struct tree_context* c); | 46 | int tagtree_get_icon(struct tree_context* c); |
diff --git a/apps/tree.c b/apps/tree.c index d2a7111e5f..5dd88c8e9d 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -811,7 +811,12 @@ static int dirbrowse(void) | |||
811 | tagtree_get_filename(&tc, buf, sizeof(buf)); | 811 | tagtree_get_filename(&tc, buf, sizeof(buf)); |
812 | } | 812 | } |
813 | else | 813 | else |
814 | { | ||
814 | attr = ATTR_DIRECTORY; | 815 | attr = ATTR_DIRECTORY; |
816 | tagtree_get_entry_name(&tc, tc.selected_item, | ||
817 | buf, sizeof(buf)); | ||
818 | fix_path_part(buf, 0, sizeof(buf)); | ||
819 | } | ||
815 | } | 820 | } |
816 | else | 821 | else |
817 | #endif | 822 | #endif |
@@ -956,7 +961,7 @@ int create_playlist(void) | |||
956 | #endif | 961 | #endif |
957 | 962 | ||
958 | trigger_cpu_boost(); | 963 | trigger_cpu_boost(); |
959 | ret = catalog_add_to_a_playlist(tc.currdir, ATTR_DIRECTORY, true, NULL); | 964 | ret = catalog_add_to_a_playlist(tc.currdir, ATTR_DIRECTORY, true, NULL, NULL); |
960 | cancel_cpu_boost(); | 965 | cancel_cpu_boost(); |
961 | 966 | ||
962 | return (ret) ? 1 : 0; | 967 | return (ret) ? 1 : 0; |