]> git.sesse.net Git - vlc/commitdiff
meta-data handling cleanup
authorRafaël Carré <funman@videolan.org>
Wed, 23 Apr 2008 05:15:36 +0000 (07:15 +0200)
committerRafaël Carré <funman@videolan.org>
Wed, 23 Apr 2008 05:23:18 +0000 (07:23 +0200)
Remove VLC_META_ENGINE_*
Don't use VLC_META_INFO_CAT
Avoid using input_Item{Add,Get}Info
Remove disabled code in cdda
Remove "meta fetcher":
    There was only 1 module (not) implementing it (musicbrainz)
    Reduces complexity in playlist core
Use a more consistent naming
Factorize QT4 sorting and column display code
Remove unused members

30 files changed:
include/vlc_input.h
include/vlc_meta.h
modules/access/cdda/info.c
modules/codec/vorbis.c
modules/control/http/rpn.c
modules/demux/playlist/m3u.c
modules/gui/macosx/playlistinfo.m
modules/gui/ncurses.c
modules/gui/qt4/Modules.am
modules/gui/qt4/components/info_panels.cpp
modules/gui/qt4/components/playlist/playlist_item.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/sorting.h [new file with mode: 0644]
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/wxwidgets/dialogs/infopanels.cpp
modules/meta_engine/musicbrainz.c
modules/misc/lua/meta.c
modules/misc/lua/vlc.c
modules/misc/lua/vlc.h
modules/services_discovery/sap.c
src/input/input.c
src/input/input_internal.h
src/input/meta.c
src/libvlc-module.c
src/libvlc.sym
src/playlist/control.c
src/playlist/engine.c
src/playlist/playlist_internal.h
src/playlist/thread.c

index edbd83dc99ec9d4587edc9d27333779375b7b54d..738b3745208f8e6f9700b85a196c2a16b850ac5d 100644 (file)
@@ -258,12 +258,6 @@ static inline bool input_item_IsPreparsed( input_item_t *p_i )
     return p_i->p_meta ? p_i->p_meta->i_status & ITEM_PREPARSED : false ;
 }
 
-static inline bool input_item_IsMetaFetched( input_item_t *p_i )
-{
-    return p_i->p_meta ? p_i->p_meta->i_status & ITEM_META_FETCHED : false ;
-}
-
-
 static inline bool input_item_IsArtFetched( input_item_t *p_i )
 {
     return p_i->p_meta ? p_i->p_meta->i_status & ITEM_ART_FETCHED : false ;
index 843266e62040cd4f60f4658039ba0ccaf6d2d43f..090c2ce6b21414ef060d4174eba296297f20d4a2 100644 (file)
 
 #include <vlc_arrays.h>
 
-#define VLC_META_TYPE_COUNT 17
-
 typedef enum vlc_meta_type_t
 {
-    vlc_meta_Title = 0,
+    vlc_meta_Title,
     vlc_meta_Artist,
     vlc_meta_Genre,
     vlc_meta_Copyright,
@@ -53,14 +51,15 @@ typedef enum vlc_meta_type_t
     vlc_meta_TrackID
 } vlc_meta_type_t;
 
+#define VLC_META_TYPE_COUNT 17
+
 /* Returns a localizes string describing the meta */
 VLC_EXPORT(const char *, input_MetaTypeToLocalizedString, ( vlc_meta_type_t meta_type ) );
 
 #define ITEM_PREPARSED      0x01
-#define ITEM_META_FETCHED   0x02
-#define ITEM_ARTURL_FETCHED 0x04
-#define ITEM_ART_FETCHED    0x08
-#define ITEM_ART_NOTFOUND   0x10
+#define ITEM_ARTURL_FETCHED 0x02
+#define ITEM_ART_FETCHED    0x04
+#define ITEM_ART_NOTFOUND   0x08
 
 struct vlc_meta_t
 {
@@ -69,7 +68,6 @@ struct vlc_meta_t
     vlc_dictionary_t extra_tags;
 
     int i_status;
-
 };
 
 /* Setters for meta.
@@ -163,15 +161,12 @@ static inline void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
     free( ppsz_all_keys );
 }
 
-/* Shortcuts for the AddInfo */
-#define VLC_META_INFO_CAT           N_("Meta-information")
 #define VLC_META_TITLE              input_MetaTypeToLocalizedString( vlc_meta_Title )
-#define VLC_META_DURATION           N_( "Duration" )
 #define VLC_META_ARTIST             input_MetaTypeToLocalizedString( vlc_meta_Artist )
 #define VLC_META_GENRE              input_MetaTypeToLocalizedString( vlc_meta_Genre )
 #define VLC_META_COPYRIGHT          input_MetaTypeToLocalizedString( vlc_meta_Copyright )
-#define VLC_META_COLLECTION         input_MetaTypeToLocalizedString( vlc_meta_Album )
-#define VLC_META_SEQ_NUM            input_MetaTypeToLocalizedString( vlc_meta_TrackNumber )
+#define VLC_META_ALBUM              input_MetaTypeToLocalizedString( vlc_meta_Album )
+#define VLC_META_TRACK_NUMBER       input_MetaTypeToLocalizedString( vlc_meta_TrackNumber )
 #define VLC_META_DESCRIPTION        input_MetaTypeToLocalizedString( vlc_meta_Description )
 #define VLC_META_RATING             input_MetaTypeToLocalizedString( vlc_meta_Rating )
 #define VLC_META_DATE               input_MetaTypeToLocalizedString( vlc_meta_Date )
@@ -196,43 +191,4 @@ struct meta_export_t
     const char *psz_file;
 };
 
-#define VLC_META_ENGINE_TRACKID         0x00000001
-#define VLC_META_ENGINE_TITLE           0x00000002
-#define VLC_META_ENGINE_DURATION        0x00000004
-#define VLC_META_ENGINE_ARTIST          0x00000008
-#define VLC_META_ENGINE_GENRE           0x00000010
-#define VLC_META_ENGINE_COPYRIGHT       0x00000020
-#define VLC_META_ENGINE_COLLECTION      0x00000040
-#define VLC_META_ENGINE_SEQ_NUM         0x00000080
-#define VLC_META_ENGINE_DESCRIPTION     0x00000100
-#define VLC_META_ENGINE_RATING          0x00000200
-#define VLC_META_ENGINE_DATE            0x00000400
-#define VLC_META_ENGINE_URL             0x00000800
-#define VLC_META_ENGINE_LANGUAGE        0x00001000
-
-#define VLC_META_ENGINE_ART_URL         0x00002000
-
-#if 0 /* unused (yet?) */
-#define VLC_META_ENGINE_MB_ARTIST_ID    0x00002000
-#define VLC_META_ENGINE_MB_RELEASE_ID   0x00004000
-#define VLC_META_ENGINE_MB_TRACK_ID     0x00008000
-#define VLC_META_ENGINE_MB_TRM_ID       0x00010000
-#endif
-
-typedef struct meta_engine_sys_t meta_engine_sys_t;
-
-struct meta_engine_t
-{
-    VLC_COMMON_MEMBERS
-
-    module_t *p_module;
-
-    uint32_t i_mandatory; /**< Stuff which we really need to get */
-    uint32_t i_optional; /**< Stuff which we'd like to have */
-
-    input_item_t *p_item;
-};
-
-VLC_EXPORT(uint32_t, input_CurrentMetaFlags,( const vlc_meta_t *p_meta ) );
-
 #endif
index fb8beb093db06b3783d0e660274bc898c33500c2..40333722641d320cc683e8f173386977c1fcfb5e 100644 (file)
@@ -807,16 +807,6 @@ CDDAFormatTitle( const access_t *p_access, track_t i_track )
     return(NULL);
 }
 
-/* Adds a string-valued entry to the playlist information under "Track"
-   if the string is not null or the null string.
- */
-#define add_playlist_track_info_str(TITLE, FIELD)                        \
-    if (FIELD && strlen(FIELD))                                          \
-    {                                                                    \
-        input_ItemAddInfo( &p_item->input, _("Track"), _(TITLE),    \
-                              "%s", FIELD);                              \
-    }
-
 static playlist_item_t *
 CDDACreatePlaylistItem( const access_t *p_access, cdda_data_t *p_cdda,
                         playlist_t *p_playlist, playlist_item_t *p_item,
@@ -849,58 +839,6 @@ CDDACreatePlaylistItem( const access_t *p_access, cdda_data_t *p_cdda,
     return p_child;
 }
 
-int CDDAAddMetaToItem( access_t *p_access, cdda_data_t *p_cdda,
-                       playlist_item_t *p_item, int i_track,
-                       bool b_single )
-{
-#if 0
-    add_playlist_track_info_str("Source",  p_cdda->psz_source);
-    input_ItemAddInfo( &p_item->input, _("Track"), _("Track Number"),
-                           "%d", i_track );
-
-    if (p_cdda->p_cdtext[i_track])
-    {
-        const cdtext_t *p = p_cdda->p_cdtext[i_track];
-        add_playlist_track_info_str("Arranger (CD-Text)",
-                                    p->field[CDTEXT_ARRANGER]);
-        add_playlist_track_info_str("Composer (CD-Text)",
-                                    p->field[CDTEXT_COMPOSER]);
-        add_playlist_track_info_str("Genre (CD-Text)",
-                                    p->field[CDTEXT_GENRE]);
-        add_playlist_track_info_str("Message (CD-Text)",
-                                    p->field[CDTEXT_MESSAGE]);
-        add_playlist_track_info_str("Performer (CD-Text)",
-                                    p->field[CDTEXT_PERFORMER]);
-        add_playlist_track_info_str("Songwriter (CD-Text)",
-                                    p->field[CDTEXT_SONGWRITER]);
-        add_playlist_track_info_str("Title (CD-Text)",
-                                    p->field[CDTEXT_TITLE]);
-    }
-
-#ifdef HAVE_LIBCDDB
-    if (p_cdda->b_cddb_enabled)
-    {
-        cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc,
-                                            i_track-p_cdda->i_first_track);
-
-        if (t)
-        {
-            if (cddb_track_get_artist(t))
-                add_playlist_track_info_str("Artist (CDDB)",
-                                             cddb_track_get_artist(t));
-            if (cddb_track_get_title(t))
-                add_playlist_track_info_str("Title (CDDB)",
-                                            cddb_track_get_title(t));
-            if (cddb_track_get_ext_data(t))
-                add_playlist_track_info_str("Extended information (CDDB)",
-                                            cddb_track_get_ext_data(t));
-        }
-    }
-#endif /*HAVE_LIBCDDB*/
-#endif
-    return VLC_SUCCESS;
-}
-
 /*
    Fixes up playlist.
 */
@@ -973,7 +911,6 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
 
     if( p_item )
     {
-        CDDAAddMetaToItem( p_access, p_cdda, p_item, i_track, false );
         input_item_SetDuration( p_item->p_input, (mtime_t) i_track_frames
           * (CLOCK_FREQ / CDIO_CD_FRAMES_PER_SEC) );
             input_item_SetURI( p_item->p_input,
@@ -1009,8 +946,6 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
           p_child = CDDACreatePlaylistItem( p_access, p_cdda, p_playlist,
                         p_item,
                         i_track );
-          CDDAAddMetaToItem( p_access, p_cdda, p_child, i_track,
-                 true );
         }
         }
 
index 018a1f8c5d8d91e54473ac53c2d7a5b53f3b5723..dc580f1f9a14ff18175d7185ddf09130a7cbb4bc 100644 (file)
@@ -653,10 +653,6 @@ static void ParseVorbisComments( decoder_t *p_dec )
                 if( psz_value && ( *psz_value != '\0' ) )
                 {
                     input_item_SetArtist( p_item, psz_value );
-                    input_ItemAddInfo( p_item,
-                                        _(VLC_META_INFO_CAT),
-                                        _(VLC_META_ARTIST),
-                                        "%s", psz_value );
                 }
             }
             else if( !strcasecmp( psz_name, "title" ) )
index a00cb33109b8c03e9d0a49d71746261d95912488..275d0176c47f864bbd1a5a78470ff28860a84518 100644 (file)
@@ -983,30 +983,21 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t  *vars,
 #define p_item input_GetItem( p_sys->p_input )
                 if( !strcmp( psz_meta, "ARTIST" ) )
                 {
-                    psz_val = input_ItemGetInfo( p_item,
-                                _(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
+                    psz_val = input_item_GetArtist( p_item );
                 }
                 else if( !strcmp( psz_meta, "TITLE" ) )
                 {
-                    psz_val = input_ItemGetInfo( p_item,
-                                _(VLC_META_INFO_CAT), _(VLC_META_TITLE) );
-                    if( psz_val == NULL )
-                        psz_val = strdup( p_item->psz_name );
+                    psz_val = input_item_GetTitle( p_item );
+                    if( !psz_val )
+                        psz_val = input_item_GetName( p_item );
                 }
                 else if( !strcmp( psz_meta, "ALBUM" ) )
                 {
-                    psz_val = input_ItemGetInfo( p_item,
-                                _(VLC_META_INFO_CAT), _(VLC_META_COLLECTION) );
+                    psz_val = input_item_GetAlbum( p_item );
                 }
                 else if( !strcmp( psz_meta, "GENRE" ) )
                 {
-                    psz_val = input_ItemGetInfo( p_item,
-                                _(VLC_META_INFO_CAT), _(VLC_META_GENRE) );
-                }
-                else
-                {
-                    psz_val = input_ItemGetInfo( p_item,
-                                            _(VLC_META_INFO_CAT), psz_meta );
+                    psz_val = input_item_GetGenre( p_item );
                 }
 #undef p_item
             }
index a95f87b06e045f97ae7c9bd6574220c10fe69b93..ea82a3bf69b4d9aa701b7af918941a2f4fae8380 100644 (file)
@@ -184,9 +184,11 @@ static int Demux( demux_t *p_demux )
 
             p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,
                                         0, NULL, i_duration );
+
             if ( psz_artist && *psz_artist )
-                input_ItemAddInfo( p_input, _(VLC_META_INFO_CAT),
-                                   _(VLC_META_ARTIST), "%s", psz_artist );
+                input_item_SetArtist( p_input, psz_artist );
+            free( psz_artist );
+
             input_ItemAddSubItem( p_current_input, p_input );
             for( unsigned i = 0; i < i_options; i++ )
                 input_ItemAddOpt( p_input, ppsz_options[i], 0 );
index c6bf81c7fd2b79f9edee501ad9bdd40341718763..11d8b144aeddde844f53d0c9d8ac6c27f3a66c1f 100644 (file)
@@ -78,8 +78,8 @@ static VLCInfo *_o_sharedInstance = nil;
     /* constants defined in vlc_meta.h */
     [o_genre_lbl setStringValue: _NS(VLC_META_GENRE)];
     [o_copyright_lbl setStringValue: _NS(VLC_META_COPYRIGHT)];
-    [o_collection_lbl setStringValue: _NS(VLC_META_COLLECTION)];
-    [o_seqNum_lbl setStringValue: _NS(VLC_META_SEQ_NUM)];
+    [o_collection_lbl setStringValue: _NS(VLC_META_ALBUM)];
+    [o_seqNum_lbl setStringValue: _NS(VLC_META_TRACK_NUMBER)];
     [o_description_lbl setStringValue: _NS(VLC_META_DESCRIPTION)];
     [o_date_lbl setStringValue: _NS(VLC_META_DATE)];
     [o_language_lbl setStringValue: _NS(VLC_META_LANGUAGE)];
index 208f8400d2585c0da36168a5f5c2492ac27ec877..b412f38593f7482e620721c8117726e2deaae7fe 100644 (file)
@@ -1787,14 +1787,8 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
         /* Meta data box */
         int l = 0;
 
-        int i_len = strlen( VLC_META_INFO_CAT );
-        char psz_title[i_len + 3];
-        psz_title[0] = ' ';
-        psz_title[1] = '\0';
-        strcat( &psz_title[1], VLC_META_INFO_CAT );
-        psz_title[i_len + 1] = ' ';
-        psz_title[i_len + 2] = '\0';
-        DrawBox( p_sys->w, y++, 0, h, COLS, psz_title, p_sys->b_color );
+        DrawBox( p_sys->w, y++, 0, h, COLS, _("Meta-information"),
+                 p_sys->b_color );
 
         if( p_input )
         {
@@ -1819,9 +1813,9 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
                         case 3:
                             psz_meta_title = VLC_META_COPYRIGHT; break;
                         case 4:
-                            psz_meta_title = VLC_META_COLLECTION; break;
+                            psz_meta_title = VLC_META_ALBUM; break;
                         case 5:
-                            psz_meta_title = VLC_META_SEQ_NUM; break;
+                            psz_meta_title = VLC_META_TRACK_NUMBER; break;
                         case 6:
                             psz_meta_title = VLC_META_DESCRIPTION; break;
                         case 7:
index 336a9a2acdd41d8973cb81abade3bf1fd2e9ca59..b1fd45aee6d33b66aa38929f06212a9de2d1fb3e 100644 (file)
@@ -149,6 +149,7 @@ noinst_HEADERS = \
        components/playlist/panels.hpp \
        components/playlist/playlist.hpp \
        components/playlist/selector.hpp \
+       components/playlist/sorting.h \
        util/input_slider.hpp \
        util/customwidgets.hpp \
        util/qvlcframe.hpp \
index ae201d3b64767449bebe56d62c642f9b4f40ae4b..4f1612f0660fc0fe05a25618a8c22e432b5cc302 100644 (file)
@@ -67,7 +67,7 @@ MetaPanel::MetaPanel( QWidget *parent,
     /* Title, artist and album*/
     ADD_META( VLC_META_TITLE, title_text ); /* OK */
     ADD_META( VLC_META_ARTIST, artist_text ); /* OK */
-    ADD_META( VLC_META_COLLECTION, collection_text ); /* OK */
+    ADD_META( VLC_META_ALBUM, collection_text ); /* OK */
 
     /* Genre Name */
     /* TODO List id3genres.h is not includable yet ? */
@@ -76,7 +76,7 @@ MetaPanel::MetaPanel( QWidget *parent,
     metaLayout->addWidget( genre_text, line, 1, 1, 3 );
 
     /* Number - on the same line */
-    metaLayout->addWidget( new QLabel( qtr( "Track Number" )  + " :" ),
+    metaLayout->addWidget( new QLabel( qtr( VLC_META_TRACK_NUMBER )  + " :" ),
                   line, 5, 1, 2  );
     seqnum_text = new QLineEdit;
     seqnum_text->setInputMask("0000");
index 896ca66d10703f380dd9861723c6dae0d443fd16..dcb598cb34ab50dd7456ff34540b11ed9d9e236f 100644 (file)
@@ -36,6 +36,8 @@
 
 #include <QSettings>
 
+#include "sorting.h"
+
 /*************************************************************************
  * Playlist item implementation
  *************************************************************************/
@@ -109,40 +111,12 @@ void PLItem::updateColumnHeaders()
 {
     item_col_strings.clear();
 
-    for( int i_index=1; i_index <= VLC_META_ENGINE_ART_URL; i_index *= 2 )
+    assert( i_showflags < COLUMN_END );
+
+    for( uint32_t i_index=1; i_index < COLUMN_END; i_index <<= 1 )
     {
         if( i_showflags & i_index )
-        {
-            switch( i_index )
-            {
-            case VLC_META_ENGINE_TRACKID:
-                item_col_strings.append( qtr( VLC_META_TRACKID ) );
-                break;
-            case VLC_META_ENGINE_ARTIST:
-                item_col_strings.append( qtr( VLC_META_ARTIST ) );
-                break;
-            case VLC_META_ENGINE_TITLE:
-                item_col_strings.append( qtr( VLC_META_TITLE ) );
-                break;
-            case VLC_META_ENGINE_DESCRIPTION:
-                item_col_strings.append( qtr( VLC_META_DESCRIPTION ) );
-                break;
-            case VLC_META_ENGINE_DURATION:
-                item_col_strings.append( qtr( VLC_META_DURATION ) );
-                break;
-            case VLC_META_ENGINE_GENRE:
-                item_col_strings.append( qtr( VLC_META_GENRE ) );
-                break;
-            case VLC_META_ENGINE_COLLECTION:
-                item_col_strings.append( qtr( VLC_META_COLLECTION ) );
-                break;
-            case VLC_META_ENGINE_SEQ_NUM:
-                item_col_strings.append( qtr( VLC_META_SEQ_NUM ) );
-                break;
-            default:
-                break;
-            }
-        }
+            item_col_strings.append( psz_column_title( i_index ) );
     }
 }
 
@@ -206,63 +180,15 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
         return;
     }
 
-#define ADD_META( item, meta ) \
-    psz_meta = input_item_Get ## meta ( item->p_input ); \
-    item_col_strings.append( qfu( psz_meta ) ); \
-    free( psz_meta );
+    assert( parentItem->i_showflags < COLUMN_END );
 
-    for( int i_index=1; i_index <= VLC_META_ENGINE_ART_URL; i_index *= 2 )
+    for( uint32_t i_index=1; i_index < COLUMN_END; i_index <<= 1 )
     {
         if( parentItem->i_showflags & i_index )
         {
-            switch( i_index )
-            {
-            case VLC_META_ENGINE_ARTIST:
-                ADD_META( p_item, Artist );
-                break;
-            case VLC_META_ENGINE_TITLE:
-                char *psz_title;
-                psz_title = input_item_GetTitle( p_item->p_input );
-                if( psz_title )
-                {
-                    ADD_META( p_item, Title );
-                    free( psz_title );
-                }
-                else
-                {
-                    psz_title = input_item_GetName( p_item->p_input );
-                    if( psz_title )
-                    {
-                        item_col_strings.append( qfu( psz_title ) );
-                    }
-                    free( psz_title );
-                }
-                break;
-            case VLC_META_ENGINE_DESCRIPTION:
-                ADD_META( p_item, Description );
-                break;
-            case VLC_META_ENGINE_DURATION:
-                secstotimestr( psz_duration,
-                    input_item_GetDuration( p_item->p_input ) / 1000000 );
-                item_col_strings.append( QString( psz_duration ) );
-                break;
-            case VLC_META_ENGINE_GENRE:
-                ADD_META( p_item, Genre );
-                break;
-            case VLC_META_ENGINE_COLLECTION:
-                ADD_META( p_item, Album );
-                break;
-            case VLC_META_ENGINE_SEQ_NUM:
-                ADD_META( p_item, TrackNum );
-                break;
-            case VLC_META_ENGINE_TRACKID:
-                item_col_strings.append( QString::number( p_item->i_id ) );
-                break;
-            default:
-                break;
-            }
+            char *psz = psz_column_meta( p_item->p_input, i_index );
+            item_col_strings.append( psz );
+            free( psz );
         }
     }
-#undef ADD_META
 }
-
index dbbb2dec6bec61d58c4cd701f253a7be609c21dc..0191ae76a5599a130386b33fc379d07d69180ae8 100644 (file)
@@ -39,6 +39,8 @@
 #include <QApplication>
 #include <QSettings>
 
+#include "sorting.h"
+
 QIcon PLModel::icons[ITEM_TYPE_NUMBER];
 
 static int PlaylistChanged( vlc_object_t *, const char *,
@@ -72,8 +74,6 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
     assert( i_depth == DEPTH_SEL || i_depth == DEPTH_PL );
     p_intf            = _p_intf;
     p_playlist        = _p_playlist;
-    i_items_to_append = 0;
-    b_need_update     = false;
     i_cached_id       = -1;
     i_cached_input_id = -1;
     i_popup_item      = i_popup_parent = -1;
@@ -539,8 +539,6 @@ void PLModel::ProcessItemAppend( playlist_add_t *p_add )
 {
     playlist_item_t *p_item = NULL;
     PLItem *newItem = NULL;
-    i_items_to_append--;
-    if( b_need_update ) return;
 
     PLItem *nodeItem = FindById( rootItem, p_add->i_node );
     PL_LOCK;
@@ -719,23 +717,23 @@ void PLModel::sort( int column, Qt::SortOrder order )
 
 #define CHECK_COLUMN( meta )                        \
 {                                                   \
-    if( ( shownFlags() & VLC_META_ENGINE_##meta ) ) \
+    if( ( shownFlags() & meta ) )                   \
         i_index++;                                  \
     if( column == i_index )                         \
     {                                               \
-        i_flag = VLC_META_ENGINE_##meta;            \
+        i_flag = meta;                              \
         goto next;                                  \
     }                                               \
 }
 
-    CHECK_COLUMN( TRACKID );
-    CHECK_COLUMN( TITLE );
-    CHECK_COLUMN( DURATION );
-    CHECK_COLUMN( ARTIST );
-    CHECK_COLUMN( GENRE );
-    CHECK_COLUMN( COLLECTION );
-    CHECK_COLUMN( SEQ_NUM );
-    CHECK_COLUMN( DESCRIPTION );
+    CHECK_COLUMN( COLUMN_NUMBER );
+    CHECK_COLUMN( COLUMN_TITLE );
+    CHECK_COLUMN( COLUMN_DURATION );
+    CHECK_COLUMN( COLUMN_ARTIST );
+    CHECK_COLUMN( COLUMN_GENRE );
+    CHECK_COLUMN( COLUMN_ALBUM );
+    CHECK_COLUMN( COLUMN_TRACK_NUMBER );
+    CHECK_COLUMN( COLUMN_DESCRIPTION );
 
 #undef CHECK_COLUMN
 
@@ -745,22 +743,10 @@ next:
         playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
                                                         rootItem->i_id,
                                                         true );
-        int i_mode;
-        switch( i_flag )
-        {
-        case VLC_META_ENGINE_TRACKID:    i_mode = SORT_ID;               break;
-        case VLC_META_ENGINE_TITLE:      i_mode = SORT_TITLE_NODES_FIRST;break;
-        case VLC_META_ENGINE_DURATION:   i_mode = SORT_DURATION;         break;
-        case VLC_META_ENGINE_ARTIST:     i_mode = SORT_ARTIST;           break;
-        case VLC_META_ENGINE_GENRE:      i_mode = SORT_GENRE;            break;
-        case VLC_META_ENGINE_COLLECTION: i_mode = SORT_ALBUM;            break;
-        case VLC_META_ENGINE_SEQ_NUM:    i_mode = SORT_TRACK_NUMBER;     break;
-        case VLC_META_ENGINE_DESCRIPTION:i_mode = SORT_DESCRIPTION;      break;
-        default:                         i_mode = SORT_TITLE_NODES_FIRST;break;
-        }
         if( p_root )
         {
-            playlist_RecursiveNodeSort( p_playlist, p_root, i_mode,
+            playlist_RecursiveNodeSort( p_playlist, p_root,
+                                        i_column_sorting( i_flag ),
                                         order == Qt::AscendingOrder ?
                                             ORDER_NORMAL : ORDER_REVERSE );
             p_playlist->b_reset_currently_playing = true;
@@ -826,32 +812,16 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
 
 void PLModel::viewchanged( int meta )
 {
+    assert( meta );
     if( rootItem )
     {
-        int index=0;
-        switch( meta )
+        int index=-1;
+        while( meta )
         {
-        case VLC_META_ENGINE_TRACKID:
-            index=0; break;
-        case VLC_META_ENGINE_TITLE:
-            index=1; break;
-        case VLC_META_ENGINE_DURATION:
-            index=2; break;
-        case VLC_META_ENGINE_ARTIST:
-            index=3; break;
-        case VLC_META_ENGINE_GENRE:
-            index=4; break;
-        case VLC_META_ENGINE_COPYRIGHT:
-            index=5; break;
-        case VLC_META_ENGINE_COLLECTION:
-            index=6; break;
-        case VLC_META_ENGINE_SEQ_NUM:
-            index=7; break;
-        case VLC_META_ENGINE_DESCRIPTION:
-            index=8; break;
-        default:
-            break;
+            index++;
+            meta >>= 1;
         }
+
         /* UNUSED        emit layoutAboutToBeChanged(); */
         index = __MIN( index, rootItem->item_col_strings.count() );
         QModelIndex parent = createIndex( 0, 0, rootItem );
@@ -969,11 +939,6 @@ static int ItemAppended( vlc_object_t *p_this, const char *psz_variable,
     playlist_add_t *p_add = (playlist_add_t *)malloc( sizeof( playlist_add_t));
     memcpy( p_add, nval.p_address, sizeof( playlist_add_t ) );
 
-    if( ++p_model->i_items_to_append >= 50 )
-    {
-//        p_model->b_need_update = true;
-//        return VLC_SUCCESS;
-    }
     PLEvent *event = new PLEvent(  p_add );
     QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
     return VLC_SUCCESS;
index b7af5bb461aa3b1e87646d10f0a8f5702f45672a..28ce2708ccbc0a273b63049eab1a364b58469739 100644 (file)
@@ -96,9 +96,6 @@ public:
     int rowCount( const QModelIndex &parent = QModelIndex() ) const;
     int columnCount( const QModelIndex &parent = QModelIndex() ) const;
 
-    bool b_need_update;
-    int i_items_to_append;
-
     void rebuild(); void rebuild( playlist_item_t * );
     bool hasRandom(); bool hasLoop(); bool hasRepeat();
 
diff --git a/modules/gui/qt4/components/playlist/sorting.h b/modules/gui/qt4/components/playlist/sorting.h
new file mode 100644 (file)
index 0000000..e491780
--- /dev/null
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * sorting.h : commun sorting & column display code
+ ****************************************************************************
+ * Copyright © 2008 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Rafaël Carré <funman@videolanorg>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/* You can use these numbers with | and & to determine what you want to show */
+enum
+{
+    COLUMN_NUMBER       = 0x0001,
+    COLUMN_TITLE        = 0x0002,
+    COLUMN_DURATION     = 0x0004,
+    COLUMN_ARTIST       = 0x0008,
+    COLUMN_GENRE        = 0x0010,
+    COLUMN_ALBUM        = 0x0020,
+    COLUMN_TRACK_NUMBER = 0x0040,
+    COLUMN_DESCRIPTION  = 0x0080,
+
+    /* Add new entries here */
+
+    COLUMN_END
+};
+
+/* Return the title of a column */
+static const char * psz_column_title( uint32_t i_column )
+{
+    switch( i_column )
+    {
+    case COLUMN_NUMBER:          return "";
+    case COLUMN_TITLE:           return VLC_META_TITLE;
+    case COLUMN_DURATION:        return _("Duration");
+    case COLUMN_ARTIST:          return VLC_META_ARTIST;
+    case COLUMN_GENRE:           return VLC_META_GENRE;
+    case COLUMN_ALBUM:           return VLC_META_ALBUM;
+    case COLUMN_TRACK_NUMBER:    return VLC_META_TRACK_NUMBER;
+    case COLUMN_DESCRIPTION:     return VLC_META_DESCRIPTION;
+    default: abort();
+    }
+}
+
+/* Return the meta data associated with an item for a column
+ * Returned value has to be freed */
+static char * psz_column_meta( input_item_t *p_item, uint32_t i_column )
+{
+    char *psz;
+    int i_duration;
+    char psz_duration[MSTRTIME_MAX_SIZE];
+    switch( i_column )
+    {
+    case COLUMN_NUMBER:
+        return NULL;
+    case COLUMN_TITLE:
+        psz = input_item_GetTitle( p_item );
+        if( !psz )
+            psz = input_item_GetName( p_item );
+        return psz;
+    case COLUMN_DURATION:
+        i_duration = input_item_GetDuration( p_item ) / 1000000;
+        secstotimestr( psz_duration, i_duration );
+        return strdup( psz_duration );
+    case COLUMN_ARTIST:
+        return input_item_GetArtist( p_item );
+    case COLUMN_GENRE:
+        return input_item_GetGenre( p_item );
+    case COLUMN_ALBUM:
+        return input_item_GetAlbum( p_item );
+    case COLUMN_TRACK_NUMBER:
+        return input_item_GetTrackNum( p_item );
+    case COLUMN_DESCRIPTION:
+        return input_item_GetDescription( p_item );
+    default:
+        abort();
+    }
+}
+
+/* Return the playlist sorting mode for a given column */
+static inline int i_column_sorting( uint32_t i_column )
+{
+    switch( i_column )
+    {
+    case COLUMN_NUMBER:         return SORT_ID;
+    case COLUMN_TITLE:          return SORT_TITLE_NODES_FIRST;
+    case COLUMN_DURATION:       return SORT_DURATION;
+    case COLUMN_ARTIST:         return SORT_ARTIST;
+    case COLUMN_GENRE:          return SORT_GENRE;
+    case COLUMN_ALBUM:          return SORT_ALBUM;
+    case COLUMN_TRACK_NUMBER:   return SORT_TRACK_NUMBER;
+    case COLUMN_DESCRIPTION:    return SORT_DESCRIPTION;
+    default: abort();
+    }
+}
index bb4545c510ad2ee72d98f0f70f13880ef126cf7d..d420ac0e518e54bcbbba5be13bb679347784da5b 100644 (file)
@@ -47,6 +47,8 @@
 
 #include <assert.h>
 
+#include "sorting.h"
+
 StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
                                   intf_thread_t *_p_intf,
                                   playlist_t *p_playlist,
@@ -265,24 +267,25 @@ void StandardPLPanel::popupSelectColumn( QPoint pos )
 
     QMenu selectColMenu;
 
-#define ADD_META_ACTION( meta ) { \
-    QAction* option = selectColMenu.addAction( qfu(VLC_META_##meta) );      \
-    option->setCheckable( true );                                           \
-    option->setChecked( model->shownFlags() & VLC_META_ENGINE_##meta );     \
-    ContextUpdateMapper->setMapping( option, VLC_META_ENGINE_##meta );      \
-    CONNECT( option, triggered(), ContextUpdateMapper, map() );             \
+    char *psz_title;
+#define ADD_META_ACTION( meta ) {                                              \
+    QAction* option = selectColMenu.addAction( psz_column_title( meta ) );     \
+    option->setCheckable( true );                                              \
+    option->setChecked( model->shownFlags() & meta );                          \
+    ContextUpdateMapper->setMapping( option, meta );                           \
+    CONNECT( option, triggered(), ContextUpdateMapper, map() );                \
 }
 
     CONNECT( ContextUpdateMapper, mapped( int ),  model, viewchanged( int ) );
 
-    ADD_META_ACTION( TRACKID );
-    ADD_META_ACTION( TITLE );
-    ADD_META_ACTION( DURATION );
-    ADD_META_ACTION( ARTIST );
-    ADD_META_ACTION( GENRE );
-    ADD_META_ACTION( COLLECTION );
-    ADD_META_ACTION( SEQ_NUM );
-    ADD_META_ACTION( DESCRIPTION );
+    ADD_META_ACTION( COLUMN_NUMBER );
+    ADD_META_ACTION( COLUMN_TITLE );
+    ADD_META_ACTION( COLUMN_DURATION );
+    ADD_META_ACTION( COLUMN_ARTIST );
+    ADD_META_ACTION( COLUMN_GENRE );
+    ADD_META_ACTION( COLUMN_ALBUM );
+    ADD_META_ACTION( COLUMN_TRACK_NUMBER );
+    ADD_META_ACTION( COLUMN_DESCRIPTION );
 
 #undef ADD_META_ACTION
 
index 396fbfdff4a6f987f6648c8d49df25d4d5f5eb5c..fe7ce356e764c6b49cf5fbac5e4a24eaf6c1802e 100644 (file)
@@ -90,8 +90,8 @@ MetaDataPanel::MetaDataPanel( intf_thread_t *_p_intf,
     ADD_META( VLC_META_ARTIST, artist_text );
     ADD_META( VLC_META_GENRE, genre_text );
     ADD_META( VLC_META_COPYRIGHT, copyright_text );
-    ADD_META( VLC_META_COLLECTION, collection_text );
-    ADD_META( VLC_META_SEQ_NUM, seqnum_text );
+    ADD_META( VLC_META_ALBUM, collection_text );
+    ADD_META( VLC_META_TRACK_NUMBER, seqnum_text );
     ADD_META( VLC_META_DESCRIPTION, description_text );
     ADD_META( VLC_META_RATING, rating_text );
     ADD_META( VLC_META_DATE, date_text );
index c54b04e35489c07cd04947a26b11803faf2e5717..25a0af901f28662492dd3560b6d0805d8c43f005 100644 (file)
@@ -41,7 +41,6 @@
  * Local prototypes
  *****************************************************************************/
 static int FindArt( vlc_object_t * );
-static int FindMetaMBId( vlc_object_t *p_this );
 
 /*****************************************************************************
  * Module descriptor
@@ -51,22 +50,13 @@ vlc_module_begin();
     set_shortname( N_( "MusicBrainz" ) );
     set_description( _("MusicBrainz meta data") );
 
-    set_capability( "meta fetcher", 10 );
-        /* This meta fetcher module only retrieves the musicbrainz track id
-         * and stores it
-         * TODO:
-         *  - Actually do it
-         *  - Also store the album id
-         * */
-        set_callbacks( FindMetaMBId, NULL );
-    add_submodule();
-        /* This art finder module fetches the album ID from musicbrainz and
-         * uses it to fetch the amazon ASIN from musicbrainz.
-         * TODO:
-         *  - Add ability to reuse MB album ID if we already have it
-         */
-        set_capability( "art finder", 80 );
-        set_callbacks( FindArt, NULL );
+    /* This art finder module fetches the album ID from musicbrainz and
+     * uses it to fetch the amazon ASIN from musicbrainz.
+     * TODO:
+     *  - Add ability to reuse MB album ID if we already have it
+     */
+    set_capability( "art finder", 80 );
+    set_callbacks( FindArt, NULL );
 vlc_module_end();
 
 /*****************************************************************************
@@ -169,23 +159,6 @@ static int GetData( vlc_object_t *p_obj, input_item_t *p_item,
         return b_art_found ? VLC_SUCCESS : VLC_EGENERIC;
 }
 
-static int FindMetaMBId( vlc_object_t *p_this )
-{
-    meta_engine_t *p_me = (meta_engine_t *)p_this;
-    input_item_t *p_item = p_me->p_item;
-    int i_ret = GetData( VLC_OBJECT(p_me), p_item,
-                         p_me->i_mandatory & VLC_META_ENGINE_ART_URL );
-
-    if( !i_ret )
-    {
-        uint32_t i_meta = input_CurrentMetaFlags( input_item_GetMetaObject( p_item ) );
-        p_me->i_mandatory &= ~i_meta;
-        p_me->i_optional &= ~i_meta;
-        return p_me->i_mandatory ? VLC_EGENERIC : VLC_SUCCESS;
-    }
-    return VLC_EGENERIC;
-}
-
 static int FindArt( vlc_object_t *p_this )
 {
     playlist_t *p_playlist = (playlist_t *)p_this;
index 704a8cbeca08dfea740262598530da0ea41a1b13..cf67a6eff3fa79e794f5605531c44fab2f579636 100644 (file)
@@ -278,20 +278,6 @@ static int fetch_meta( vlc_object_t *p_this, const char * psz_filename,
     return VLC_EGENERIC;
 }
 
-/*****************************************************************************
- * Module entry point for meta.
- *****************************************************************************/
-int E_(FindMeta)( vlc_object_t *p_this )
-{
-    meta_engine_t *p_me = (meta_engine_t *)p_this;
-    input_item_t *p_item = p_me->p_item;
-    lua_State *L = vlclua_meta_init( p_this, p_item );
-
-    int i_ret = vlclua_scripts_batch_execute( p_this, "meta", &fetch_meta, L, p_item );
-    lua_close( L );
-    return i_ret;
-}
-
 /*****************************************************************************
  * Module entry point for art.
  *****************************************************************************/
index d1cc1e3215a658d470c2368b2c1f04ceaad72ab3..cae02cc40edb36980af54b4fbaa2f6db3a812b02 100644 (file)
 #define CONFIG_LONGTEXT N_("Lua interface configuration string. Format is: '[\"<interface module name>\"] = { <option> = <value>, ...}, ...'.")
 
 vlc_module_begin();
-    add_submodule();
-        add_shortcut( "luameta" );
-        set_shortname( N_( "Lua Meta" ) );
-        set_description( _("Fetch metadata using lua scripts") );
-        set_capability( "meta fetcher", 10 );
-        set_callbacks( E_(FindMeta), NULL );
     add_submodule();
         set_shortname( N_( "Lua Art" ) );
         set_description( _("Fetch artwork using lua scripts") );
index 1866f6586095950926c7498722b8e66473722c6e..8eab191bd284d333bf5bb852491d065729d4210e 100644 (file)
@@ -49,7 +49,6 @@
  * Module entry points
  *****************************************************************************/
 int E_(FindArt)( vlc_object_t * );
-int E_(FindMeta)( vlc_object_t * );
 
 int E_(Import_LuaPlaylist)( vlc_object_t * );
 void E_(Close_LuaPlaylist)( vlc_object_t * );
index 42960c4debe2aa82d690ae2aeb466e93ff793401..beb50068ccc6422c4373257de6204c58667b889b 100644 (file)
@@ -884,8 +884,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint16_t i_hash,
     psz_value = GetAttribute( p_sap->p_sdp->pp_attributes, p_sap->p_sdp->i_attributes, "tool" );
     if( psz_value != NULL )
     {
-        input_ItemAddInfo( p_input, _("Session"), _("Tool"), "%s",
-                           psz_value );
+        input_ItemAddInfo( p_input, _("Session"), _("Tool"), "%s", psz_value );
     }
     if( strcmp( p_sdp->username, "-" ) )
     {
index f42fdbb37d47d02dc615d240a0e526de8e3b71b1..0146d46182657a03820ea6d8937818b5a6d9db33 100644 (file)
@@ -285,9 +285,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     }
 
     /* Remove 'Now playing' info as it is probably outdated */
-    input_Control( p_input, INPUT_DEL_INFO,
-        _(VLC_META_INFO_CAT),
-        _(VLC_META_NOW_PLAYING) );
     input_item_SetNowPlaying( p_item, NULL );
 
     /* */
@@ -2633,7 +2630,6 @@ static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
     input_item_t *p_item = p_input->p->input.p_item;
     char * psz_arturl = NULL;
     char *psz_title = NULL;
-    int i;
     int i_arturl_event = false;
 
     if( !p_meta )
@@ -2697,19 +2693,6 @@ static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
         free( psz_title );
     }
 
-    if( p_meta )
-    {
-        char ** ppsz_all_keys = vlc_dictionary_all_keys( &p_meta->extra_tags );
-        for( i = 0; ppsz_all_keys[i]; i++ )
-        {
-            input_Control( p_input, INPUT_ADD_INFO, _(VLC_META_INFO_CAT), _(ppsz_all_keys[i]),
-                    vlc_dictionary_value_for_key( &p_meta->extra_tags, ppsz_all_keys[i] ) );
-            free( ppsz_all_keys[i] );
-        }
-        free( ppsz_all_keys );
-        vlc_meta_Delete( p_meta );
-    }
-
     /** \todo handle sout meta */
 }
 
index 8a348a5dab69e89e984db7a47786259a75bcb2d5..110868f96a12c8bd390b03450cb269322a6a6f2d 100644 (file)
@@ -251,17 +251,6 @@ static inline void input_item_SetPreparsed( input_item_t *p_i, bool preparsed )
     }
 }
 
-static inline void input_item_SetMetaFetched( input_item_t *p_i, bool metafetched )
-{
-    if( !p_i->p_meta )
-        p_i->p_meta = vlc_meta_New();
-
-    if( metafetched )
-        p_i->p_meta->i_status |= ITEM_META_FETCHED;
-    else
-        p_i->p_meta->i_status &= ~ITEM_META_FETCHED;
-}
-
 static inline void input_item_SetArtNotFound( input_item_t *p_i, bool notfound )
 {
     if( !p_i->p_meta )
@@ -296,10 +285,7 @@ typedef struct playlist_album_t
     bool b_found;
 } playlist_album_t;
 
-int         input_MetaFetch     ( playlist_t *, input_item_t * );
 int         input_ArtFind       ( playlist_t *, input_item_t * );
-bool  input_MetaSatisfied ( playlist_t*, input_item_t*,
-                                  uint32_t*, uint32_t* );
 int         input_DownloadAndCacheArt ( playlist_t *, input_item_t * );
 
 /* Becarefull; p_item lock HAS to be taken */
index 14b9404878b3684d60818389785e62d2417465ad..bcb6603d6f6f9681b596484790aa4345017edec3 100644 (file)
 
 #include "../libvlc.h"
 
-static const char * meta_type_to_string[VLC_META_TYPE_COUNT] =
-{
-    [vlc_meta_Title]            = N_("Title"),
-    [vlc_meta_Artist]           = N_("Artist"),
-    [vlc_meta_Genre]            = N_("Genre"),
-    [vlc_meta_Copyright]        = N_("Copyright"),
-    [vlc_meta_Album]            = N_("Album"),
-    [vlc_meta_TrackNumber]      = N_("Track number"),
-    [vlc_meta_Description]      = N_("Description"),
-    [vlc_meta_Rating]           = N_("Rating"),
-    [vlc_meta_Date]             = N_("Date"),
-    [vlc_meta_Setting]          = N_("Setting"),
-    [vlc_meta_URL]              = N_("URL"),
-    [vlc_meta_Language]         = N_("Language"),
-    [vlc_meta_NowPlaying]       = N_("Now Playing"),
-    [vlc_meta_Publisher]        = N_("Publisher"),
-    [vlc_meta_EncodedBy]        = N_("Encoded by"),
-    [vlc_meta_ArtworkURL]       = N_("Artwork URL"),
-    [vlc_meta_TrackID]          = N_("Track ID"),
-};
-
 const char *
 input_MetaTypeToLocalizedString( vlc_meta_type_t meta_type )
 {
-    return _(meta_type_to_string[meta_type]);
-}
-
-#define input_FindArtInCache(a,b) __input_FindArtInCache(VLC_OBJECT(a),b)
-static int __input_FindArtInCache( vlc_object_t *, input_item_t *p_item );
-
-bool input_MetaSatisfied( playlist_t *p_playlist, input_item_t *p_item,
-                                uint32_t *pi_mandatory, uint32_t *pi_optional )
-{
-    VLC_UNUSED(p_playlist);
-    *pi_mandatory = VLC_META_ENGINE_TITLE | VLC_META_ENGINE_ARTIST;
-
-    uint32_t i_meta = input_CurrentMetaFlags( p_item->p_meta );
-    *pi_mandatory &= ~i_meta;
-    *pi_optional = 0; /// Todo
-    return *pi_mandatory ? false:true;
-}
-
-int input_MetaFetch( playlist_t *p_playlist, input_item_t *p_item )
-{
-    struct meta_engine_t *p_me;
-    uint32_t i_mandatory, i_optional;
-
-    input_MetaSatisfied( p_playlist, p_item, &i_mandatory, &i_optional );
-    // Meta shouldn't magically appear
-    assert( i_mandatory );
-
-    /* FIXME: object creation is overkill, use p_private */
-    p_me = vlc_custom_create( VLC_OBJECT(p_playlist), sizeof( *p_me ),
-                              VLC_OBJECT_GENERIC, "meta engine" );
-    p_me->i_flags |= OBJECT_FLAGS_NOINTERACT;
-    p_me->i_flags |= OBJECT_FLAGS_QUIET;
-    p_me->i_mandatory = i_mandatory;
-    p_me->i_optional = i_optional;
-
-    p_me->p_item = p_item;
-    p_me->p_module = module_Need( p_me, "meta fetcher", 0, false );
-    if( !p_me->p_module )
+    switch( meta_type )
     {
-        vlc_object_release( p_me );
-        return VLC_EGENERIC;
+    case vlc_meta_Title:        return _("Title");
+    case vlc_meta_Artist:       return _("Artist");
+    case vlc_meta_Genre:        return _("Genre");
+    case vlc_meta_Copyright:    return _("Copyright");
+    case vlc_meta_Album:        return _("Album");
+    case vlc_meta_TrackNumber:  return _("Track number");
+    case vlc_meta_Description:  return _("Description");
+    case vlc_meta_Rating:       return _("Rating");
+    case vlc_meta_Date:         return _("Date");
+    case vlc_meta_Setting:      return _("Setting");
+    case vlc_meta_URL:          return _("URL");
+    case vlc_meta_Language:     return _("Language");
+    case vlc_meta_NowPlaying:   return _("Now Playing");
+    case vlc_meta_Publisher:    return _("Publisher");
+    case vlc_meta_EncodedBy:    return _("Encoded by");
+    case vlc_meta_ArtworkURL:   return _("Artwork URL");
+    case vlc_meta_TrackID:      return _("Track ID");
+
+    default: abort();
     }
-    module_Unneed( p_me, p_me->p_module );
-    vlc_object_release( p_me );
-
-    input_item_SetMetaFetched( p_item, true );
+};
 
-    return VLC_SUCCESS;
-}
+#define input_FindArtInCache(a,b) __input_FindArtInCache(VLC_OBJECT(a),b)
+static int __input_FindArtInCache( vlc_object_t *, input_item_t *p_item );
 
 /* Return codes:
  *   0 : Art is in cache or is a local file
@@ -576,35 +532,3 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
         fclose( f );
     }
 }
-
-
-uint32_t input_CurrentMetaFlags( const vlc_meta_t *p_meta )
-{
-    uint32_t i_meta = 0;
-
-    if( !p_meta )
-        return 0;
-
-#define CHECK( a, b ) \
-    if( !EMPTY_STR( vlc_meta_Get( p_meta, vlc_meta_ ## a ) ) ) \
-        i_meta |= VLC_META_ENGINE_ ## b;
-
-    CHECK( Title, TITLE )
-    CHECK( Artist, ARTIST )
-    CHECK( Album, COLLECTION )
-#if 0
-    /* As this is not used at the moment, don't uselessly check for it.
-     * Re-enable this when it is used */
-    CHECK( Genre, GENRE )
-    CHECK( Copyright, COPYRIGHT )
-    CHECK( Tracknum, SEQ_NUM )
-    CHECK( Description, DESCRIPTION )
-    CHECK( Rating, RATING )
-    CHECK( Date, DATE )
-    CHECK( URL, URL )
-    CHECK( Language, LANGUAGE )
-#endif
-    CHECK( ArtworkURL, ART_URL )
-
-    return i_meta;
-}
index 3940aa1601ccf6cb3bc6ab6790bed5dda4e34ecd..23ec831828ed323cae7682ccbf3396435e367cf3 100644 (file)
@@ -1074,11 +1074,6 @@ static const char *ppsz_clock_descriptions[] =
     "Automatically preparse files added to the playlist " \
     "(to retrieve some metadata)." )
 
-#define FETCH_META_TEXT N_( "Authorise meta information fetching" )
-#define FETCH_META_LONGTEXT N_( \
-    "Specify if you want to attempt to fetch files'"\
-    "meta informations using the network." )
-
 #define ALBUM_ART_TEXT N_( "Album art policy" )
 #define ALBUM_ART_LONGTEXT N_( \
     "Choose how album art will be downloaded." )
@@ -1872,9 +1867,6 @@ vlc_module_begin();
     add_bool( "auto-preparse", true, NULL, PREPARSE_TEXT,
               PREPARSE_LONGTEXT, false );
 
-    add_integer( "fetch-meta", true, NULL, FETCH_META_TEXT,
-                 FETCH_META_LONGTEXT, false );
-
     add_integer( "album-art", ALBUM_ART_WHEN_ASKED, NULL, ALBUM_ART_TEXT,
                  ALBUM_ART_LONGTEXT, false );
         change_integer_list( pi_albumart_values,
index 30af37faea76a90202fc2f3bae33df91ea4ab019..7ff191056507b87008475e2840b31544703d29cb 100644 (file)
@@ -123,7 +123,6 @@ InitMD5
 input_AddSubtitles
 input_Control
 __input_CreateThread
-input_CurrentMetaFlags
 input_DecoderDecode
 input_DecoderDelete
 input_DecoderNew
index 116be7fb4cb71752063c3d472e9cc68ac843fac6..d07f5d140e5b88b5705ee7457a661f6b37f57015 100644 (file)
@@ -202,18 +202,13 @@ int playlist_AskForArtEnqueue( playlist_t *p_playlist,
                                input_item_t *p_item )
 {
     int i;
-    preparse_item_t p;
-    p.p_item = p_item;
-    p.b_fetch_art = true;
 
     vlc_object_lock( p_playlist->p_fetcher );
-    for( i = 0; i < p_playlist->p_fetcher->i_waiting &&
-         p_playlist->p_fetcher->p_waiting->b_fetch_art == true;
-         i++ );
+    for( i = 0; i < p_playlist->p_fetcher->i_waiting ; i++ );
     vlc_gc_incref( p_item );
-    INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
+    INSERT_ELEM( p_playlist->p_fetcher->pp_waiting,
                  p_playlist->p_fetcher->i_waiting,
-                 i, p );
+                 i, p_item );
     vlc_object_signal_unlocked( p_playlist->p_fetcher );
     vlc_object_unlock( p_playlist->p_fetcher );
     return VLC_SUCCESS;
index 70e156012285562607cff4c516de46e278abef33..4359ee58834762f37433a090258fb19e95505540 100644 (file)
@@ -499,7 +499,6 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
     playlist_t *p_playlist = (playlist_t *)p_obj->p_parent;
     input_item_t *p_current;
     int i_activity;
-    uint32_t i_m, i_o;
 
     while( !p_playlist->b_die )
     {
@@ -544,31 +543,14 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
              */
             char *psz_arturl = input_item_GetArtURL( p_current );
             char *psz_name = input_item_GetName( p_current );
-            if( !input_MetaSatisfied( p_playlist, p_current, &i_m, &i_o ) )
-            {
-                preparse_item_t p;
-                PL_DEBUG( "need to fetch meta for %s", p_current->psz_name );
-                p.p_item = p_current;
-                p.b_fetch_art = false;
-                vlc_object_lock( p_playlist->p_fetcher );
-                INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
-                             p_playlist->p_fetcher->i_waiting,
-                             p_playlist->p_fetcher->i_waiting, p);
-                vlc_object_signal_unlocked( p_playlist->p_fetcher );
-                vlc_object_unlock( p_playlist->p_fetcher );
-            }
-            /* We already have all needed meta, but we need art right now */
-            else if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL &&
+            if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL &&
                         ( !psz_arturl || strncmp( psz_arturl, "file://", 7 ) ) )
             {
-                preparse_item_t p;
                 PL_DEBUG("meta ok for %s, need to fetch art", psz_name );
-                p.p_item = p_current;
-                p.b_fetch_art = true;
                 vlc_object_lock( p_playlist->p_fetcher );
-                INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
+                INSERT_ELEM( p_playlist->p_fetcher->pp_waiting,
                              p_playlist->p_fetcher->i_waiting,
-                             p_playlist->p_fetcher->i_waiting, p);
+                             p_playlist->p_fetcher->i_waiting, p_current);
                 vlc_object_signal_unlocked( p_playlist->p_fetcher );
                 vlc_object_unlock( p_playlist->p_fetcher );
             }
@@ -604,7 +586,6 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
 void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
 {
     playlist_t *p_playlist = (playlist_t *)p_obj->p_parent;
-    bool b_fetch_art;
     input_item_t *p_item;
     int i_activity;
 
@@ -621,83 +602,52 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
             }
         }
 
-        b_fetch_art = p_obj->p_waiting->b_fetch_art;
-        p_item = p_obj->p_waiting->p_item;
-        REMOVE_ELEM( p_obj->p_waiting, p_obj->i_waiting, 0 );
+        p_item = p_obj->pp_waiting[0];
+        REMOVE_ELEM( p_obj->pp_waiting, p_obj->i_waiting, 0 );
         vlc_mutex_unlock( &p_obj->object_lock );
         if( p_item )
         {
-            if( !b_fetch_art )
+            int i_ret;
+
+            /* Check if it is not yet preparsed and if so wait for it (at most 0.5s)
+             * (This can happen if we fetch art on play)
+             * FIXME this doesn't work if we need to fetch meta before art ... */
+            for( i_ret = 0; i_ret < 10 && !input_item_IsPreparsed( p_item ); i_ret++ )
             {
-                /* If the user doesn't want us to fetch meta automatically
-                 * abort here. */
-                if( p_playlist->p_fetcher->b_fetch_meta )
-                {
-                    input_MetaFetch( p_playlist, p_item );
-                    var_SetInteger( p_playlist, "item-change", p_item->i_id );
-                }
+                bool b_break;
+                PL_LOCK;
+                b_break = ( !p_playlist->p_input || input_GetItem(p_playlist->p_input) != p_item  ||
+                            p_playlist->p_input->b_die || p_playlist->p_input->b_eof || p_playlist->p_input->b_error );
+                PL_UNLOCK;
+                if( b_break )
+                    break;
+                msleep( 50000 );
+            }
 
-                /*  Fetch right now */
-                if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL )
-                {
-                    vlc_mutex_lock( &p_obj->object_lock );
-                    preparse_item_t p;
-                    p.p_item = p_item;
-                    p.b_fetch_art = true;
-                    INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
-                                 p_playlist->p_fetcher->i_waiting,
-                                 0, p );
-                    PL_DEBUG( "meta fetched for %s, get art", p_item->psz_name );
-                    vlc_mutex_unlock( &p_obj->object_lock );
-                    continue;
+            i_ret = input_ArtFind( p_playlist, p_item );
+            if( i_ret == 1 )
+            {
+                PL_DEBUG( "downloading art for %s", p_item->psz_name );
+                if( input_DownloadAndCacheArt( p_playlist, p_item ) )
+                    input_item_SetArtNotFound( p_item, true );
+                else {
+                    input_item_SetArtFetched( p_item, true );
+                    var_SetInteger( p_playlist, "item-change",
+                                    p_item->i_id );
                 }
-                else
-                    vlc_gc_decref( p_item );
+            }
+            else if( i_ret == 0 ) /* Was in cache */
+            {
+                PL_DEBUG( "found art for %s in cache", p_item->psz_name );
+                input_item_SetArtFetched( p_item, true );
+                var_SetInteger( p_playlist, "item-change", p_item->i_id );
             }
             else
             {
-                int i_ret;
-
-                /* Check if it is not yet preparsed and if so wait for it (at most 0.5s)
-                 * (This can happen if we fetch art on play)
-                 * FIXME this doesn't work if we need to fetch meta before art ... */
-                for( i_ret = 0; i_ret < 10 && !input_item_IsPreparsed( p_item ); i_ret++ )
-                {
-                    bool b_break;
-                    PL_LOCK;
-                    b_break = ( !p_playlist->p_input || input_GetItem(p_playlist->p_input) != p_item  ||
-                                p_playlist->p_input->b_die || p_playlist->p_input->b_eof || p_playlist->p_input->b_error );
-                    PL_UNLOCK;
-                    if( b_break )
-                        break;
-                    msleep( 50000 );
-                }
-
-                i_ret = input_ArtFind( p_playlist, p_item );
-                if( i_ret == 1 )
-                {
-                    PL_DEBUG( "downloading art for %s", p_item->psz_name );
-                    if( input_DownloadAndCacheArt( p_playlist, p_item ) )
-                        input_item_SetArtNotFound( p_item, true );
-                    else {
-                        input_item_SetArtFetched( p_item, true );
-                        var_SetInteger( p_playlist, "item-change",
-                                        p_item->i_id );
-                    }
-                }
-                else if( i_ret == 0 ) /* Was in cache */
-                {
-                    PL_DEBUG( "found art for %s in cache", p_item->psz_name );
-                    input_item_SetArtFetched( p_item, true );
-                    var_SetInteger( p_playlist, "item-change", p_item->i_id );
-                }
-                else
-                {
-                    PL_DEBUG( "art not found for %s", p_item->psz_name );
-                    input_item_SetArtNotFound( p_item, true );
-                }
-                vlc_gc_decref( p_item );
-           }
+                PL_DEBUG( "art not found for %s", p_item->psz_name );
+                input_item_SetArtNotFound( p_item, true );
+            }
+            vlc_gc_decref( p_item );
         }
         vlc_object_lock( p_obj );
         i_activity = var_GetInteger( p_playlist, "activity" );
index f1f3a444cf54d4fb63d13c7c51afaf69988d266a..94ab3f687247ea1eb6521a9d95bc62fa170c98fe 100644 (file)
@@ -44,20 +44,13 @@ struct playlist_preparse_t
     input_item_t  **pp_waiting;
 };
 
-typedef struct preparse_item_t
-{
-    input_item_t *p_item;
-    bool   b_fetch_art;
-} preparse_item_t;
-
 struct playlist_fetcher_t
 {
     VLC_COMMON_MEMBERS
     vlc_mutex_t     lock;
     int             i_art_policy;
-    bool      b_fetch_meta;
     int             i_waiting;
-    preparse_item_t *p_waiting;
+    input_item_t    **pp_waiting;
 
     DECL_ARRAY(playlist_album_t) albums;
 };
index 3e2a3d85f59da04449b3de51fff65acebbd64597..8603fb212fe79eeffa46cc29d5f67485b360680f 100644 (file)
@@ -93,9 +93,7 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
         return;
     }
     p_playlist->p_fetcher->i_waiting = 0;
-    p_playlist->p_fetcher->p_waiting = NULL;
-    p_playlist->p_fetcher->b_fetch_meta = var_CreateGetInteger( p_playlist,
-                                                                 "fetch-meta" );
+    p_playlist->p_fetcher->pp_waiting = NULL;
     p_playlist->p_fetcher->i_art_policy = var_CreateGetInteger( p_playlist,
                                                                 "album-art" );
 
@@ -203,5 +201,5 @@ static void PreparseDestructor( vlc_object_t * p_this )
 static void FetcherDestructor( vlc_object_t * p_this )
 {
     playlist_fetcher_t * p_fetcher = (playlist_fetcher_t *)p_this;
-    free( p_fetcher->p_waiting );
+    free( p_fetcher->pp_waiting );
 }