summaryrefslogtreecommitdiff
path: root/apps/filetree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/filetree.c')
-rw-r--r--apps/filetree.c80
1 files changed, 53 insertions, 27 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index 35be92e4b5..edd421cad9 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -79,6 +79,55 @@ int ft_build_playlist(struct tree_context* c, int start_index)
79 return start_index; 79 return start_index;
80} 80}
81 81
82/* Start playback of a playlist, checking for bookmark autoload, modified
83 * playlists, etc., as required. Returns false if playback wasn't started,
84 * or started via bookmark autoload, true otherwise.
85 *
86 * Pointers to both the full pathname and the separated parts needed to
87 * avoid allocating yet another path buffer on the stack (and save some
88 * code; the caller typically needs to create the full pathname anyway)...
89 */
90bool ft_play_playlist(char* pathname, char* dirname, char* filename)
91{
92 if (global_settings.party_mode)
93 {
94 gui_syncsplash(HZ, ID2P(LANG_PARTY_MODE));
95 return false;
96 }
97
98 if (bookmark_autoload(pathname))
99 {
100 return false;
101 }
102
103 gui_syncsplash(0, ID2P(LANG_WAIT));
104
105 /* about to create a new current playlist...
106 allow user to cancel the operation */
107 if (global_settings.warnon_erase_dynplaylist &&
108 playlist_modified(NULL))
109 {
110 char *lines[] = {ID2P(LANG_WARN_ERASEDYNPLAYLIST_PROMPT)};
111 struct text_message message = {lines, 1};
112
113 if (gui_syncyesno_run(&message, NULL, NULL) != YESNO_YES)
114 return false;
115 }
116
117 if (playlist_create(dirname, filename) != -1)
118 {
119 if (global_settings.playlist_shuffle)
120 {
121 playlist_shuffle(current_tick, -1);
122 }
123
124 playlist_start(0, 0);
125 return true;
126 }
127
128 return false;
129}
130
82/* walk a directory and check all dircache entries if a .talk file exists */ 131/* walk a directory and check all dircache entries if a .talk file exists */
83static void check_file_thumbnails(struct tree_context* c) 132static void check_file_thumbnails(struct tree_context* c)
84{ 133{
@@ -341,36 +390,13 @@ int ft_enter(struct tree_context* c)
341 390
342 switch ( file->attr & FILE_ATTR_MASK ) { 391 switch ( file->attr & FILE_ATTR_MASK ) {
343 case FILE_ATTR_M3U: 392 case FILE_ATTR_M3U:
344 if (global_settings.party_mode) { 393 play = ft_play_playlist(buf, c->currdir, file->name);
345 gui_syncsplash(HZ, ID2P(LANG_PARTY_MODE)); 394
346 break; 395 if (play)
347 }
348
349 if (bookmark_autoload(buf))
350 break;
351
352 gui_syncsplash(0, ID2P(LANG_WAIT));
353
354 /* about to create a new current playlist...
355 allow user to cancel the operation */
356 if (global_settings.warnon_erase_dynplaylist &&
357 playlist_modified(NULL))
358 { 396 {
359 char *lines[]={ID2P(LANG_WARN_ERASEDYNPLAYLIST_PROMPT)};
360 struct text_message message={lines, 1};
361
362 if(gui_syncyesno_run(&message, NULL, NULL) != YESNO_YES)
363 break;
364 }
365
366 if (playlist_create(c->currdir, file->name) != -1)
367 {
368 if (global_settings.playlist_shuffle)
369 playlist_shuffle(seed, -1);
370 start_index = 0; 397 start_index = 0;
371 playlist_start(start_index,0);
372 play = true;
373 } 398 }
399
374 break; 400 break;
375 401
376 case FILE_ATTR_AUDIO: 402 case FILE_ATTR_AUDIO: