Forgot to add Eric Clayton to the CREDITS file for FS #10234.
[kugel-rb.git] / apps / menus / playlist_menu.c
blob199c1e6081c2cfd4e29654be8c34aa4c011192bd
2 /***************************************************************************
3 * __________ __ ___.
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * \/ \/ \/ \/ \/
9 * $Id$
11 * Copyright (C) 2007 Jonathan Gordon
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
23 #include <stdbool.h>
24 #include <stddef.h>
25 #include <limits.h>
26 #include <string.h>
27 #include "config.h"
28 #include "lang.h"
29 #include "action.h"
30 #include "settings.h"
31 #include "menu.h"
32 #include "playlist_menu.h"
34 #include "file.h"
35 #include "keyboard.h"
36 #include "playlist.h"
37 #include "tree.h"
38 #include "playlist_viewer.h"
39 #include "talk.h"
40 #include "playlist_catalog.h"
42 int save_playlist_screen(struct playlist_info* playlist)
44 char temp[MAX_PATH+1];
45 int len;
47 playlist_get_name(playlist, temp, sizeof(temp));
48 len = strlen(temp);
50 if (len > 4 && !strcasecmp(&temp[len-4], ".m3u"))
51 strcat(temp, "8");
53 if (len <= 5 || strcasecmp(&temp[len-5], ".m3u8"))
54 strcpy(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME);
56 if (!kbd_input(temp, sizeof(temp)))
58 playlist_save(playlist, temp);
60 /* reload in case playlist was saved to cwd */
61 reload_directory();
64 return 0;
66 MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST),
67 (int(*)(void))create_playlist, NULL, NULL, Icon_NOICON);
68 MENUITEM_FUNCTION(view_playlist, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
69 (int(*)(void))playlist_viewer, NULL, NULL, Icon_NOICON);
70 MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
71 (int(*)(void*))save_playlist_screen,
72 NULL, NULL, Icon_NOICON);
73 MENUITEM_FUNCTION(catalog, 0, ID2P(LANG_CATALOG_VIEW),
74 (int(*)(void))catalog_view_playlists,
75 NULL, NULL, Icon_NOICON);
76 MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
77 MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
79 MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL,
80 Icon_Playlist,
81 &recursive_dir_insert, &warn_on_erase);
82 MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL,
83 Icon_Playlist,
84 &create_playlist_item, &view_playlist, &save_playlist, &catalog);