/*****************************************************************************
* search.c : Search functions
*****************************************************************************
- * Copyright (C) 1999-2009 the VideoLAN team
+ * Copyright (C) 1999-2009 VLC authors and VideoLAN
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
- * 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
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#include <assert.h>
#include <vlc_common.h>
-#include "vlc_playlist.h"
+#include <vlc_playlist.h>
+#include <vlc_charset.h>
#include "playlist_internal.h"
/***************************************************************************
* @return true if an item match
*/
static bool playlist_LiveSearchUpdateInternal( playlist_item_t *p_root,
- const char *psz_string )
+ const char *psz_string, bool b_recursive )
{
int i;
bool b_match = false;
bool b_enable = false;
playlist_item_t *p_item = p_root->pp_children[i];
// Go recurssively if their is some children
- if( p_item->i_children >= 0 &&
- playlist_LiveSearchUpdateInternal( p_item, psz_string ) )
+ if( b_recursive && p_item->i_children >= 0 &&
+ playlist_LiveSearchUpdateInternal( p_item, psz_string, true ) )
{
b_enable = true;
}
psz_title = p_item->p_input->psz_name;
const char *psz_album = vlc_meta_Get( p_item->p_input->p_meta, vlc_meta_Album );
const char *psz_artist = vlc_meta_Get( p_item->p_input->p_meta, vlc_meta_Artist );
- b_enable = ( psz_title && strcasestr( psz_title, psz_string ) ) ||
- ( psz_album && strcasestr( psz_album, psz_string ) ) ||
- ( psz_artist && strcasestr( psz_artist, psz_string ) );
+ b_enable = ( psz_title && vlc_strcasestr( psz_title, psz_string ) ) ||
+ ( psz_album && vlc_strcasestr( psz_album, psz_string ) ) ||
+ ( psz_artist && vlc_strcasestr( psz_artist, psz_string ) );
}
else
- b_enable = p_item->p_input->psz_name && strcasestr( p_item->p_input->psz_name, psz_string );
+ b_enable = p_item->p_input->psz_name && vlc_strcasestr( p_item->p_input->psz_name, psz_string );
vlc_mutex_unlock( &p_item->p_input->lock );
}
* @return VLC_SUCCESS
*/
int playlist_LiveSearchUpdate( playlist_t *p_playlist, playlist_item_t *p_root,
- const char *psz_string )
+ const char *psz_string, bool b_recursive )
{
PL_ASSERT_LOCKED;
pl_priv(p_playlist)->b_reset_currently_playing = true;
if( *psz_string )
- playlist_LiveSearchUpdateInternal( p_root, psz_string );
+ playlist_LiveSearchUpdateInternal( p_root, psz_string, b_recursive );
else
playlist_LiveSearchClean( p_root );
vlc_cond_signal( &pl_priv(p_playlist)->signal );