2007-02-08 04:33:41 +00:00
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2007-02-13 00:32:17 +00:00
|
|
|
* $Id$
|
2007-02-08 04:33:41 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Jonathan Gordon
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2007-02-08 04:33:41 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <limits.h>
|
2007-02-11 07:32:58 +00:00
|
|
|
#include <string.h>
|
2007-02-08 04:33:41 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "lang.h"
|
|
|
|
#include "action.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "playlist_menu.h"
|
|
|
|
|
2007-02-11 07:32:58 +00:00
|
|
|
#include "menu.h"
|
|
|
|
#include "file.h"
|
|
|
|
#include "keyboard.h"
|
|
|
|
#include "playlist.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "playlist_viewer.h"
|
|
|
|
#include "talk.h"
|
|
|
|
#include "playlist_catalog.h"
|
|
|
|
|
|
|
|
int save_playlist_screen(struct playlist_info* playlist)
|
|
|
|
{
|
|
|
|
char temp[MAX_PATH+1];
|
|
|
|
int len;
|
|
|
|
|
|
|
|
playlist_get_name(playlist, temp, sizeof(temp));
|
|
|
|
len = strlen(temp);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (!kbd_input(temp, sizeof(temp)))
|
|
|
|
{
|
|
|
|
playlist_save(playlist, temp);
|
|
|
|
|
|
|
|
/* reload in case playlist was saved to cwd */
|
|
|
|
reload_directory();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST),
|
2007-03-18 07:03:43 +00:00
|
|
|
(int(*)(void))create_playlist, NULL, NULL, Icon_NOICON);
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(view_playlist, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
|
2007-03-18 07:03:43 +00:00
|
|
|
(int(*)(void))playlist_viewer, NULL, NULL, Icon_NOICON);
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
|
|
|
|
(int(*)(void*))save_playlist_screen,
|
2007-03-18 07:03:43 +00:00
|
|
|
NULL, NULL, Icon_NOICON);
|
2007-11-01 13:41:16 +00:00
|
|
|
MENUITEM_FUNCTION(catalog, 0, ID2P(LANG_CATALOG_VIEW),
|
2007-03-17 12:33:34 +00:00
|
|
|
(int(*)(void))catalog_view_playlists,
|
2007-03-18 07:03:43 +00:00
|
|
|
NULL, NULL, Icon_NOICON);
|
2007-02-11 07:32:58 +00:00
|
|
|
MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
|
|
|
|
MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
|
|
|
|
|
2007-08-05 19:19:39 +00:00
|
|
|
MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL,
|
2007-03-03 13:52:14 +00:00
|
|
|
Icon_Playlist,
|
2007-02-11 07:32:58 +00:00
|
|
|
&recursive_dir_insert, &warn_on_erase);
|
2007-08-05 19:19:39 +00:00
|
|
|
MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL,
|
2007-03-03 13:52:14 +00:00
|
|
|
Icon_Playlist,
|
2007-03-01 11:14:46 +00:00
|
|
|
&create_playlist_item, &view_playlist, &save_playlist, &catalog);
|
2007-02-08 04:33:41 +00:00
|
|
|
|