2003-07-01 21:05:43 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002 Bj<EFBFBD>rn Stenberg
|
|
|
|
|
*
|
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
|
*
|
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
|
* KIND, either express or implied.
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include "menu.h"
|
2005-06-24 16:32:30 +00:00
|
|
|
|
#include "file.h"
|
2003-07-01 21:05:43 +00:00
|
|
|
|
#include "keyboard.h"
|
|
|
|
|
#include "playlist.h"
|
|
|
|
|
#include "tree.h"
|
|
|
|
|
#include "settings.h"
|
2005-06-24 16:32:30 +00:00
|
|
|
|
#include "playlist_viewer.h"
|
2004-03-19 22:15:53 +00:00
|
|
|
|
#include "talk.h"
|
2003-07-01 21:05:43 +00:00
|
|
|
|
#include "lang.h"
|
2006-07-18 13:54:12 +00:00
|
|
|
|
#include "playlist_catalog.h"
|
2006-02-09 09:09:32 +00:00
|
|
|
|
#include "playlist_menu.h"
|
2003-07-01 21:05:43 +00:00
|
|
|
|
|
2005-06-24 16:32:30 +00:00
|
|
|
|
static bool save_playlist(void)
|
|
|
|
|
{
|
2006-02-09 09:09:32 +00:00
|
|
|
|
save_playlist_screen(NULL);
|
2005-06-24 16:32:30 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-01 21:05:43 +00:00
|
|
|
|
static bool recurse_directory(void)
|
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ STR(LANG_OFF) },
|
|
|
|
|
{ STR(LANG_ON) },
|
|
|
|
|
{ STR(LANG_RESUME_SETTING_ASK)},
|
|
|
|
|
};
|
2003-07-02 15:54:44 +00:00
|
|
|
|
|
2005-12-05 22:44:42 +00:00
|
|
|
|
return set_option( (char *)str(LANG_RECURSE_DIRECTORY),
|
2003-07-02 15:54:44 +00:00
|
|
|
|
&global_settings.recursive_dir_insert, INT, names, 3,
|
|
|
|
|
NULL );
|
2003-07-01 21:05:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-05 19:35:03 +00:00
|
|
|
|
static bool warnon_option(void)
|
|
|
|
|
{
|
|
|
|
|
return set_bool(str(LANG_WARN_ERASEDYNPLAYLIST_MENU),
|
|
|
|
|
&global_settings.warnon_erase_dynplaylist);
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-01 21:05:43 +00:00
|
|
|
|
bool playlist_menu(void)
|
|
|
|
|
{
|
|
|
|
|
int m;
|
|
|
|
|
bool result;
|
|
|
|
|
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct menu_item items[] = {
|
2006-07-18 13:54:12 +00:00
|
|
|
|
{ ID2P(LANG_CREATE_PLAYLIST), create_playlist },
|
|
|
|
|
{ ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer },
|
|
|
|
|
{ ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
|
|
|
|
|
{ ID2P(LANG_CATALOG), catalog_view_playlists },
|
|
|
|
|
{ ID2P(LANG_RECURSE_DIRECTORY), recurse_directory },
|
|
|
|
|
{ ID2P(LANG_WARN_ERASEDYNPLAYLIST_MENU), warnon_option },
|
2003-07-01 21:05:43 +00:00
|
|
|
|
};
|
2004-03-16 13:44:56 +00:00
|
|
|
|
|
|
|
|
|
m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL,
|
|
|
|
|
NULL, NULL, NULL );
|
2003-07-01 21:05:43 +00:00
|
|
|
|
result = menu_run(m);
|
|
|
|
|
menu_exit(m);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2006-02-09 09:09:32 +00:00
|
|
|
|
|
|
|
|
|
int save_playlist_screen(struct playlist_info* playlist)
|
|
|
|
|
{
|
|
|
|
|
char temp[MAX_PATH+1];
|
|
|
|
|
int len;
|
|
|
|
|
|
2006-12-03 20:45:12 +00:00
|
|
|
|
playlist_get_name(playlist, temp, sizeof(temp));
|
|
|
|
|
len = strlen(temp);
|
2006-02-09 09:09:32 +00:00
|
|
|
|
|
2006-12-03 20:45:12 +00:00
|
|
|
|
if (len > 4 && !strcasecmp(&temp[len-4], ".m3u"))
|
|
|
|
|
strcat(temp, "8");
|
|
|
|
|
|
|
|
|
|
if (len <= 5 || strcasecmp(&temp[len-5], ".m3u8"))
|
|
|
|
|
strcpy(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME);
|
2006-02-09 09:09:32 +00:00
|
|
|
|
|
2006-12-03 20:45:12 +00:00
|
|
|
|
if (!kbd_input(temp, sizeof(temp)))
|
2006-02-09 09:09:32 +00:00
|
|
|
|
{
|
2006-12-03 20:45:12 +00:00
|
|
|
|
playlist_save(playlist, temp);
|
2006-02-09 09:09:32 +00:00
|
|
|
|
|
|
|
|
|
/* reload in case playlist was saved to cwd */
|
|
|
|
|
reload_directory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|