1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
30 #include "playlist_menu.h"
36 #include "playlist_viewer.h"
38 #include "playlist_catalog.h"
41 int save_playlist_screen(struct playlist_info
* playlist
)
43 char temp
[MAX_PATH
+1], *dot
;
46 playlist_get_name(playlist
, temp
, sizeof(temp
)-1);
49 dot
= strrchr(temp
, '.');
52 /* folder of some type */
54 strcpy(&temp
[len
-1], ".m3u8");
56 snprintf(temp
, sizeof(temp
), "%s%s",
57 catalog_get_directory(), DEFAULT_DYNAMIC_PLAYLIST_NAME
);
59 else if (len
> 4 && !strcasecmp(dot
, ".m3u"))
62 if (!kbd_input(temp
, sizeof(temp
)))
64 playlist_save(playlist
, temp
);
66 /* reload in case playlist was saved to cwd */
73 static int playlist_view_(void)
75 playlist_viewer_ex(NULL
);
79 MENUITEM_FUNCTION(create_playlist_item
, 0, ID2P(LANG_CREATE_PLAYLIST
),
80 (int(*)(void))create_playlist
, NULL
, NULL
, Icon_NOICON
);
81 MENUITEM_FUNCTION(view_cur_playlist
, 0,
82 ID2P(LANG_VIEW_DYNAMIC_PLAYLIST
),
83 (int(*)(void))playlist_view_
, NULL
, NULL
, Icon_NOICON
);
84 MENUITEM_FUNCTION(save_playlist
, MENU_FUNC_USEPARAM
, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST
),
85 (int(*)(void*))save_playlist_screen
,
86 NULL
, NULL
, Icon_NOICON
);
87 MENUITEM_SETTING(recursive_dir_insert
, &global_settings
.recursive_dir_insert
, NULL
);
88 MENUITEM_SETTING(warn_on_erase
, &global_settings
.warnon_erase_dynplaylist
, NULL
);
89 static int clear_catalog_directory(void)
91 catalog_set_directory(NULL
);
93 splash(HZ
, ID2P(LANG_RESET_DONE_CLEAR
));
96 MENUITEM_FUNCTION(clear_catalog_directory_item
, 0, ID2P(LANG_RESET_PLAYLISTCAT_DIR
),
97 clear_catalog_directory
, NULL
, NULL
, Icon_file_view_menu
);
99 /* Playlist viewer settings submenu */
100 MENUITEM_SETTING(show_icons
, &global_settings
.playlist_viewer_icons
, NULL
);
101 MENUITEM_SETTING(show_indices
, &global_settings
.playlist_viewer_indices
, NULL
);
102 MENUITEM_SETTING(track_display
,
103 &global_settings
.playlist_viewer_track_display
, NULL
);
104 MAKE_MENU(viewer_settings_menu
, ID2P(LANG_PLAYLISTVIEWER_SETTINGS
),
106 &show_icons
, &show_indices
, &track_display
);
109 MAKE_MENU(playlist_settings
, ID2P(LANG_PLAYLISTS
), NULL
,
111 &viewer_settings_menu
, &recursive_dir_insert
, &warn_on_erase
);
112 MAKE_MENU(playlist_options
, ID2P(LANG_PLAYLISTS
), NULL
,
114 &create_playlist_item
, &view_cur_playlist
,
115 &save_playlist
, &clear_catalog_directory_item
);