1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Björn Stenberg
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
28 #include "playlist_viewer.h"
31 #include "playlist_menu.h"
33 static bool save_playlist(void)
35 save_playlist_screen(NULL
);
39 static bool recurse_directory(void)
41 static const struct opt_items names
[] = {
44 { STR(LANG_RESUME_SETTING_ASK
)},
47 return set_option( (char *)str(LANG_RECURSE_DIRECTORY
),
48 &global_settings
.recursive_dir_insert
, INT
, names
, 3,
52 static bool warnon_option(void)
54 return set_bool(str(LANG_WARN_ERASEDYNPLAYLIST_MENU
),
55 &global_settings
.warnon_erase_dynplaylist
);
58 bool playlist_menu(void)
63 static const struct menu_item items
[] = {
64 { ID2P(LANG_CREATE_PLAYLIST
), create_playlist
},
65 { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST
), playlist_viewer
},
66 { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST
), save_playlist
},
67 { ID2P(LANG_RECURSE_DIRECTORY
), recurse_directory
},
68 { ID2P(LANG_WARN_ERASEDYNPLAYLIST_MENU
), warnon_option
},
71 m
= menu_init( items
, sizeof items
/ sizeof(struct menu_item
), NULL
,
78 int save_playlist_screen(struct playlist_info
* playlist
)
81 char temp
[MAX_PATH
+1];
84 filename
= playlist_get_name(playlist
, temp
, sizeof(temp
));
86 if (!filename
|| (len
=strlen(filename
)) <= 4 ||
87 strcasecmp(&filename
[len
-4], ".m3u"))
88 strcpy(filename
, DEFAULT_DYNAMIC_PLAYLIST_NAME
);
90 if (!kbd_input(filename
, sizeof(temp
)))
92 playlist_save(playlist
, filename
);
94 /* reload in case playlist was saved to cwd */