/*****************************************************************************
* Preamble
*****************************************************************************/
-#define _GNU_SOURCE
-#include <stdlib.h> /* malloc(), free() */
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_interface.h>
#include <vlc_meta.h>
#include <vlc_playlist.h>
vlc_module_begin();
set_shortname( N_( "Folder" ) );
- set_description( _("Folder meta data") );
+ set_description( N_("Folder meta data") );
set_capability( "art finder", 90 );
set_callbacks( FindMeta, NULL );
{
playlist_t *p_playlist = (playlist_t *)p_this;
input_item_t *p_item = (input_item_t *)(p_playlist->p_private);
- vlc_bool_t b_have_art = VLC_FALSE;
+ bool b_have_art = false;
int i = 0;
struct stat a;
char psz_filename[MAX_PATH];
- char *psz_dir = strdup( p_item->psz_uri );
- char *psz_buf = strrchr( psz_dir, '/' );
+ if( !p_item )
+ return VLC_EGENERIC;
- if( !p_item->p_meta ) return VLC_EGENERIC;
+ char *psz_dir = input_item_GetURI( p_item );
+ if( !psz_dir )
+ return VLC_EGENERIC;
+
+ char *psz_buf = strrchr( psz_dir, '/' );
if( psz_buf )
{
psz_buf++;
if( !strncmp( psz_path, "file://", 7 ) )
psz_path += 7;
- for( i = 0; b_have_art == VLC_FALSE && i < 3; i++ )
+ for( i = 0; b_have_art == false && i < 3; i++ )
{
switch( i )
{
if( utf8_stat( psz_filename+7, &a ) != -1 )
{
- vlc_meta_SetArtURL( p_item->p_meta, psz_filename );
- b_have_art = VLC_TRUE;
+ input_item_SetArtURL( p_item, psz_filename );
+ b_have_art = true;
}
}