* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <vlc/vlc.h>
#include <vlc_input.h>
#include <vlc_stream.h>
#include "../playlist/playlist_internal.h"
#include <errno.h>
#include <limits.h> /* PATH_MAX */
+#include <assert.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
assert( i_mandatory );
/* FIXME: object creation is overkill, use p_private */
- p_me = vlc_object_create( p_playlist, VLC_OBJECT_META_ENGINE );
+ p_me = vlc_custom_create( VLC_OBJECT(p_playlist), sizeof( *p_me ),
+ VLC_OBJECT_GENERIC, "meta engine" );
p_me->i_flags |= OBJECT_FLAGS_NOINTERACT;
p_me->i_flags |= OBJECT_FLAGS_QUIET;
p_me->i_mandatory = i_mandatory;
p_me->p_module = module_Need( p_me, "meta fetcher", 0, VLC_FALSE );
if( !p_me->p_module )
{
- vlc_object_destroy( p_me );
+ vlc_object_release( p_me );
return VLC_EGENERIC;
}
module_Unneed( p_me, p_me->p_module );
- vlc_object_destroy( p_me );
+ vlc_object_release( p_me );
input_item_SetMetaFetched( p_item, VLC_TRUE );
input_FindArtInCache( p_playlist, p_item );
char *psz_arturl = input_item_GetArtURL( p_item );
- if( !strncmp( psz_arturl, "file://", strlen( "file://" ) ) )
+ if( psz_arturl )
{
+ /* We already have an URL */
+ if( !strncmp( psz_arturl, "file://", strlen( "file://" ) ) )
+ {
+ free( psz_arturl );
+ return 0; /* Art is in cache, no need to go further */
+ }
+
free( psz_arturl );
- return 0; /* Art is in cache, no need to go further */
+
+ /* Art need to be put in cache */
+ return 1;
}
- free( psz_arturl );
PL_LOCK;
p_playlist->p_private = p_item;
}
psz_type = strrchr( psz_arturl, '.' );
- if( strlen( psz_type ) > 5 )
+ if( psz_type && strlen( psz_type ) > 5 )
psz_type = NULL; /* remove extension if it's > to 4 characters */
/* Warning: psz_title, psz_artist, psz_album may change in ArtCache*() */
}
-uint32_t input_CurrentMetaFlags( vlc_meta_t *p_meta )
+uint32_t input_CurrentMetaFlags( const vlc_meta_t *p_meta )
{
uint32_t i_meta = 0;