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"
|
|
|
|
|
#include "file.h"
|
|
|
|
|
#include "keyboard.h"
|
|
|
|
|
#include "playlist.h"
|
|
|
|
|
#include "tree.h"
|
|
|
|
|
#include "settings.h"
|
2003-12-10 00:11:25 +00:00
|
|
|
|
#include "playlist_viewer.h"
|
2003-07-01 21:05:43 +00:00
|
|
|
|
|
|
|
|
|
#include "lang.h"
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_PLAYLIST_NAME "/dynamic.m3u"
|
|
|
|
|
|
|
|
|
|
static bool save_playlist(void)
|
|
|
|
|
{
|
|
|
|
|
char filename[MAX_PATH+1];
|
|
|
|
|
|
|
|
|
|
strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename));
|
|
|
|
|
|
|
|
|
|
if (!kbd_input(filename, sizeof(filename)))
|
|
|
|
|
{
|
2004-01-26 17:05:21 +00:00
|
|
|
|
playlist_save(NULL, filename);
|
2003-07-01 21:05:43 +00:00
|
|
|
|
|
|
|
|
|
/* reload in case playlist was saved to cwd */
|
|
|
|
|
reload_directory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool recurse_directory(void)
|
|
|
|
|
{
|
2003-07-02 15:54:44 +00:00
|
|
|
|
char* names[] = { str(LANG_OFF),
|
|
|
|
|
str(LANG_ON),
|
|
|
|
|
str(LANG_RESUME_SETTING_ASK) };
|
|
|
|
|
|
|
|
|
|
return set_option( str(LANG_RECURSE_DIRECTORY),
|
|
|
|
|
&global_settings.recursive_dir_insert, INT, names, 3,
|
|
|
|
|
NULL );
|
2003-07-01 21:05:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool playlist_menu(void)
|
|
|
|
|
{
|
|
|
|
|
int m;
|
|
|
|
|
bool result;
|
|
|
|
|
|
|
|
|
|
struct menu_items items[] = {
|
2004-03-14 21:33:53 +00:00
|
|
|
|
{ STR(LANG_CREATE_PLAYLIST), create_playlist },
|
|
|
|
|
{ STR(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer },
|
|
|
|
|
{ STR(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
|
|
|
|
|
{ STR(LANG_RECURSE_DIRECTORY), recurse_directory },
|
2003-07-01 21:05:43 +00:00
|
|
|
|
};
|
|
|
|
|
|
2004-03-12 10:20:33 +00:00
|
|
|
|
m = menu_init( items, sizeof items / sizeof(struct menu_items), NULL );
|
2003-07-01 21:05:43 +00:00
|
|
|
|
result = menu_run(m);
|
|
|
|
|
menu_exit(m);
|
|
|
|
|
return result;
|
|
|
|
|
}
|