2005-02-09 10:56:54 +00:00
|
|
|
/***************************************************************************
|
2004-01-14 00:13:04 +00:00
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
2005-02-09 10:56:54 +00:00
|
|
|
* Copyright (C)2003 by Benjamin Metzler
|
2004-01-14 00:13:04 +00:00
|
|
|
*
|
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.
|
2004-01-14 00:13:04 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2008-04-28 16:28:21 +00:00
|
|
|
#include "config.h"
|
2006-08-15 12:27:07 +00:00
|
|
|
#include "action.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
#include "audio.h"
|
2005-11-17 20:14:59 +00:00
|
|
|
#include "playlist.h"
|
2004-01-14 00:13:04 +00:00
|
|
|
#include "settings.h"
|
2005-05-17 23:34:16 +00:00
|
|
|
#include "tree.h"
|
2004-01-14 00:13:04 +00:00
|
|
|
#include "bookmark.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "icons.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "lang.h"
|
2004-03-19 22:15:53 +00:00
|
|
|
#include "talk.h"
|
2004-07-26 16:06:59 +00:00
|
|
|
#include "misc.h"
|
2005-11-16 15:12:15 +00:00
|
|
|
#include "splash.h"
|
2005-11-20 01:02:14 +00:00
|
|
|
#include "yesno.h"
|
2007-05-26 10:44:38 +00:00
|
|
|
#include "list.h"
|
|
|
|
#include "plugin.h"
|
2008-04-28 16:28:21 +00:00
|
|
|
#include "file.h"
|
2009-11-26 22:34:08 +00:00
|
|
|
#include "filefuncs.h"
|
2006-07-15 14:40:44 +00:00
|
|
|
|
2004-03-02 13:50:35 +00:00
|
|
|
#define MAX_BOOKMARKS 10
|
2004-01-14 00:13:04 +00:00
|
|
|
#define MAX_BOOKMARK_SIZE 350
|
|
|
|
#define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark"
|
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
/* Used to buffer bookmarks while displaying the bookmark list. */
|
|
|
|
struct bookmark_list
|
|
|
|
{
|
|
|
|
const char* filename;
|
|
|
|
size_t buffer_size;
|
|
|
|
int start;
|
|
|
|
int count;
|
|
|
|
int total_count;
|
|
|
|
bool show_dont_resume;
|
|
|
|
bool reload;
|
2007-11-18 12:59:08 +00:00
|
|
|
bool show_playlist_name;
|
2007-05-26 10:44:38 +00:00
|
|
|
char* items[];
|
|
|
|
};
|
|
|
|
|
2010-04-10 21:17:09 +00:00
|
|
|
/* flags for optional bookmark tokens */
|
|
|
|
#define BM_PITCH 0x01
|
|
|
|
#define BM_SPEED 0x02
|
2010-04-06 21:49:33 +00:00
|
|
|
|
|
|
|
/* bookmark values */
|
|
|
|
static struct {
|
|
|
|
int resume_index;
|
|
|
|
unsigned long resume_offset;
|
|
|
|
int resume_seed;
|
2010-04-05 20:53:04 +00:00
|
|
|
long resume_time;
|
|
|
|
int repeat_mode;
|
|
|
|
bool shuffle;
|
2010-04-10 21:17:09 +00:00
|
|
|
/* optional values */
|
|
|
|
int pitch;
|
|
|
|
int speed;
|
2010-04-05 20:53:04 +00:00
|
|
|
} bm;
|
|
|
|
|
2007-02-20 21:08:54 +00:00
|
|
|
static bool add_bookmark(const char* bookmark_file_name, const char* bookmark,
|
|
|
|
bool most_recent);
|
2004-01-14 00:13:04 +00:00
|
|
|
static char* create_bookmark(void);
|
2004-08-18 01:09:31 +00:00
|
|
|
static bool delete_bookmark(const char* bookmark_file_name, int bookmark_id);
|
|
|
|
static void say_bookmark(const char* bookmark,
|
2008-07-15 16:10:15 +00:00
|
|
|
int bookmark_id, bool show_playlist_name);
|
2010-04-05 20:53:04 +00:00
|
|
|
static bool play_bookmark(const char* bookmark);
|
2004-08-18 01:09:31 +00:00
|
|
|
static bool generate_bookmark_file_name(const char *in);
|
2010-04-10 21:17:09 +00:00
|
|
|
static bool parse_bookmark(const char *bookmark, const bool get_filenames);
|
2010-04-05 20:53:04 +00:00
|
|
|
static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line);
|
2009-08-20 16:47:44 +00:00
|
|
|
static const char* get_bookmark_info(int list_index,
|
|
|
|
void* data,
|
|
|
|
char *buffer,
|
|
|
|
size_t buffer_len);
|
2012-03-11 05:47:28 +00:00
|
|
|
static int select_bookmark(const char* bookmark_file_name, bool show_dont_resume, char** selected_bookmark);
|
2008-07-16 06:10:26 +00:00
|
|
|
static bool write_bookmark(bool create_bookmark_file, const char *bookmark);
|
2004-08-18 01:09:31 +00:00
|
|
|
static int get_bookmark_count(const char* bookmark_file_name);
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2010-04-05 20:53:04 +00:00
|
|
|
#define TEMP_BUF_SIZE (MAX_PATH + 1)
|
|
|
|
static char global_temp_buffer[TEMP_BUF_SIZE];
|
2007-05-26 10:44:38 +00:00
|
|
|
/* File name created by generate_bookmark_file_name */
|
2004-01-14 00:13:04 +00:00
|
|
|
static char global_bookmark_file_name[MAX_PATH];
|
|
|
|
static char global_read_buffer[MAX_BOOKMARK_SIZE];
|
2007-05-26 10:44:38 +00:00
|
|
|
/* Bookmark created by create_bookmark*/
|
2004-01-14 00:13:04 +00:00
|
|
|
static char global_bookmark[MAX_BOOKMARK_SIZE];
|
2007-05-26 10:44:38 +00:00
|
|
|
/* Filename from parsed bookmark (can be made local where needed) */
|
2004-12-07 14:20:37 +00:00
|
|
|
static char global_filename[MAX_PATH];
|
2004-01-14 00:13:04 +00:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* This is an interface function from the context menu. */
|
|
|
|
/* Returns true on successful bookmark creation. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
bool bookmark_create_menu(void)
|
|
|
|
{
|
2012-03-11 05:47:28 +00:00
|
|
|
return write_bookmark(true, create_bookmark());
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* This function acts as the load interface from the context menu. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* This function determines the bookmark file name and then loads that file*/
|
2012-03-11 05:47:28 +00:00
|
|
|
/* for the user. The user can then select or delete previous bookmarks. */
|
|
|
|
/* This function returns BOOKMARK_SUCCESS on the selection of a track to */
|
|
|
|
/* resume, BOOKMARK_FAIL if the menu is exited without a selection and */
|
|
|
|
/* BOOKMARK_USB_CONNECTED if the menu is forced to exit due to a USB */
|
|
|
|
/* connection. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
2012-03-11 05:47:28 +00:00
|
|
|
int bookmark_load_menu(void)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2012-03-11 05:47:28 +00:00
|
|
|
char* bookmark;
|
|
|
|
int ret = BOOKMARK_FAIL;
|
2012-03-03 03:34:14 +00:00
|
|
|
|
|
|
|
push_current_activity(ACTIVITY_BOOKMARKSLIST);
|
2012-03-11 05:47:28 +00:00
|
|
|
|
|
|
|
char* name = playlist_get_name(NULL, global_temp_buffer,
|
2004-01-14 00:13:04 +00:00
|
|
|
sizeof(global_temp_buffer));
|
2012-03-11 05:47:28 +00:00
|
|
|
if (generate_bookmark_file_name(name))
|
|
|
|
{
|
|
|
|
ret = select_bookmark(global_bookmark_file_name, false, &bookmark);
|
|
|
|
if (bookmark != NULL)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2012-03-11 05:47:28 +00:00
|
|
|
ret = play_bookmark(bookmark) ? BOOKMARK_SUCCESS : BOOKMARK_FAIL;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-03 03:34:14 +00:00
|
|
|
pop_current_activity();
|
|
|
|
return ret;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* Gives the user a list of the Most Recent Bookmarks. This is an */
|
|
|
|
/* interface function */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true on the successful selection of a recent bookmark. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
bool bookmark_mrb_load()
|
|
|
|
{
|
2011-08-07 08:39:56 +00:00
|
|
|
char* bookmark;
|
|
|
|
bool ret = false;
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2011-08-07 08:39:56 +00:00
|
|
|
push_current_activity(ACTIVITY_BOOKMARKSLIST);
|
2012-03-11 05:47:28 +00:00
|
|
|
select_bookmark(RECENT_BOOKMARK_FILE, false, &bookmark);
|
2007-02-15 22:13:14 +00:00
|
|
|
if (bookmark != NULL)
|
|
|
|
{
|
2011-08-07 08:39:56 +00:00
|
|
|
ret = play_bookmark(bookmark);
|
2007-02-15 22:13:14 +00:00
|
|
|
}
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2011-08-07 08:39:56 +00:00
|
|
|
pop_current_activity();
|
2011-08-07 09:35:50 +00:00
|
|
|
return ret;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function handles an autobookmark creation. This is an interface */
|
|
|
|
/* function. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true on successful bookmark creation. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
2010-03-28 23:27:49 +00:00
|
|
|
bool bookmark_autobookmark(bool prompt_ok)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2008-07-15 19:50:22 +00:00
|
|
|
char* bookmark;
|
2010-07-06 17:03:45 +00:00
|
|
|
bool update;
|
|
|
|
|
2012-03-11 05:47:28 +00:00
|
|
|
if (!bookmark_is_bookmarkable_state())
|
2004-01-14 00:13:04 +00:00
|
|
|
return false;
|
|
|
|
|
2005-04-04 12:06:29 +00:00
|
|
|
audio_pause(); /* first pause playback */
|
2010-07-06 17:03:45 +00:00
|
|
|
update = (global_settings.autoupdatebookmark && bookmark_exists());
|
2008-07-15 19:50:22 +00:00
|
|
|
bookmark = create_bookmark();
|
2011-08-21 21:21:40 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2008-07-15 19:50:22 +00:00
|
|
|
/* Workaround for inability to speak when paused: all callers will
|
|
|
|
just do audio_stop() when we return, so we can do it right
|
|
|
|
away. This makes it possible to speak the "Create a Bookmark?"
|
|
|
|
prompt and the "Bookmark Created" splash. */
|
|
|
|
audio_stop();
|
2011-08-21 21:21:40 +00:00
|
|
|
#endif
|
2010-07-07 17:30:53 +00:00
|
|
|
|
2010-07-05 16:39:00 +00:00
|
|
|
if (update)
|
|
|
|
return write_bookmark(true, bookmark);
|
2010-07-07 17:30:53 +00:00
|
|
|
|
2004-01-14 00:13:04 +00:00
|
|
|
switch (global_settings.autocreatebookmark)
|
|
|
|
{
|
|
|
|
case BOOKMARK_YES:
|
2008-07-15 19:50:22 +00:00
|
|
|
return write_bookmark(true, bookmark);
|
2004-01-14 00:13:04 +00:00
|
|
|
|
|
|
|
case BOOKMARK_NO:
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case BOOKMARK_RECENT_ONLY_YES:
|
2008-07-15 19:50:22 +00:00
|
|
|
return write_bookmark(false, bookmark);
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2008-04-26 09:30:24 +00:00
|
|
|
const char *lines[]={ID2P(LANG_AUTO_BOOKMARK_QUERY)};
|
|
|
|
const struct text_message message={lines, 1};
|
2004-01-14 00:13:04 +00:00
|
|
|
#else
|
2008-04-26 09:30:24 +00:00
|
|
|
const char *lines[]={ID2P(LANG_AUTO_BOOKMARK_QUERY),
|
2007-08-05 19:19:39 +00:00
|
|
|
str(LANG_CONFIRM_WITH_BUTTON)};
|
2008-04-26 09:30:24 +00:00
|
|
|
const struct text_message message={lines, 2};
|
2006-07-15 14:23:14 +00:00
|
|
|
#endif
|
2009-08-06 00:14:40 +00:00
|
|
|
|
2010-03-28 23:27:49 +00:00
|
|
|
if(prompt_ok && gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2005-11-20 01:02:14 +00:00
|
|
|
if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK)
|
2008-07-15 19:50:22 +00:00
|
|
|
return write_bookmark(false, bookmark);
|
2005-11-20 01:02:14 +00:00
|
|
|
else
|
2008-07-15 19:50:22 +00:00
|
|
|
return write_bookmark(true, bookmark);
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
2004-10-24 21:45:37 +00:00
|
|
|
return false;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function takes the current current resume information and writes */
|
|
|
|
/* that to the beginning of the bookmark file. */
|
|
|
|
/* This file will contain N number of bookmarks in the following format: */
|
|
|
|
/* resume_index*resume_offset*resume_seed*resume_first_index* */
|
|
|
|
/* resume_file*milliseconds*MP3 Title* */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true on successful bookmark write. */
|
|
|
|
/* Returns false if any part of the bookmarking process fails. It is */
|
|
|
|
/* possible that a bookmark is successfully added to the most recent */
|
|
|
|
/* bookmark list but fails to be added to the bookmark file or vice versa. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ------------------------------------------------------------------------*/
|
2008-07-16 06:10:26 +00:00
|
|
|
static bool write_bookmark(bool create_bookmark_file, const char *bookmark)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2012-03-11 05:47:28 +00:00
|
|
|
bool ret=true;
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2012-03-11 05:47:28 +00:00
|
|
|
if (!bookmark)
|
|
|
|
{
|
|
|
|
ret = false; /* something didn't happen correctly, do nothing */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (global_settings.usemrb)
|
|
|
|
ret = add_bookmark(RECENT_BOOKMARK_FILE, bookmark, true);
|
2004-01-14 00:13:04 +00:00
|
|
|
|
|
|
|
|
2012-03-11 05:47:28 +00:00
|
|
|
/* writing the bookmark */
|
|
|
|
if (create_bookmark_file)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2012-03-11 05:47:28 +00:00
|
|
|
char* name = playlist_get_name(NULL, global_temp_buffer,
|
|
|
|
sizeof(global_temp_buffer));
|
|
|
|
if (generate_bookmark_file_name(name))
|
|
|
|
{
|
|
|
|
ret = ret & add_bookmark(global_bookmark_file_name, bookmark, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret = false; /* generating bookmark file failed */
|
|
|
|
}
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-11 05:47:28 +00:00
|
|
|
splash(HZ, ret ? ID2P(LANG_BOOKMARK_CREATE_SUCCESS)
|
2008-08-15 08:27:39 +00:00
|
|
|
: ID2P(LANG_BOOKMARK_CREATE_FAILURE));
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2012-03-11 05:47:28 +00:00
|
|
|
return ret;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function adds a bookmark to a file. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true on successful bookmark add. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ------------------------------------------------------------------------*/
|
2007-02-20 21:08:54 +00:00
|
|
|
static bool add_bookmark(const char* bookmark_file_name, const char* bookmark,
|
|
|
|
bool most_recent)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
|
|
|
int temp_bookmark_file = 0;
|
|
|
|
int bookmark_file = 0;
|
|
|
|
int bookmark_count = 0;
|
|
|
|
char* playlist = NULL;
|
|
|
|
char* cp;
|
2004-03-21 13:42:18 +00:00
|
|
|
char* tmp;
|
2004-01-14 00:13:04 +00:00
|
|
|
int len = 0;
|
|
|
|
bool unique = false;
|
|
|
|
|
|
|
|
/* Opening up a temp bookmark file */
|
|
|
|
snprintf(global_temp_buffer, sizeof(global_temp_buffer),
|
|
|
|
"%s.tmp", bookmark_file_name);
|
|
|
|
temp_bookmark_file = open(global_temp_buffer,
|
2010-05-06 17:35:13 +00:00
|
|
|
O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
2004-01-14 00:13:04 +00:00
|
|
|
if (temp_bookmark_file < 0)
|
|
|
|
return false; /* can't open the temp file */
|
|
|
|
|
2007-02-20 21:08:54 +00:00
|
|
|
if (most_recent && (global_settings.usemrb == BOOKMARK_UNIQUE_ONLY))
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
|
|
|
playlist = strchr(bookmark,'/');
|
|
|
|
cp = strrchr(bookmark,';');
|
|
|
|
len = cp - playlist;
|
|
|
|
unique = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Writing the new bookmark to the begining of the temp file */
|
|
|
|
write(temp_bookmark_file, bookmark, strlen(bookmark));
|
|
|
|
write(temp_bookmark_file, "\n", 1);
|
2004-03-02 13:50:35 +00:00
|
|
|
bookmark_count++;
|
2004-01-14 00:13:04 +00:00
|
|
|
|
|
|
|
/* Reading in the previous bookmarks and writing them to the temp file */
|
|
|
|
bookmark_file = open(bookmark_file_name, O_RDONLY);
|
|
|
|
if (bookmark_file >= 0)
|
|
|
|
{
|
|
|
|
while (read_line(bookmark_file, global_read_buffer,
|
2007-02-20 21:08:54 +00:00
|
|
|
sizeof(global_read_buffer)) > 0)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2004-03-02 13:50:35 +00:00
|
|
|
/* The MRB has a max of MAX_BOOKMARKS in it */
|
|
|
|
/* This keeps it from getting too large */
|
2007-02-20 21:08:54 +00:00
|
|
|
if (most_recent && (bookmark_count >= MAX_BOOKMARKS))
|
2004-03-02 13:50:35 +00:00
|
|
|
break;
|
|
|
|
|
2004-03-21 13:42:18 +00:00
|
|
|
cp = strchr(global_read_buffer,'/');
|
|
|
|
tmp = strrchr(global_read_buffer,';');
|
2010-04-10 21:17:09 +00:00
|
|
|
if (parse_bookmark(global_read_buffer, false) &&
|
2004-03-21 13:42:18 +00:00
|
|
|
(!unique || len != tmp -cp || strncmp(playlist,cp,len)))
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2004-03-21 13:42:18 +00:00
|
|
|
bookmark_count++;
|
|
|
|
write(temp_bookmark_file, global_read_buffer,
|
|
|
|
strlen(global_read_buffer));
|
|
|
|
write(temp_bookmark_file, "\n", 1);
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
close(bookmark_file);
|
|
|
|
}
|
|
|
|
close(temp_bookmark_file);
|
|
|
|
|
|
|
|
remove(bookmark_file_name);
|
|
|
|
rename(global_temp_buffer, bookmark_file_name);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function takes the system resume data and formats it into a valid */
|
|
|
|
/* bookmark. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns not NULL on successful bookmark format. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
static char* create_bookmark()
|
|
|
|
{
|
|
|
|
int resume_index = 0;
|
|
|
|
char *file;
|
|
|
|
|
2012-03-11 05:47:28 +00:00
|
|
|
if (!bookmark_is_bookmarkable_state())
|
2008-07-15 19:50:22 +00:00
|
|
|
return NULL; /* something didn't happen correctly, do nothing */
|
|
|
|
|
2004-01-14 00:13:04 +00:00
|
|
|
/* grab the currently playing track */
|
2005-04-04 12:06:29 +00:00
|
|
|
struct mp3entry *id3 = audio_current_track();
|
2004-01-14 00:13:04 +00:00
|
|
|
if(!id3)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* Get some basic resume information */
|
|
|
|
/* queue_resume and queue_resume_index are not used and can be ignored.*/
|
|
|
|
playlist_get_resume_info(&resume_index);
|
|
|
|
|
|
|
|
/* Get the currently playing file minus the path */
|
|
|
|
/* This is used when displaying the available bookmarks */
|
|
|
|
file = strrchr(id3->path,'/');
|
|
|
|
if(NULL == file)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* create the bookmark */
|
|
|
|
snprintf(global_bookmark, sizeof(global_bookmark),
|
2010-04-10 21:17:09 +00:00
|
|
|
/* new optional bookmark token descriptors should be inserted
|
|
|
|
just before the "%s;%s" in this line... */
|
2012-05-08 14:34:26 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
|
2010-05-06 21:04:40 +00:00
|
|
|
">%d;%d;%ld;%d;%ld;%d;%d;%ld;%ld;%s;%s",
|
2010-04-11 02:32:58 +00:00
|
|
|
#else
|
|
|
|
">%d;%d;%ld;%d;%ld;%d;%d;%s;%s",
|
2010-04-10 21:41:01 +00:00
|
|
|
#endif
|
2010-04-10 21:17:09 +00:00
|
|
|
/* ... their flags should go here ... */
|
2012-05-08 14:34:26 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
|
2010-04-10 21:17:09 +00:00
|
|
|
BM_PITCH | BM_SPEED,
|
2010-04-10 21:41:01 +00:00
|
|
|
#else
|
|
|
|
0,
|
|
|
|
#endif
|
2004-01-14 00:13:04 +00:00
|
|
|
resume_index,
|
|
|
|
id3->offset,
|
2004-01-26 17:05:21 +00:00
|
|
|
playlist_get_seed(NULL),
|
2004-01-14 00:13:04 +00:00
|
|
|
id3->elapsed,
|
|
|
|
global_settings.repeat_mode,
|
|
|
|
global_settings.playlist_shuffle,
|
2010-04-10 21:17:09 +00:00
|
|
|
/* ...and their values should go here */
|
2012-05-08 14:34:26 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
|
2010-05-06 21:04:40 +00:00
|
|
|
(long)sound_get_pitch(),
|
|
|
|
(long)dsp_get_timestretch(),
|
2010-04-10 21:41:01 +00:00
|
|
|
#endif
|
2010-04-10 21:17:09 +00:00
|
|
|
/* more mandatory tokens */
|
2004-01-26 17:05:21 +00:00
|
|
|
playlist_get_name(NULL, global_temp_buffer,
|
|
|
|
sizeof(global_temp_buffer)),
|
2004-01-14 00:13:04 +00:00
|
|
|
file+1);
|
|
|
|
|
|
|
|
/* checking to see if the bookmark is valid */
|
2010-04-10 21:17:09 +00:00
|
|
|
if (parse_bookmark(global_bookmark, false))
|
2004-01-14 00:13:04 +00:00
|
|
|
return global_bookmark;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function will determine if an autoload is necessary. This is an */
|
|
|
|
/* interface function. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true on bookmark load or bookmark selection. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ------------------------------------------------------------------------*/
|
2004-08-18 01:09:31 +00:00
|
|
|
bool bookmark_autoload(const char* file)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2012-03-11 05:47:28 +00:00
|
|
|
char* bookmark;
|
|
|
|
|
2004-01-14 00:13:04 +00:00
|
|
|
if(global_settings.autoloadbookmark == BOOKMARK_NO)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/*Checking to see if a bookmark file exists.*/
|
2004-06-22 06:23:14 +00:00
|
|
|
if(!generate_bookmark_file_name(file))
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2008-04-16 19:51:43 +00:00
|
|
|
|
|
|
|
if(!file_exists(global_bookmark_file_name))
|
2004-01-14 00:13:04 +00:00
|
|
|
return false;
|
2008-04-16 19:51:43 +00:00
|
|
|
|
2004-01-14 00:13:04 +00:00
|
|
|
if(global_settings.autoloadbookmark == BOOKMARK_YES)
|
|
|
|
{
|
|
|
|
return bookmark_load(global_bookmark_file_name, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-05 18:31:36 +00:00
|
|
|
int ret = select_bookmark(global_bookmark_file_name, true, &bookmark);
|
2006-07-18 19:11:56 +00:00
|
|
|
|
2007-08-11 14:44:05 +00:00
|
|
|
if (bookmark != NULL)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2008-02-10 12:16:27 +00:00
|
|
|
if (!play_bookmark(bookmark))
|
|
|
|
{
|
|
|
|
/* Selected bookmark not found. */
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
|
2008-02-10 12:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Act as if autoload was done even if it failed, since the
|
|
|
|
* user did make an active selection.
|
|
|
|
*/
|
|
|
|
return true;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
2006-08-20 17:25:56 +00:00
|
|
|
|
2013-03-05 18:31:36 +00:00
|
|
|
return ret != BOOKMARK_SUCCESS;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function loads the bookmark information into the resume memory. */
|
|
|
|
/* This is an interface function. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true on successful bookmark load. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ------------------------------------------------------------------------*/
|
2004-08-18 01:09:31 +00:00
|
|
|
bool bookmark_load(const char* file, bool autoload)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
|
|
|
int fd;
|
2008-02-10 12:16:27 +00:00
|
|
|
char* bookmark = NULL;
|
2004-01-14 00:13:04 +00:00
|
|
|
|
|
|
|
if(autoload)
|
|
|
|
{
|
|
|
|
fd = open(file, O_RDONLY);
|
|
|
|
if(fd >= 0)
|
|
|
|
{
|
2007-02-20 21:08:54 +00:00
|
|
|
if(read_line(fd, global_read_buffer, sizeof(global_read_buffer)) > 0)
|
2004-01-14 00:13:04 +00:00
|
|
|
bookmark=global_read_buffer;
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* This is not an auto-load, so list the bookmarks */
|
2012-03-11 05:47:28 +00:00
|
|
|
select_bookmark(file, false, &bookmark);
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
2007-02-15 22:13:14 +00:00
|
|
|
if (bookmark != NULL)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2008-02-10 12:16:27 +00:00
|
|
|
if (!play_bookmark(bookmark))
|
|
|
|
{
|
|
|
|
/* Selected bookmark not found. */
|
2008-02-21 21:01:42 +00:00
|
|
|
if (!autoload)
|
|
|
|
{
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
|
2008-02-21 21:01:42 +00:00
|
|
|
}
|
|
|
|
|
2008-02-10 12:16:27 +00:00
|
|
|
return false;
|
|
|
|
}
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
2007-02-15 22:13:14 +00:00
|
|
|
return true;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-18 01:09:31 +00:00
|
|
|
static int get_bookmark_count(const char* bookmark_file_name)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
|
|
|
int read_count = 0;
|
|
|
|
int file = open(bookmark_file_name, O_RDONLY);
|
|
|
|
|
|
|
|
if(file < 0)
|
|
|
|
return -1;
|
|
|
|
|
2007-02-20 21:08:54 +00:00
|
|
|
while(read_line(file, global_read_buffer, sizeof(global_read_buffer)) > 0)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-02-20 21:08:54 +00:00
|
|
|
read_count++;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
close(file);
|
|
|
|
return read_count;
|
2007-05-26 10:44:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line)
|
|
|
|
{
|
|
|
|
char* dest = ((char*) bookmarks) + bookmarks->buffer_size - 1;
|
|
|
|
int read_count = 0;
|
|
|
|
int file = open(bookmarks->filename, O_RDONLY);
|
|
|
|
|
|
|
|
if (file < 0)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((first_line != 0) && ((size_t) filesize(file) < bookmarks->buffer_size
|
|
|
|
- sizeof(*bookmarks) - (sizeof(char*) * bookmarks->total_count)))
|
|
|
|
{
|
|
|
|
/* Entire file fits in buffer */
|
|
|
|
first_line = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bookmarks->start = first_line;
|
|
|
|
bookmarks->count = 0;
|
|
|
|
bookmarks->reload = false;
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
while(read_line(file, global_read_buffer, sizeof(global_read_buffer)) > 0)
|
|
|
|
{
|
|
|
|
read_count++;
|
|
|
|
|
|
|
|
if (read_count >= first_line)
|
|
|
|
{
|
|
|
|
dest -= strlen(global_read_buffer) + 1;
|
|
|
|
|
|
|
|
if (dest < ((char*) bookmarks) + sizeof(*bookmarks)
|
|
|
|
+ (sizeof(char*) * (bookmarks->count + 1)))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(dest, global_read_buffer);
|
|
|
|
bookmarks->items[bookmarks->count] = dest;
|
|
|
|
bookmarks->count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close(file);
|
|
|
|
return bookmarks->start + bookmarks->count;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
2009-08-20 16:47:44 +00:00
|
|
|
static const char* get_bookmark_info(int list_index,
|
|
|
|
void* data,
|
|
|
|
char *buffer,
|
|
|
|
size_t buffer_len)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-05-26 10:44:38 +00:00
|
|
|
struct bookmark_list* bookmarks = (struct bookmark_list*) data;
|
|
|
|
int index = list_index / 2;
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
if (bookmarks->show_dont_resume)
|
|
|
|
{
|
|
|
|
if (index == 0)
|
|
|
|
{
|
|
|
|
return list_index % 2 == 0
|
|
|
|
? (char*) str(LANG_BOOKMARK_DONT_RESUME) : " ";
|
|
|
|
}
|
|
|
|
|
|
|
|
index--;
|
|
|
|
}
|
2007-02-19 18:07:27 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
if (bookmarks->reload || (index >= bookmarks->start + bookmarks->count)
|
|
|
|
|| (index < bookmarks->start))
|
|
|
|
{
|
|
|
|
int read_index = index;
|
|
|
|
|
|
|
|
/* Using count as a guide on how far to move could possibly fail
|
|
|
|
* sometimes. Use byte count if that is a problem?
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (read_index != 0)
|
|
|
|
{
|
|
|
|
/* Move count * 3 / 4 items in the direction the user is moving,
|
|
|
|
* but don't go too close to the end.
|
|
|
|
*/
|
|
|
|
int offset = bookmarks->count;
|
|
|
|
int max = bookmarks->total_count - (bookmarks->count / 2);
|
|
|
|
|
|
|
|
if (read_index < bookmarks->start)
|
|
|
|
{
|
|
|
|
offset *= 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
read_index = index - offset / 4;
|
2004-03-21 13:35:54 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
if (read_index > max)
|
|
|
|
{
|
|
|
|
read_index = max;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read_index < 0)
|
|
|
|
{
|
|
|
|
read_index = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buffer_bookmarks(bookmarks, read_index) <= index)
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-10 21:17:09 +00:00
|
|
|
if (!parse_bookmark(bookmarks->items[index - bookmarks->start], true))
|
2007-04-05 02:50:43 +00:00
|
|
|
{
|
2007-05-26 10:44:38 +00:00
|
|
|
return list_index % 2 == 0 ? (char*) str(LANG_BOOKMARK_INVALID) : " ";
|
2007-04-05 02:50:43 +00:00
|
|
|
}
|
2007-05-26 10:44:38 +00:00
|
|
|
|
|
|
|
if (list_index % 2 == 0)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-11-18 12:59:08 +00:00
|
|
|
char *name;
|
|
|
|
char *format;
|
|
|
|
int len = strlen(global_temp_buffer);
|
|
|
|
|
|
|
|
if (bookmarks->show_playlist_name && len > 0)
|
|
|
|
{
|
|
|
|
name = global_temp_buffer;
|
|
|
|
len--;
|
|
|
|
|
|
|
|
if (name[len] != '/')
|
|
|
|
{
|
|
|
|
strrsplt(name, '.');
|
|
|
|
}
|
|
|
|
else if (len > 1)
|
|
|
|
{
|
|
|
|
name[len] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len > 1)
|
|
|
|
{
|
|
|
|
name = strrsplt(name, '/');
|
|
|
|
}
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2007-11-18 12:59:08 +00:00
|
|
|
format = "%s : %s";
|
|
|
|
}
|
|
|
|
else
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-11-18 12:59:08 +00:00
|
|
|
name = global_filename;
|
|
|
|
format = "%s";
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
2007-11-18 12:59:08 +00:00
|
|
|
|
|
|
|
strrsplt(global_filename, '.');
|
2008-04-09 15:25:17 +00:00
|
|
|
snprintf(buffer, buffer_len, format, name, global_filename);
|
2007-11-18 12:59:08 +00:00
|
|
|
return buffer;
|
2007-05-26 10:44:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char time_buf[32];
|
|
|
|
|
2010-04-05 20:53:04 +00:00
|
|
|
format_time(time_buf, sizeof(time_buf), bm.resume_time);
|
|
|
|
snprintf(buffer, buffer_len, "%s, %d%s", time_buf, bm.resume_index + 1,
|
|
|
|
bm.shuffle ? (char*) str(LANG_BOOKMARK_SHUFFLE) : "");
|
2007-05-26 10:44:38 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-15 16:10:15 +00:00
|
|
|
static int bookmark_list_voice_cb(int list_index, void* data)
|
|
|
|
{
|
|
|
|
struct bookmark_list* bookmarks = (struct bookmark_list*) data;
|
|
|
|
int index = list_index / 2;
|
|
|
|
|
|
|
|
if (bookmarks->show_dont_resume)
|
|
|
|
{
|
|
|
|
if (index == 0)
|
|
|
|
return talk_id(LANG_BOOKMARK_DONT_RESUME, false);
|
|
|
|
index--;
|
|
|
|
}
|
|
|
|
say_bookmark(bookmarks->items[index - bookmarks->start], index,
|
|
|
|
bookmarks->show_playlist_name);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* This displays the bookmarks in a file and allows the user to */
|
2007-05-26 10:44:38 +00:00
|
|
|
/* select one to play. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* *selected_bookmark contains a non NULL value on successful bookmark */
|
|
|
|
/* selection. */
|
|
|
|
/* Returns BOOKMARK_SUCCESS on successful bookmark selection, BOOKMARK_FAIL*/
|
|
|
|
/* if no selection was made and BOOKMARK_USB_CONNECTED if the selection */
|
|
|
|
/* menu is forced to exit due to a USB connection. */
|
2007-05-26 10:44:38 +00:00
|
|
|
/* ------------------------------------------------------------------------*/
|
2012-03-11 05:47:28 +00:00
|
|
|
static int select_bookmark(const char* bookmark_file_name, bool show_dont_resume, char** selected_bookmark)
|
2007-05-26 10:44:38 +00:00
|
|
|
{
|
|
|
|
struct bookmark_list* bookmarks;
|
|
|
|
struct gui_synclist list;
|
|
|
|
int item = 0;
|
|
|
|
int action;
|
|
|
|
size_t size;
|
|
|
|
bool exit = false;
|
|
|
|
bool refresh = true;
|
2012-03-11 05:47:28 +00:00
|
|
|
int ret = BOOKMARK_FAIL;
|
2007-05-26 10:44:38 +00:00
|
|
|
|
|
|
|
bookmarks = plugin_get_buffer(&size);
|
|
|
|
bookmarks->buffer_size = size;
|
|
|
|
bookmarks->show_dont_resume = show_dont_resume;
|
|
|
|
bookmarks->filename = bookmark_file_name;
|
|
|
|
bookmarks->start = 0;
|
2007-11-18 12:59:08 +00:00
|
|
|
bookmarks->show_playlist_name
|
|
|
|
= strcmp(bookmark_file_name, RECENT_BOOKMARK_FILE) == 0;
|
2008-03-26 03:35:24 +00:00
|
|
|
gui_synclist_init(&list, &get_bookmark_info, (void*) bookmarks, false, 2, NULL);
|
2008-07-15 16:10:15 +00:00
|
|
|
if(global_settings.talk_menu)
|
|
|
|
gui_synclist_set_voice_callback(&list, bookmark_list_voice_cb);
|
2007-05-26 10:44:38 +00:00
|
|
|
gui_synclist_set_title(&list, str(LANG_BOOKMARK_SELECT_BOOKMARK),
|
|
|
|
Icon_Bookmark);
|
|
|
|
|
|
|
|
while (!exit)
|
|
|
|
{
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
if (refresh)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-05-26 10:44:38 +00:00
|
|
|
int count = get_bookmark_count(bookmark_file_name);
|
|
|
|
bookmarks->total_count = count;
|
|
|
|
|
|
|
|
if (bookmarks->total_count < 1)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-05-26 10:44:38 +00:00
|
|
|
/* No more bookmarks, delete file and exit */
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ, ID2P(LANG_BOOKMARK_LOAD_EMPTY));
|
2004-01-14 00:13:04 +00:00
|
|
|
remove(bookmark_file_name);
|
2012-03-11 05:47:28 +00:00
|
|
|
*selected_bookmark = NULL;
|
|
|
|
return BOOKMARK_FAIL;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
2007-05-26 10:44:38 +00:00
|
|
|
|
|
|
|
if (bookmarks->show_dont_resume)
|
|
|
|
{
|
|
|
|
count++;
|
|
|
|
item++;
|
|
|
|
}
|
|
|
|
|
|
|
|
gui_synclist_set_nb_items(&list, count * 2);
|
|
|
|
|
|
|
|
if (item >= count)
|
|
|
|
{
|
|
|
|
/* Selected item has been deleted */
|
|
|
|
item = count - 1;
|
|
|
|
gui_synclist_select_item(&list, item * 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer_bookmarks(bookmarks, bookmarks->start);
|
|
|
|
gui_synclist_draw(&list);
|
2008-07-15 16:10:15 +00:00
|
|
|
cond_talk_ids_fq(VOICE_EXT_BMARK);
|
|
|
|
gui_synclist_speak_item(&list);
|
2007-05-26 10:44:38 +00:00
|
|
|
refresh = false;
|
|
|
|
}
|
|
|
|
|
2008-07-15 16:10:15 +00:00
|
|
|
list_do_action(CONTEXT_BOOKMARKSCREEN, HZ / 2,
|
|
|
|
&list, &action, LIST_WRAP_UNLESS_HELD);
|
2007-05-26 10:44:38 +00:00
|
|
|
item = gui_synclist_get_sel_pos(&list) / 2;
|
|
|
|
|
|
|
|
if (bookmarks->show_dont_resume)
|
|
|
|
{
|
|
|
|
item--;
|
|
|
|
}
|
2008-07-15 16:10:15 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
if (action == ACTION_STD_CONTEXT)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-05-26 10:44:38 +00:00
|
|
|
MENUITEM_STRINGLIST(menu_items, ID2P(LANG_BOOKMARK_CONTEXT_MENU),
|
|
|
|
NULL, ID2P(LANG_BOOKMARK_CONTEXT_RESUME),
|
|
|
|
ID2P(LANG_BOOKMARK_CONTEXT_DELETE));
|
|
|
|
static const int menu_actions[] =
|
|
|
|
{
|
|
|
|
ACTION_STD_OK, ACTION_BMS_DELETE
|
|
|
|
};
|
2008-03-26 03:35:24 +00:00
|
|
|
int selection = do_menu(&menu_items, NULL, NULL, false);
|
2007-05-26 10:44:38 +00:00
|
|
|
|
|
|
|
refresh = true;
|
|
|
|
|
|
|
|
if (selection >= 0 && selection <=
|
|
|
|
(int) (sizeof(menu_actions) / sizeof(menu_actions[0])))
|
|
|
|
{
|
|
|
|
action = menu_actions[selection];
|
|
|
|
}
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
switch (action)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-05-26 10:44:38 +00:00
|
|
|
case ACTION_STD_OK:
|
|
|
|
if (item >= 0)
|
|
|
|
{
|
2008-07-15 16:10:15 +00:00
|
|
|
talk_shutup();
|
2012-03-11 05:47:28 +00:00
|
|
|
*selected_bookmark = bookmarks->items[item - bookmarks->start];
|
|
|
|
return BOOKMARK_SUCCESS;
|
2007-05-26 10:44:38 +00:00
|
|
|
}
|
2013-03-05 18:31:36 +00:00
|
|
|
exit = true;
|
|
|
|
ret = BOOKMARK_SUCCESS;
|
|
|
|
break;
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
case ACTION_TREE_WPS:
|
|
|
|
case ACTION_STD_CANCEL:
|
|
|
|
exit = true;
|
|
|
|
break;
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
case ACTION_BMS_DELETE:
|
|
|
|
if (item >= 0)
|
2009-12-16 08:18:40 +00:00
|
|
|
{
|
|
|
|
const char *lines[]={
|
2009-12-16 08:38:27 +00:00
|
|
|
ID2P(LANG_REALLY_DELETE)
|
2009-12-16 08:18:40 +00:00
|
|
|
};
|
|
|
|
const char *yes_lines[]={
|
2009-12-16 08:38:27 +00:00
|
|
|
ID2P(LANG_DELETING)
|
2009-12-16 08:18:40 +00:00
|
|
|
};
|
|
|
|
|
2009-12-16 08:38:27 +00:00
|
|
|
const struct text_message message={lines, 1};
|
|
|
|
const struct text_message yes_message={yes_lines, 1};
|
2009-12-16 08:18:40 +00:00
|
|
|
|
|
|
|
if(gui_syncyesno_run(&message, &yes_message, NULL)==YESNO_YES)
|
|
|
|
{
|
|
|
|
delete_bookmark(bookmark_file_name, item);
|
|
|
|
bookmarks->reload = true;
|
|
|
|
}
|
2007-05-26 10:44:38 +00:00
|
|
|
refresh = true;
|
|
|
|
}
|
|
|
|
break;
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
default:
|
|
|
|
if (default_event_handler(action) == SYS_USB_CONNECTED)
|
|
|
|
{
|
2012-03-11 05:47:28 +00:00
|
|
|
ret = BOOKMARK_USB_CONNECTED;
|
2007-05-26 10:44:38 +00:00
|
|
|
exit = true;
|
|
|
|
}
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2007-05-26 10:44:38 +00:00
|
|
|
break;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
}
|
2007-05-26 10:44:38 +00:00
|
|
|
|
2008-07-15 16:10:15 +00:00
|
|
|
talk_shutup();
|
2012-03-11 05:47:28 +00:00
|
|
|
*selected_bookmark = NULL;
|
|
|
|
return ret;
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function takes a location in a bookmark file and deletes that */
|
|
|
|
/* bookmark. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true on successful bookmark deletion. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ------------------------------------------------------------------------*/
|
2004-08-18 01:09:31 +00:00
|
|
|
static bool delete_bookmark(const char* bookmark_file_name, int bookmark_id)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
|
|
|
int temp_bookmark_file = 0;
|
|
|
|
int bookmark_file = 0;
|
|
|
|
int bookmark_count = 0;
|
|
|
|
|
|
|
|
/* Opening up a temp bookmark file */
|
|
|
|
snprintf(global_temp_buffer, sizeof(global_temp_buffer),
|
|
|
|
"%s.tmp", bookmark_file_name);
|
|
|
|
temp_bookmark_file = open(global_temp_buffer,
|
2010-05-06 17:35:13 +00:00
|
|
|
O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2007-02-20 21:08:54 +00:00
|
|
|
if (temp_bookmark_file < 0)
|
|
|
|
return false; /* can't open the temp file */
|
2004-01-14 00:13:04 +00:00
|
|
|
|
|
|
|
/* Reading in the previous bookmarks and writing them to the temp file */
|
2007-02-20 21:08:54 +00:00
|
|
|
bookmark_file = open(bookmark_file_name, O_RDONLY);
|
|
|
|
if (bookmark_file >= 0)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-02-20 21:08:54 +00:00
|
|
|
while (read_line(bookmark_file, global_read_buffer,
|
|
|
|
sizeof(global_read_buffer)) > 0)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
|
|
|
if (bookmark_id != bookmark_count)
|
|
|
|
{
|
|
|
|
write(temp_bookmark_file, global_read_buffer,
|
|
|
|
strlen(global_read_buffer));
|
|
|
|
write(temp_bookmark_file, "\n", 1);
|
|
|
|
}
|
|
|
|
bookmark_count++;
|
|
|
|
}
|
2007-02-20 21:08:54 +00:00
|
|
|
close(bookmark_file);
|
2004-01-14 00:13:04 +00:00
|
|
|
}
|
|
|
|
close(temp_bookmark_file);
|
|
|
|
|
|
|
|
remove(bookmark_file_name);
|
|
|
|
rename(global_temp_buffer, bookmark_file_name);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2004-04-12 12:29:44 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function parses a bookmark, says the voice UI part of it. */
|
|
|
|
/* ------------------------------------------------------------------------*/
|
2004-08-18 01:09:31 +00:00
|
|
|
static void say_bookmark(const char* bookmark,
|
2008-07-15 16:10:15 +00:00
|
|
|
int bookmark_id, bool show_playlist_name)
|
2004-04-12 12:29:44 +00:00
|
|
|
{
|
2010-04-10 21:17:09 +00:00
|
|
|
if (!parse_bookmark(bookmark, true))
|
2007-05-26 10:44:38 +00:00
|
|
|
{
|
2008-07-15 16:10:15 +00:00
|
|
|
talk_id(LANG_BOOKMARK_INVALID, false);
|
2007-05-26 10:44:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-07-15 16:10:15 +00:00
|
|
|
talk_number(bookmark_id + 1, false);
|
|
|
|
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2011-05-24 10:56:01 +00:00
|
|
|
bool is_dir = (global_temp_buffer[0]
|
|
|
|
&& global_temp_buffer[strlen(global_temp_buffer)-1] == '/');
|
|
|
|
|
2008-07-15 16:10:15 +00:00
|
|
|
/* HWCODEC cannot enqueue voice file entries and .talk thumbnails
|
|
|
|
together, because there is no guarantee that the same mp3
|
|
|
|
parameters are used. */
|
|
|
|
if(show_playlist_name)
|
|
|
|
{ /* It's useful to know which playlist this is */
|
|
|
|
if(is_dir)
|
|
|
|
talk_dir_or_spell(global_temp_buffer,
|
|
|
|
TALK_IDARRAY(VOICE_DIR), true);
|
|
|
|
else talk_file_or_spell(NULL, global_temp_buffer,
|
|
|
|
TALK_IDARRAY(LANG_PLAYLIST), true);
|
2004-04-12 12:29:44 +00:00
|
|
|
}
|
2008-07-15 16:10:15 +00:00
|
|
|
#else
|
|
|
|
(void)show_playlist_name;
|
2004-04-12 12:29:44 +00:00
|
|
|
#endif
|
2008-07-15 16:10:15 +00:00
|
|
|
|
2010-04-05 20:53:04 +00:00
|
|
|
if(bm.shuffle)
|
2008-07-15 16:10:15 +00:00
|
|
|
talk_id(LANG_SHUFFLE, true);
|
|
|
|
|
2007-05-26 11:59:24 +00:00
|
|
|
talk_id(VOICE_BOOKMARK_SELECT_INDEX_TEXT, true);
|
2010-04-05 20:53:04 +00:00
|
|
|
talk_number(bm.resume_index + 1, true);
|
2007-08-05 19:19:39 +00:00
|
|
|
talk_id(LANG_TIME, true);
|
2010-04-05 20:53:04 +00:00
|
|
|
talk_value(bm.resume_time / 1000, UNIT_TIME, true);
|
2008-07-15 16:10:15 +00:00
|
|
|
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
/* Track filename */
|
|
|
|
if(is_dir)
|
|
|
|
talk_file_or_spell(global_temp_buffer, global_filename,
|
|
|
|
TALK_IDARRAY(VOICE_FILE), true);
|
|
|
|
else
|
|
|
|
{ /* Unfortunately if this is a playlist, we do not know in which
|
|
|
|
directory the file is and therefore cannot find the track's
|
|
|
|
.talk file. */
|
|
|
|
talk_id(VOICE_FILE, true);
|
|
|
|
talk_spell(global_filename, true);
|
|
|
|
}
|
|
|
|
#endif
|
2004-04-12 12:29:44 +00:00
|
|
|
}
|
|
|
|
|
2007-02-15 22:13:14 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function parses a bookmark and then plays it. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true on successful bookmark play. */
|
2007-02-15 22:13:14 +00:00
|
|
|
/* ------------------------------------------------------------------------*/
|
|
|
|
static bool play_bookmark(const char* bookmark)
|
|
|
|
{
|
2012-05-08 14:34:26 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
|
2010-04-10 21:17:09 +00:00
|
|
|
/* preset pitch and speed to 100% in case bookmark doesn't have info */
|
|
|
|
bm.pitch = sound_get_pitch();
|
|
|
|
bm.speed = dsp_get_timestretch();
|
2010-04-10 21:41:01 +00:00
|
|
|
#endif
|
2010-04-05 20:53:04 +00:00
|
|
|
|
2010-04-10 21:17:09 +00:00
|
|
|
if (parse_bookmark(bookmark, true))
|
2007-02-15 22:13:14 +00:00
|
|
|
{
|
2010-04-05 20:53:04 +00:00
|
|
|
global_settings.repeat_mode = bm.repeat_mode;
|
|
|
|
global_settings.playlist_shuffle = bm.shuffle;
|
2012-05-08 14:34:26 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC && defined(HAVE_PITCHCONTROL)
|
2010-04-10 21:17:09 +00:00
|
|
|
sound_set_pitch(bm.pitch);
|
|
|
|
dsp_set_timestretch(bm.speed);
|
2010-04-10 21:41:01 +00:00
|
|
|
#endif
|
2010-09-26 21:13:25 +00:00
|
|
|
if (!warn_on_pl_erase())
|
|
|
|
return false;
|
2010-04-05 20:53:04 +00:00
|
|
|
return bookmark_play(global_temp_buffer, bm.resume_index,
|
|
|
|
bm.resume_offset, bm.resume_seed, global_filename);
|
2007-02-15 22:13:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2004-04-12 12:29:44 +00:00
|
|
|
|
2007-02-15 22:13:14 +00:00
|
|
|
static const char* skip_token(const char* s)
|
|
|
|
{
|
|
|
|
while (*s && *s != ';')
|
|
|
|
{
|
|
|
|
s++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*s)
|
|
|
|
{
|
|
|
|
s++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2011-05-08 20:35:29 +00:00
|
|
|
static const char* int_token(const char* s, int* dest)
|
|
|
|
{
|
2010-04-10 21:53:55 +00:00
|
|
|
*dest = atoi(s);
|
2011-05-08 20:35:29 +00:00
|
|
|
return skip_token(s);
|
|
|
|
}
|
2010-04-10 21:53:55 +00:00
|
|
|
|
2011-05-08 20:35:29 +00:00
|
|
|
static const char* long_token(const char* s, long* dest)
|
|
|
|
{
|
2010-04-10 21:53:55 +00:00
|
|
|
*dest = atoi(s); /* Should be atol, but we don't have it. */
|
2011-05-08 20:35:29 +00:00
|
|
|
return skip_token(s);
|
|
|
|
}
|
2010-04-06 22:49:06 +00:00
|
|
|
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function takes a bookmark and parses it. This function also */
|
2010-04-10 21:17:09 +00:00
|
|
|
/* validates the bookmark. The parse_filenames flag indicates whether */
|
|
|
|
/* the filename tokens are to be extracted. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true on successful bookmark parse. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
2010-04-10 21:17:09 +00:00
|
|
|
static bool parse_bookmark(const char *bookmark, const bool parse_filenames)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2007-02-15 22:13:14 +00:00
|
|
|
const char* s = bookmark;
|
|
|
|
const char* end;
|
|
|
|
|
2010-04-10 21:53:55 +00:00
|
|
|
#define GET_INT_TOKEN(var) s = int_token(s, &var)
|
|
|
|
#define GET_LONG_TOKEN(var) s = long_token(s, &var)
|
2010-04-06 21:49:33 +00:00
|
|
|
#define GET_BOOL_TOKEN(var) var = (atoi(s)!=0); s = skip_token(s)
|
|
|
|
|
2010-04-10 21:17:09 +00:00
|
|
|
/* if new format bookmark, extract the optional content flags,
|
|
|
|
otherwise treat as an original format bookmark */
|
|
|
|
int opt_flags = 0;
|
|
|
|
bool new_format = (strchr(s, '>') == s);
|
|
|
|
if (new_format)
|
|
|
|
{
|
|
|
|
s++;
|
|
|
|
GET_INT_TOKEN(opt_flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* extract all original bookmark tokens */
|
2010-04-06 21:49:33 +00:00
|
|
|
GET_INT_TOKEN(bm.resume_index);
|
2010-04-10 21:53:55 +00:00
|
|
|
GET_LONG_TOKEN(bm.resume_offset);
|
2010-04-06 21:49:33 +00:00
|
|
|
GET_INT_TOKEN(bm.resume_seed);
|
2010-04-10 21:17:09 +00:00
|
|
|
if (!new_format) /* skip deprecated token */
|
|
|
|
s = skip_token(s);
|
2010-04-10 21:53:55 +00:00
|
|
|
GET_LONG_TOKEN(bm.resume_time);
|
2010-04-06 21:49:33 +00:00
|
|
|
GET_INT_TOKEN(bm.repeat_mode);
|
|
|
|
GET_BOOL_TOKEN(bm.shuffle);
|
2010-04-05 20:53:04 +00:00
|
|
|
|
2010-04-10 21:17:09 +00:00
|
|
|
/* extract all optional bookmark tokens */
|
|
|
|
if (opt_flags & BM_PITCH)
|
|
|
|
GET_INT_TOKEN(bm.pitch);
|
|
|
|
if (opt_flags & BM_SPEED)
|
|
|
|
GET_INT_TOKEN(bm.speed);
|
|
|
|
|
2007-02-15 22:13:14 +00:00
|
|
|
if (*s == 0)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2007-02-15 22:13:14 +00:00
|
|
|
|
|
|
|
end = strchr(s, ';');
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2010-04-05 20:53:04 +00:00
|
|
|
/* extract file names */
|
2010-04-10 21:17:09 +00:00
|
|
|
if (parse_filenames)
|
2007-02-15 22:13:14 +00:00
|
|
|
{
|
|
|
|
size_t len = (end == NULL) ? strlen(s) : (size_t) (end - s);
|
2010-04-05 20:53:04 +00:00
|
|
|
len = MIN(TEMP_BUF_SIZE - 1, len);
|
|
|
|
strlcpy(global_temp_buffer, s, len + 1);
|
|
|
|
|
|
|
|
if (end != NULL)
|
|
|
|
{
|
|
|
|
end++;
|
|
|
|
strlcpy(global_filename, end, MAX_PATH);
|
|
|
|
}
|
|
|
|
}
|
2007-02-15 22:13:14 +00:00
|
|
|
|
2004-01-14 00:13:04 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* This function is used by multiple functions and is used to generate a */
|
|
|
|
/* bookmark named based off of the input. */
|
|
|
|
/* Changing this function could result in how the bookmarks are stored. */
|
|
|
|
/* it would be here that the centralized/decentralized bookmark code */
|
|
|
|
/* could be placed. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Always returns true */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
2004-08-18 01:09:31 +00:00
|
|
|
static bool generate_bookmark_file_name(const char *in)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
2004-06-22 06:23:14 +00:00
|
|
|
int len = strlen(in);
|
2004-01-14 00:13:04 +00:00
|
|
|
|
2004-06-22 06:23:14 +00:00
|
|
|
/* if this is a root dir MP3, rename the bookmark file root_dir.bmark */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* otherwise, name it based on the in variable */
|
2004-06-22 06:23:14 +00:00
|
|
|
if (!strcmp("/", in))
|
|
|
|
strcpy(global_bookmark_file_name, "/root_dir.bmark");
|
2004-01-14 00:13:04 +00:00
|
|
|
else
|
2004-06-22 06:23:14 +00:00
|
|
|
{
|
2009-03-08 13:57:10 +00:00
|
|
|
#ifdef HAVE_MULTIVOLUME
|
|
|
|
/* The "root" of an extra volume need special handling too. */
|
|
|
|
bool volume_root = (strip_volume(in, global_bookmark_file_name) &&
|
|
|
|
!strcmp("/", global_bookmark_file_name));
|
|
|
|
#endif
|
|
|
|
|
2004-06-22 06:23:14 +00:00
|
|
|
strcpy(global_bookmark_file_name, in);
|
|
|
|
if(global_bookmark_file_name[len-1] == '/')
|
|
|
|
len--;
|
2009-03-08 13:57:10 +00:00
|
|
|
#ifdef HAVE_MULTIVOLUME
|
|
|
|
if (volume_root)
|
|
|
|
strcpy(&global_bookmark_file_name[len], "/volume_dir.bmark");
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
strcpy(&global_bookmark_file_name[len], ".bmark");
|
2004-06-22 06:23:14 +00:00
|
|
|
}
|
2004-01-14 00:13:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-06-23 01:31:26 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* Returns true if a bookmark file exists for the current playlist. */
|
|
|
|
/* This is an interface function. */
|
2005-06-23 01:31:26 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
2010-07-06 16:53:52 +00:00
|
|
|
bool bookmark_exists(void)
|
2005-06-23 01:31:26 +00:00
|
|
|
{
|
|
|
|
bool exist=false;
|
|
|
|
|
2012-03-11 05:47:28 +00:00
|
|
|
char* name = playlist_get_name(NULL, global_temp_buffer,
|
|
|
|
sizeof(global_temp_buffer));
|
|
|
|
if (generate_bookmark_file_name(name))
|
2005-06-23 01:31:26 +00:00
|
|
|
{
|
2012-03-11 05:47:28 +00:00
|
|
|
exist = file_exists(global_bookmark_file_name);
|
2005-06-23 01:31:26 +00:00
|
|
|
}
|
|
|
|
return exist;
|
|
|
|
}
|
|
|
|
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
2010-04-05 20:53:04 +00:00
|
|
|
/* Checks the current state of the system and returns true if it is in a */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* bookmarkable state. */
|
2012-03-11 05:47:28 +00:00
|
|
|
/* This is an interface funtion. */
|
2004-01-14 00:13:04 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
2012-03-11 05:47:28 +00:00
|
|
|
bool bookmark_is_bookmarkable_state(void)
|
2004-01-14 00:13:04 +00:00
|
|
|
{
|
|
|
|
int resume_index = 0;
|
|
|
|
|
2010-04-05 20:53:04 +00:00
|
|
|
if (!(audio_status() && audio_current_track()) ||
|
2004-01-14 00:13:04 +00:00
|
|
|
/* no track playing */
|
2010-04-05 20:53:04 +00:00
|
|
|
(playlist_get_resume_info(&resume_index) == -1) ||
|
|
|
|
/* invalid queue info */
|
|
|
|
(playlist_modified(NULL)))
|
2004-01-14 00:13:04 +00:00
|
|
|
/* can't bookmark while in the queue */
|
2010-04-05 20:53:04 +00:00
|
|
|
{
|
2004-01-14 00:13:04 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|