]> git.sesse.net Git - vlc/commitdiff
Preparse playlist items that don't have enough meta
authorClément Stenac <zorglub@videolan.org>
Sun, 12 Nov 2006 18:19:49 +0000 (18:19 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 12 Nov 2006 18:19:49 +0000 (18:19 +0000)
If the item is not to be preparsed but has enough meta, mark it as preparsed

15 files changed:
include/vlc/vlc.h
include/vlc_playlist.h
modules/demux/playlist/asx.c
modules/demux/playlist/b4s.c
modules/demux/playlist/dvb.c
modules/demux/playlist/gvp.c
modules/demux/playlist/m3u.c
modules/demux/playlist/pls.c
modules/demux/playlist/podcast.c
modules/demux/playlist/qtl.c
modules/demux/playlist/sgimb.c
modules/demux/playlist/shoutcast.c
modules/demux/playlist/xspf.c
src/playlist/engine.c
src/playlist/item.c

index f85164b0d61b9dc673426d7626cfd01c74e62eb5..400075dc860c79d89155158ac0c06c3f016e167e 100644 (file)
@@ -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
 
index 7f45120e6c373401855bbdf7dbd3da64e8a4ffa7..cc239482198374f59cbb1e5f610922343fd3fd00 100644 (file)
@@ -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
index 472d225a014baf6af3c5d95ec56dc4727899f2ad..a3d44aeaa4ad800876921294f78ae9575d9d9f24 100644 (file)
@@ -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;
index 2ab29e092c27cc03617a9fcb78f17ad5ca181183..baa52f911334d503b68349f9055bce88d436c97f 100644 (file)
@@ -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 );
index bd3a56c2bfd9bf5f7ad200a601cadd06d5a8abc0..0c0eeb11164d1b186b127d5a640fe7c276ca05c5 100644 (file)
@@ -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 );
index b81a5ffef807f9668b5d9c80a46cc09dbeef2674..23ecc4d748edb448dd5e5cb8b54189a4d2d05665 100644 (file)
@@ -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;
index 124c4b86b4cfa525351a46a6f5fb8cd94974ada3..25e259454df0765e1eb2814c078c3a0ba30f10c8 100644 (file)
@@ -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 );
         }
 
index 158ce4d3df33ca1b9ff86187ffe7b197a0215de4..816cdbb2aa94cf0140fb78e1b5102a7cf34e7ee0 100644 (file)
@@ -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;
     }
index d8a020baa54226844734d7d6c86cc35c692f0a2c..78976e81739240341fd3bc7a8d51aefe817473d4 100644 (file)
@@ -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 );
index 3f499a8292296b164bee90249c17ab1cadd3f55a..cae957baf51b44bb6c47fe6a89e5b3d2adf49cbc 100644 (file)
@@ -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 );
         }
     }
 
index 9f00eac6e0234fc3263e42bbf870a21c3b11bc1e..cc3da442f913610b73f6b92432209f4de9069db2 100644 (file)
@@ -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 */
 }
index 199f8d024849c099043c0452bdce1eef425409f5..2bad421f079055f4df42df79fa8ab6655ad77b9c 100644 (file)
@@ -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 )
index 83f8a592e9e3c67e8c83179b0be97770f7dc3563..7be83eb4614d51d36197fbfddaf9c6de5f3c9438 100644 (file)
@@ -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 )
                     {
index 6c798e1fc69ae4050bec030ffe0a488b211ba799..9840a3f61c6cd9574a2788e7cb7172158992e03e 100644 (file)
@@ -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;
 }
 
index 0ae600b2eeb4215bfc9ff7700980bd1419292ffe..64a9887b73ec1cc4f54cbe33f23a4422f11b8bf6 100644 (file)
@@ -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 */