X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fplaylist%2Ffetcher.c;h=2075c0dfdbde6a626486c208b7354aa43a24a551;hb=c35e504a57cead20266b1c37b137a3ad98c3d1cd;hp=dc0edeed7f1cca467aec36f433f5cb306c860118;hpb=de56dfd5390f69d9a9ab2a431bb055463eb749a7;p=vlc diff --git a/src/playlist/fetcher.c b/src/playlist/fetcher.c index dc0edeed7f..2075c0dfdb 100644 --- a/src/playlist/fetcher.c +++ b/src/playlist/fetcher.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "art.h" #include "fetcher.h" @@ -123,36 +123,10 @@ void playlist_fetcher_Delete( playlist_fetcher_t *p_fetcher ) free( p_fetcher ); } + /***************************************************************************** * Privates functions *****************************************************************************/ - -/** - * This function's job is to call the movie name decrapifier - * Those plugins goal are to fill in information from the file itself. - * Without network connection. - */ - -static void Decrapify( playlist_fetcher_t *p_fetcher, input_item_t *p_item ) -{ - vlc_object_t *p_parent = VLC_OBJECT(p_fetcher->p_playlist); - - decrapifier_t *p_decrapifier = - vlc_custom_create( p_parent, sizeof(*p_decrapifier), VLC_OBJECT_GENERIC, - "movie name decrapifier" ); - if(!p_decrapifier) - return; - - vlc_object_attach( p_decrapifier, p_parent ); - p_decrapifier->p_item = p_item; - - module_t *p_module = module_need( p_decrapifier, - "movie name decrapifier", NULL, false ); - if( p_module ) - module_unneed( p_decrapifier, p_module ); - vlc_object_release( p_decrapifier ); -} - /** * This function locates the art associated to an input item. * Return codes: @@ -260,7 +234,11 @@ static int FindArt( playlist_fetcher_t *p_fetcher, input_item_t *p_item ) if( p_module ) { module_unneed( p_finder, p_module ); - i_ret = 1; + /* Try immediately if found in cache by download URL */ + if( !playlist_FindArtInCache( p_item ) ) + i_ret = 0; + else + i_ret = 1; } vlc_object_release( p_finder ); } @@ -351,6 +329,28 @@ error: return VLC_EGENERIC; } +/** + * FetchMeta, run the "meta fetcher". They are going to do network + * connections, and gather information upon the playing media. + * (even artwork). + */ +static void FetchMeta( playlist_fetcher_t *p_fetcher, input_item_t *p_item ) +{ + demux_meta_t *p_demux_meta = vlc_custom_create(p_fetcher->p_playlist, + sizeof(*p_demux_meta), + VLC_OBJECT_GENERIC, "demux meta" ); + if( !p_demux_meta ) + return; + + vlc_object_attach( p_demux_meta, p_fetcher->p_playlist ); + p_demux_meta->p_demux = NULL; + p_demux_meta->p_item = p_item; + + module_t *p_meta_fetcher = module_need( p_demux_meta, "meta fetcher", NULL, false ); + if( p_meta_fetcher ) + module_unneed( p_demux_meta, p_meta_fetcher ); + vlc_object_release( p_demux_meta ); +} static int InputEvent( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) @@ -438,7 +438,11 @@ static void *Thread( void *p_data ) /* Wait that the input item is preparsed if it is being played */ WaitPreparsed( p_fetcher, p_item ); - Decrapify( p_fetcher, p_item ); + /* Triggers "meta fetcher", eventually fetch meta on the network. + * They are identical to "meta reader" expect that may actually + * takes time. That's why they are running here. + * The result of this fetch is not cached. */ + FetchMeta( p_fetcher, p_item ); /* Find art, and download it if needed */ int i_ret = FindArt( p_fetcher, p_item );