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_catalog.h"
32 #include "playlist_menu.h"
34 static bool save_playlist(void)
36 save_playlist_screen(NULL
);
40 static bool recurse_directory(void)
42 static const struct opt_items names
[] = {
45 { STR(LANG_RESUME_SETTING_ASK
)},
48 return set_option( (char *)str(LANG_RECURSE_DIRECTORY
),
49 &global_settings
.recursive_dir_insert
, INT
, names
, 3,
53 static bool warnon_option(void)
55 return set_bool(str(LANG_WARN_ERASEDYNPLAYLIST_MENU
),
56 &global_settings
.warnon_erase_dynplaylist
);
59 bool playlist_menu(void)
64 static const struct menu_item items
[] = {
65 { ID2P(LANG_CREATE_PLAYLIST
), create_playlist
},
66 { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST
), playlist_viewer
},
67 { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST
), save_playlist
},
68 { ID2P(LANG_CATALOG
), catalog_view_playlists
},
69 { ID2P(LANG_RECURSE_DIRECTORY
), recurse_directory
},
70 { ID2P(LANG_WARN_ERASEDYNPLAYLIST_MENU
), warnon_option
},
73 m
= menu_init( items
, sizeof items
/ sizeof(struct menu_item
), NULL
,
80 int save_playlist_screen(struct playlist_info
* playlist
)
83 char temp
[MAX_PATH
+1];
86 filename
= playlist_get_name(playlist
, temp
, sizeof(temp
));
88 if (!filename
|| (len
=strlen(filename
)) <= 4 ||
89 strcasecmp(&filename
[len
-4], ".m3u"))
90 strcpy(filename
, DEFAULT_DYNAMIC_PLAYLIST_NAME
);
92 if (!kbd_input(filename
, sizeof(temp
)))
94 playlist_save(playlist
, filename
);
96 /* reload in case playlist was saved to cwd */