Commit e8aa094f authored by Clément Stenac's avatar Clément Stenac

Preparse playlist items that don't have enough meta

If the item is not to be preparsed but has enough meta, mark it as preparsed
parent 8b5528ab
......@@ -141,6 +141,7 @@ struct vlc_list_t
#define PLAYLIST_APPEND 0x0002
#define PLAYLIST_GO 0x0004
#define PLAYLIST_PREPARSE 0x0008
#define PLAYLIST_SPREPARSE 0x0010
#define PLAYLIST_END -666
......
......@@ -128,6 +128,7 @@ struct playlist_t
vlc_bool_t b_doing_ml; /**< Doing media library stuff, */
/*get quicker */
vlc_bool_t b_auto_preparse;
/* Runtime */
input_thread_t * p_input; /**< the input thread associated
......
......@@ -370,8 +370,8 @@ static int Demux( demux_t *p_demux )
input_ItemCopyOptions( p_current->p_input, p_input );
playlist_BothAddInput( p_playlist, p_input,
p_item_in_category,
PLAYLIST_APPEND,
PLAYLIST_END );
PLAYLIST_APPEND|PLAYLIST_SPREPARSE,
PLAYLIST_END );
free( psz_string );
}
else continue;
......@@ -450,7 +450,8 @@ static int Demux( demux_t *p_demux )
if( psz_abstract_entry ) vlc_meta_SetDescription( p_entry->p_meta, psz_abstract_entry );
playlist_BothAddInput( p_playlist, p_entry,
p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END);
PLAYLIST_APPEND | PLAYLIST_SPREPARSE
, PLAYLIST_END);
free( psz_string );
}
else continue;
......
......@@ -268,7 +268,8 @@ static int Demux( demux_t *p_demux )
playlist_BothAddInput( p_playlist, p_input,
p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
FREENULL( psz_name );
FREENULL( psz_mrl );
FREENULL( psz_genre );
......
......@@ -119,7 +119,8 @@ static int Demux( demux_t *p_demux )
input_ItemAddOption( p_input, ppsz_options[i] );
}
playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
while( i_options-- ) free( ppsz_options[i_options] );
if( ppsz_options ) free( ppsz_options );
......
......@@ -215,7 +215,8 @@ static int Demux( demux_t *p_demux )
SADD_INFO( "description", psz_description );
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
}
HANDLE_PLAY_AND_RELEASE;
......
......@@ -169,7 +169,8 @@ static int Demux( demux_t *p_demux )
input_ItemAddInfo( p_input, _(VLC_META_INFO_CAT),
_(VLC_META_ARTIST), "%s", psz_artist );
playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
free( psz_mrl );
}
......
......@@ -157,7 +157,8 @@ static int Demux( demux_t *p_demux )
0, NULL, -1 );
input_ItemCopyOptions( p_current->p_input, p_input );
playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
}
else
{
......@@ -213,7 +214,8 @@ static int Demux( demux_t *p_demux )
p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,0, NULL, -1 );
input_ItemCopyOptions( p_current->p_input, p_input );
playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
free( psz_mrl_orig );
psz_mrl = NULL;
}
......
......@@ -293,7 +293,8 @@ static int Demux( demux_t *p_demux )
}
playlist_BothAddInput( p_playlist, p_input,
p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE
, PLAYLIST_END );
FREENULL( psz_item_name );
FREENULL( psz_item_mrl );
FREENULL( psz_item_size );
......
......@@ -361,7 +361,8 @@ static int Demux( demux_t *p_demux )
SADD_INFO( "href", psz_href );
SADD_INFO( "mime type", psz_mimetype );
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category, PLAYLIST_APPEND,
p_sys->p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
if( psz_qtnext )
{
......@@ -369,7 +370,8 @@ static int Demux( demux_t *p_demux )
psz_qtnext, NULL, 0, NULL, -1 );
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
}
}
......
......@@ -407,7 +407,7 @@ static int Demux ( demux_t *p_demux )
}
playlist_BothAddInput( p_playlist, p_child, p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE, PLAYLIST_END );
HANDLE_PLAY_AND_RELEASE
return -1; /* Needed for correct operation of go back */
}
......
......@@ -242,7 +242,8 @@ static int DemuxGenre( demux_t *p_demux )
free( psz_mrl );
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
FREENULL( psz_name );
}
FREENULL( psz_eltname );
......@@ -433,7 +434,8 @@ static int DemuxStation( demux_t *p_demux )
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
FREENULL( psz_name );
FREENULL( psz_mt )
......
......@@ -481,7 +481,8 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
FREE_ATT();
playlist_BothAddInput( p_playlist, p_new_input,
p_demux->p_sys->p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END );
if( p_demux->p_sys->i_identifier <
p_demux->p_sys->i_tracklist_entries )
{
......
......@@ -53,6 +53,7 @@ static int RandomCallback( vlc_object_t *p_this, char const *psz_cmd,
playlist_t * playlist_Create( vlc_object_t *p_parent )
{
playlist_t *p_playlist;
vlc_bool_t b_save;
int i_tree;
/* Allocate structure */
......@@ -90,6 +91,9 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
p_playlist->b_doing_ml = VLC_FALSE;
p_playlist->b_auto_preparse =
var_CreateGetBool( p_playlist, "auto-preparse") ;
p_playlist->p_root_category = playlist_NodeCreate( p_playlist, NULL, NULL);
p_playlist->p_root_onelevel = playlist_NodeCreate( p_playlist, NULL, NULL);
......@@ -132,8 +136,10 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
p_playlist->i_order = ORDER_NORMAL;
vlc_object_attach( p_playlist, p_parent );
b_save = p_playlist->b_auto_preparse;
p_playlist->b_auto_preparse = VLC_FALSE;
playlist_MLLoad( p_playlist );
p_playlist->b_auto_preparse = VLC_TRUE;
return p_playlist;
}
......
......@@ -574,11 +574,22 @@ void GoAndPreparse( playlist_t *p_playlist, int i_mode,
p_playlist->request.i_status = PLAYLIST_RUNNING;
vlc_cond_signal( &p_playlist->object_wait );
}
if( i_mode & PLAYLIST_PREPARSE &&
var_CreateGetBool( p_playlist, "auto-preparse" ) )
{
/* Preparse if PREPARSE or SPREPARSE & not enough meta */
if( p_playlist->b_auto_preparse &&
(i_mode & PLAYLIST_PREPARSE ||
( i_mode & PLAYLIST_SPREPARSE &&
( !p_item_cat->p_input->p_meta || (p_item_cat->p_input->p_meta &&
( EMPTY_STR( p_item_cat->p_input->p_meta->psz_artist ) ||
EMPTY_STR( p_item_cat->p_input->p_meta->psz_album ) )
)
)
) ) )
playlist_PreparseEnqueue( p_playlist, p_item_cat->p_input );
}
/* If we already have it, signal it */
else if( p_item_cat->p_input->p_meta &&
!EMPTY_STR( p_item_cat->p_input->p_meta->psz_artist ) &&
!EMPTY_STR( p_item_cat->p_input->p_meta->psz_album ) )
p_item_cat->p_input->p_meta->i_status = ITEM_PREPARSED;
}
/* Add the playlist item to the requested node and fire a notification */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment