- int i_ret = VLC_EGENERIC;
- module_t *p_module;
- char * psz_album = input_item_GetAlbum( p_item );
- char * psz_artist = input_item_GetArtist( p_item );
- char * psz_title = input_item_GetAlbum( p_item );
-
- if( !p_item->p_meta )
- return VLC_EGENERIC;
-
- if( !p_item->psz_name && !input_item_GetTitle( p_item ) &&
- (!input_item_GetArtist( p_item ) || !input_item_GetAlbum( p_item )) )
- return VLC_EGENERIC;
-
- /* If we already checked this album in this session, skip */
- if( input_item_GetArtist( p_item ) && input_item_GetAlbum( p_item ) )
- {
- FOREACH_ARRAY( playlist_album_t album, p_playlist->p_fetcher->albums )
- if( !strcmp( album.psz_artist, input_item_GetArtist( p_item ) ) &&
- !strcmp( album.psz_album, input_item_GetAlbum( p_item ) ) )
- {
- msg_Dbg( p_playlist, " %s - %s has already been searched",
- input_item_GetArtist( p_item ), input_item_GetAlbum( p_item ) );
- /* TODO-fenrir if we cache art filename too, we can go faster */
- if( album.b_found )
- {
- /* Actually get URL from cache */
- input_FindArtInCache( p_playlist, p_item );
- return 0;
- }
- else
- {
- return VLC_EGENERIC;
- }
- }
- FOREACH_END();
- }
-
- input_FindArtInCache( p_playlist, p_item );
- if( !EMPTY_STR(input_item_GetArtURL( p_item )) )
- return 0;
-
- PL_LOCK;
- p_playlist->p_private = p_item;
- if( input_item_GetAlbum( p_item ) && input_item_GetArtist( p_item ) )
- {
- msg_Dbg( p_playlist, "searching art for %s - %s",
- input_item_GetArtist( p_item ), input_item_GetAlbum( p_item ) );
- }
- else
- {
- msg_Dbg( p_playlist, "searching art for %s",
- input_item_GetTitle( p_item ) ? input_item_GetTitle( p_item ) : p_item->psz_name );
- }
-
- p_module = module_Need( p_playlist, "art finder", 0, VLC_FALSE );
-
- if( p_module )
- i_ret = 1;
- else
- msg_Dbg( p_playlist, "unable to find art" );
-
- /* Record this album */
- if( input_item_GetArtist( p_item ) && input_item_GetAlbum( p_item ) )
- {
- playlist_album_t a;
- a.psz_artist = strdup( input_item_GetArtist( p_item ) );
- a.psz_album = strdup( input_item_GetAlbum( p_item ) );
- a.b_found = (i_ret == VLC_EGENERIC ? VLC_FALSE : VLC_TRUE );
- ARRAY_APPEND( p_playlist->p_fetcher->albums, a );
- }