Theme Editor: Added file filters with capitalized extensions for WPS, SBS, etc. files
[kugel-rb.git] / apps / menus / playlist_menu.c
blob2237761efd7e52b95eb066c4385ef955229be2a3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include <stdbool.h>
23 #include <string.h>
24 #include "config.h"
25 #include "lang.h"
26 #include "action.h"
27 #include "settings.h"
28 #include "menu.h"
29 #include "playlist_menu.h"
31 #include "file.h"
32 #include "keyboard.h"
33 #include "playlist.h"
34 #include "tree.h"
35 #include "playlist_viewer.h"
36 #include "talk.h"
37 #include "playlist_catalog.h"
39 int save_playlist_screen(struct playlist_info* playlist)
41 char temp[MAX_PATH+1];
42 int len;
44 playlist_get_name(playlist, temp, sizeof(temp));
45 len = strlen(temp);
47 if (len > 4 && !strcasecmp(&temp[len-4], ".m3u"))
48 strcat(temp, "8");
50 if (len <= 5 || strcasecmp(&temp[len-5], ".m3u8"))
51 strcpy(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME);
53 if (!kbd_input(temp, sizeof(temp)))
55 playlist_save(playlist, temp);
57 /* reload in case playlist was saved to cwd */
58 reload_directory();
61 return 0;
64 static int playlist_view_(void)
66 return GO_TO_PLAYLIST_VIEWER;
69 MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST),
70 (int(*)(void))create_playlist, NULL, NULL, Icon_NOICON);
71 MENUITEM_FUNCTION(view_cur_playlist, MENU_FUNC_CHECK_RETVAL,
72 ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
73 (int(*)(void))playlist_view_, NULL, NULL, Icon_NOICON);
74 MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
75 (int(*)(void*))save_playlist_screen,
76 NULL, NULL, Icon_NOICON);
77 MENUITEM_FUNCTION(catalog, 0, ID2P(LANG_CATALOG_VIEW),
78 (int(*)(void))catalog_view_playlists,
79 NULL, NULL, Icon_NOICON);
80 MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
81 MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
83 MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL,
84 Icon_Playlist,
85 &recursive_dir_insert, &warn_on_erase);
86 MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL,
87 Icon_Playlist,
88 &create_playlist_item, &view_cur_playlist, &save_playlist, &catalog);