From e8aa094f86e08a2c690555a0767763dcd63ffb90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20Stenac?= Date: Sun, 12 Nov 2006 18:19:49 +0000 Subject: [PATCH] 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 --- include/vlc/vlc.h | 1 + include/vlc_playlist.h | 1 + modules/demux/playlist/asx.c | 7 ++++--- modules/demux/playlist/b4s.c | 3 ++- modules/demux/playlist/dvb.c | 3 ++- modules/demux/playlist/gvp.c | 3 ++- modules/demux/playlist/m3u.c | 3 ++- modules/demux/playlist/pls.c | 6 ++++-- modules/demux/playlist/podcast.c | 3 ++- modules/demux/playlist/qtl.c | 6 ++++-- modules/demux/playlist/sgimb.c | 2 +- modules/demux/playlist/shoutcast.c | 6 ++++-- modules/demux/playlist/xspf.c | 3 ++- src/playlist/engine.c | 8 +++++++- src/playlist/item.c | 19 +++++++++++++++---- 15 files changed, 53 insertions(+), 21 deletions(-) diff --git a/include/vlc/vlc.h b/include/vlc/vlc.h index f85164b0d6..400075dc86 100644 --- a/include/vlc/vlc.h +++ b/include/vlc/vlc.h @@ -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 diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h index 7f45120e6c..cc23948219 100644 --- a/include/vlc_playlist.h +++ b/include/vlc_playlist.h @@ -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 diff --git a/modules/demux/playlist/asx.c b/modules/demux/playlist/asx.c index 472d225a01..a3d44aeaa4 100644 --- a/modules/demux/playlist/asx.c +++ b/modules/demux/playlist/asx.c @@ -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; diff --git a/modules/demux/playlist/b4s.c b/modules/demux/playlist/b4s.c index 2ab29e092c..baa52f9113 100644 --- a/modules/demux/playlist/b4s.c +++ b/modules/demux/playlist/b4s.c @@ -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 ); diff --git a/modules/demux/playlist/dvb.c b/modules/demux/playlist/dvb.c index bd3a56c2bf..0c0eeb1116 100644 --- a/modules/demux/playlist/dvb.c +++ b/modules/demux/playlist/dvb.c @@ -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 ); diff --git a/modules/demux/playlist/gvp.c b/modules/demux/playlist/gvp.c index b81a5ffef8..23ecc4d748 100644 --- a/modules/demux/playlist/gvp.c +++ b/modules/demux/playlist/gvp.c @@ -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; diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c index 124c4b86b4..25e259454d 100644 --- a/modules/demux/playlist/m3u.c +++ b/modules/demux/playlist/m3u.c @@ -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 ); } diff --git a/modules/demux/playlist/pls.c b/modules/demux/playlist/pls.c index 158ce4d3df..816cdbb2aa 100644 --- a/modules/demux/playlist/pls.c +++ b/modules/demux/playlist/pls.c @@ -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; } diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c index d8a020baa5..78976e8173 100644 --- a/modules/demux/playlist/podcast.c +++ b/modules/demux/playlist/podcast.c @@ -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 ); diff --git a/modules/demux/playlist/qtl.c b/modules/demux/playlist/qtl.c index 3f499a8292..cae957baf5 100644 --- a/modules/demux/playlist/qtl.c +++ b/modules/demux/playlist/qtl.c @@ -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 ); } } diff --git a/modules/demux/playlist/sgimb.c b/modules/demux/playlist/sgimb.c index 9f00eac6e0..cc3da442f9 100644 --- a/modules/demux/playlist/sgimb.c +++ b/modules/demux/playlist/sgimb.c @@ -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 */ } diff --git a/modules/demux/playlist/shoutcast.c b/modules/demux/playlist/shoutcast.c index 199f8d0248..2bad421f07 100644 --- a/modules/demux/playlist/shoutcast.c +++ b/modules/demux/playlist/shoutcast.c @@ -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 ) diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c index 83f8a592e9..7be83eb461 100644 --- a/modules/demux/playlist/xspf.c +++ b/modules/demux/playlist/xspf.c @@ -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 ) { diff --git a/src/playlist/engine.c b/src/playlist/engine.c index 6c798e1fc6..9840a3f61c 100644 --- a/src/playlist/engine.c +++ b/src/playlist/engine.c @@ -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; } diff --git a/src/playlist/item.c b/src/playlist/item.c index 0ae600b2ee..64a9887b73 100644 --- a/src/playlist/item.c +++ b/src/playlist/item.c @@ -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 */ -- 2.39.2