- playlist_Add( p_playlist, psz_uri, p_dir_content->d_name,
- PLAYLIST_INSERT, *pi_position );
- (*pi_position)++;
+ input_item_t *p_input;
+ char *psz_tmp1, *psz_tmp2, *psz_loc;
+
+ if( i_extensions > 0 )
+ {
+ char *psz_dot = strrchr( p_dir_content->d_name, '.' );
+ if( psz_dot++ && *psz_dot )
+ {
+ int a;
+ for( a = 0; a < i_extensions; a++ )
+ {
+ if( !strcmp( psz_dot, ppsz_extensions[a] ) )
+ break;
+ }
+ if( a < i_extensions )
+ {
+ msg_Dbg( p_playlist, "ignoring file %s", psz_uri );
+ free( psz_uri );
+ continue;
+ }
+ }
+ }
+
+ psz_loc = FromLocale( psz_uri );
+ psz_tmp1 = vlc_fix_readdir_charset( VLC_OBJECT(p_playlist),
+ psz_loc );
+ LocaleFree( psz_loc );
+
+ psz_loc = FromLocale( p_dir_content->d_name );
+ psz_tmp2 = vlc_fix_readdir_charset( VLC_OBJECT(p_playlist),
+ psz_loc );
+ LocaleFree( psz_loc );
+
+ p_input = input_ItemNewWithType( VLC_OBJECT(p_playlist),
+ psz_tmp1, psz_tmp2, 0, NULL,
+ -1, ITEM_TYPE_VFILE );
+
+ playlist_AddWhereverNeeded( p_playlist, p_input, p_parent,
+ p_parent_category, VLC_FALSE,
+ PLAYLIST_APPEND|PLAYLIST_PREPARSE);