Commit 89e0f522 authored by Rafaël Carré's avatar Rafaël Carré

playlist: fix command line options

Use var_Inherit* on parent object in playlist_Create()
Check "media-library" before calling playlist_ML*()
parent af6a893a
......@@ -97,12 +97,12 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
pl_priv(p_playlist)->b_reset_currently_playing = true;
pl_priv(p_playlist)->last_rebuild_date = 0;
pl_priv(p_playlist)->b_tree = var_CreateGetBool( p_playlist, "playlist-tree" );
pl_priv(p_playlist)->b_tree = var_InheritBool( p_parent, "playlist-tree" );
pl_priv(p_playlist)->b_doing_ml = false;
const bool b_auto_preparse = var_CreateGetBool( p_playlist, "auto-preparse" );
pl_priv(p_playlist)->b_auto_preparse = b_auto_preparse;
pl_priv(p_playlist)->b_auto_preparse =
var_InheritBool( p_parent, "auto-preparse" );
PL_LOCK; /* playlist_NodeCreate will check for it */
p_playlist->p_root_category = playlist_NodeCreate( p_playlist, NULL, NULL,
......@@ -129,7 +129,8 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
!p_playlist->p_local_onelevel->p_input )
return NULL;
if( config_GetInt( p_playlist, "media-library") )
const bool b_ml = var_InheritBool( p_parent, "media-library");
if( b_ml )
{
PL_LOCK; /* playlist_NodesPairCreate will check for it */
playlist_NodesPairCreate( p_playlist, _( "Media Library" ),
......@@ -154,9 +155,13 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
pl_priv(p_playlist)->request.b_request = false;
pl_priv(p_playlist)->status.i_status = PLAYLIST_STOPPED;
pl_priv(p_playlist)->b_auto_preparse = false;
playlist_MLLoad( p_playlist );
pl_priv(p_playlist)->b_auto_preparse = b_auto_preparse;
if(b_ml)
{
const bool b_auto_preparse = pl_priv(p_playlist)->b_auto_preparse;
pl_priv(p_playlist)->b_auto_preparse = false;
playlist_MLLoad( p_playlist );
pl_priv(p_playlist)->b_auto_preparse = b_auto_preparse;
}
vlc_object_set_destructor( p_playlist, playlist_Destructor );
......
......@@ -121,9 +121,6 @@ int playlist_MLLoad( playlist_t *p_playlist )
char *psz_uri = NULL;
input_item_t *p_input;
if( !config_GetInt( p_playlist, "media-library") )
return VLC_SUCCESS;
psz_datadir = config_GetUserDir( VLC_DATA_DIR );
if( !psz_datadir ) /* XXX: This should never happen */
......@@ -204,9 +201,6 @@ int playlist_MLDump( playlist_t *p_playlist )
{
char *psz_datadir;
if( !config_GetInt( p_playlist, "media-library") )
return VLC_SUCCESS;
psz_datadir = config_GetUserDir( VLC_DATA_DIR );
if( !psz_datadir ) /* XXX: This should never happen */
......
......@@ -109,8 +109,8 @@ void playlist_Deactivate( playlist_t *p_playlist )
input_resource_Delete( p_sys->p_input_resource );
p_sys->p_input_resource = NULL;
/* */
playlist_MLDump( p_playlist );
if( var_InheritBool( p_playlist, "media-library" ) )
playlist_MLDump( p_playlist );
PL_LOCK;
......
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