/** * This function ask the fetcher object to fetch the art when needed */ static void Art( playlist_preparser_t *p_preparser, input_item_t *p_item ) { playlist_t *p_playlist = p_preparser->p_playlist; playlist_fetcher_t *p_fetcher = p_preparser->p_fetcher; bool b_fetch = false; /* If we haven't retrieved enough meta, add to secondary queue * which will run the "meta fetchers". * This only checks for meta, not for art * \todo don't do this for things we won't get meta for, like vids */ vlc_mutex_lock( &p_item->lock ); if( p_item->p_meta ) { const char *psz_arturl = vlc_meta_Get( p_item->p_meta, vlc_meta_ArtworkURL ); const char *psz_name = vlc_meta_Get( p_item->p_meta, vlc_meta_Title ); if( p_preparser->i_art_policy == ALBUM_ART_ALL && ( !psz_arturl || strncmp( psz_arturl, "file://", 7 ) ) ) { msg_Dbg( p_playlist, "meta ok for %s, need to fetch art", psz_name ); b_fetch = true; } else { msg_Dbg( p_playlist, "no fetch required for %s (art currently %s)", psz_name, psz_arturl ); } } vlc_mutex_unlock( &p_item->lock ); if( b_fetch && p_fetcher ) playlist_fetcher_Push( p_fetcher, p_item ); }
/** * This function ask the fetcher object to fetch the art when needed */ static void Art( playlist_preparser_t *p_preparser, input_item_t *p_item ) { vlc_object_t *obj = p_preparser->object; playlist_fetcher_t *p_fetcher = p_preparser->p_fetcher; bool b_fetch = false; /* If we haven't retrieved enough meta, add to secondary queue * which will run the "meta fetchers". * This only checks for meta, not for art * \todo don't do this for things we won't get meta for, like vids */ vlc_mutex_lock( &p_item->lock ); if( p_item->p_meta ) { const char *psz_arturl = vlc_meta_Get( p_item->p_meta, vlc_meta_ArtworkURL ); const char *psz_name = vlc_meta_Get( p_item->p_meta, vlc_meta_Title ); if( !psz_arturl || ( strncmp( psz_arturl, "file://", 7 ) && strncmp( psz_arturl, "attachment://", 13 ) ) ) { msg_Dbg( obj, "meta ok for %s, need to fetch art", psz_name ? psz_name : "(null)" ); b_fetch = true; } else { msg_Dbg( obj, "no fetch required for %s (art currently %s)", psz_name ? psz_name : "(null)", psz_arturl ? psz_arturl : "(null)" ); } } vlc_mutex_unlock( &p_item->lock ); if( b_fetch && p_fetcher ) playlist_fetcher_Push( p_fetcher, p_item, 0 ); }
void playlist_preparser_fetcher_Push( playlist_preparser_t *p_preparser, input_item_t *p_item, input_item_meta_request_option_t i_options ) { if( p_preparser->p_fetcher != NULL ) playlist_fetcher_Push( p_preparser->p_fetcher, p_item, i_options ); }