summaryrefslogtreecommitdiff
path: root/apps/menus/playlist_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/menus/playlist_menu.c')
-rw-r--r--apps/menus/playlist_menu.c59
1 files changed, 2 insertions, 57 deletions
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c
index affe20418d..bfb94ccdad 100644
--- a/apps/menus/playlist_menu.c
+++ b/apps/menus/playlist_menu.c
@@ -38,7 +38,6 @@
38#include "talk.h" 38#include "talk.h"
39#include "playlist_catalog.h" 39#include "playlist_catalog.h"
40#include "splash.h" 40#include "splash.h"
41#include "filetree.h"
42#include "general.h" 41#include "general.h"
43 42
44/* load a screen to save the playlist passed in (or current playlist if NULL is passed) */ 43/* load a screen to save the playlist passed in (or current playlist if NULL is passed) */
@@ -46,11 +45,6 @@ int save_playlist_screen(struct playlist_info* playlist)
46{ 45{
47 46
48 char directoryonly[MAX_PATH+3]; 47 char directoryonly[MAX_PATH+3];
49 char *filename;
50
51 int resume_index;
52 uint32_t resume_elapsed;
53 uint32_t resume_offset;
54 48
55 char temp[MAX_PATH+1], *p; 49 char temp[MAX_PATH+1], *p;
56 int len; 50 int len;
@@ -86,55 +80,8 @@ int save_playlist_screen(struct playlist_info* playlist)
86 80
87 /* reload in case playlist was saved to cwd */ 81 /* reload in case playlist was saved to cwd */
88 reload_directory(); 82 reload_directory();
89
90 /* only reload newly saved playlist if:
91 * playlist is null AND setting is turned on
92 *
93 * if playlist is null, we should be dealing with the current playlist,
94 * and thus we got here from the wps screen. That means we want to reload
95 * the current playlist so the user can make bookmarks. */
96 if ((global_settings.playlist_reload_after_save == true) &&
97 (playlist == NULL))
98 {
99
100 /* at least one slash exists in temp */
101 if (strrchr(temp, '/') != NULL)
102 {
103 filename = strrchr(temp, '/') + 1;
104
105 if (temp[0] == '/') /* most common situation - first char is a slash */
106 {
107 strcpy(directoryonly, temp);
108 directoryonly[filename - temp] = '\0';
109 } else /* there is a slash, but not at the beginning of temp - prepend one */
110 {
111 directoryonly[0] = '/';
112
113 strcpy(directoryonly+1, temp);
114 directoryonly[filename - temp + 1] = '\0';
115 }
116 } else /* temp doesn't contain any slashes, uncommon? */
117 {
118 directoryonly[0] = '/';
119 directoryonly[1] = '\0';
120 filename = temp;
121 }
122
123 /* can't trust index from id3 (don't know why), get it from playlist */
124 resume_index = playlist_get_display_index() - 1;
125
126 struct mp3entry* id3 = audio_current_track();
127
128 /* record elapsed and offset so they don't change when we load new playlist */
129 resume_elapsed = id3->elapsed;
130 resume_offset = id3->offset;
131
132 ft_play_playlist(temp, directoryonly, filename, true);
133 playlist_start(resume_index, resume_elapsed, resume_offset);
134 }
135 /* cancelled out of name selection */
136 } else { 83 } else {
137 return 1; 84 return 1; /* cancelled out of name selection */
138 } 85 }
139 86
140 return 0; 87 return 0;
@@ -179,14 +126,12 @@ MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL)
179MENUITEM_SETTING(keep_current_track_on_replace, &global_settings.keep_current_track_on_replace_playlist, NULL); 126MENUITEM_SETTING(keep_current_track_on_replace, &global_settings.keep_current_track_on_replace_playlist, NULL);
180MENUITEM_SETTING(show_shuffled_adding_options, &global_settings.show_shuffled_adding_options, NULL); 127MENUITEM_SETTING(show_shuffled_adding_options, &global_settings.show_shuffled_adding_options, NULL);
181MENUITEM_SETTING(show_queue_options, &global_settings.show_queue_options, NULL); 128MENUITEM_SETTING(show_queue_options, &global_settings.show_queue_options, NULL);
182MENUITEM_SETTING(playlist_reload_after_save, &global_settings.playlist_reload_after_save, NULL);
183MAKE_MENU(currentplaylist_settings_menu, ID2P(LANG_CURRENT_PLAYLIST), 129MAKE_MENU(currentplaylist_settings_menu, ID2P(LANG_CURRENT_PLAYLIST),
184 NULL, Icon_Playlist, 130 NULL, Icon_Playlist,
185 &warn_on_erase, 131 &warn_on_erase,
186 &keep_current_track_on_replace, 132 &keep_current_track_on_replace,
187 &show_shuffled_adding_options, 133 &show_shuffled_adding_options,
188 &show_queue_options, 134 &show_queue_options);
189 &playlist_reload_after_save);
190 135
191MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL, 136MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL,
192 Icon_Playlist, 137 Icon_Playlist,