Commit c17290dc authored by Antoine Cellerier's avatar Antoine Cellerier

[patch] unifying meta-information access, the 2nd by Daniel Stränger

parent 8fbceb81
......@@ -38,7 +38,7 @@ Colin Simmonds <colin_simmonds at Mac.lover.org> - compile fix for Mac OS X
Damian Ivereigh <damian at cisco.com> - ac3dec uninitialized data structure fix
Damien Fouilleul <damien.fouilleul at laposte.net> - DirectShow input improvements
Daniel Fischer <dan at subsignal dot org> - Shoutcast output support
Daniel Stränger <vlc at schmaller d0t de> - M3U, xtag and playlist improvements
Daniel Stränger <vlc at schmaller d0t de> - M3U, xtag and playlist improvements. Meta information core fixes
David Kennedy <dkennedy at tinytoad.com> - X11 fullscreen patch
Daniel Nylander <info@danielnylander at se> - Swedish translation
David Weber <david_weber at gmx.de> - Mac OS X interface design & graphics (v0.5.0)
......
......@@ -25,11 +25,14 @@
#define _VLC_META_H 1
/* VLC meta name */
#define VLC_META_INFO_CAT N_("Meta-information")
#define VLC_META_TITLE N_("Title")
#define VLC_META_AUTHOR N_("Author")
#define VLC_META_ARTIST N_("Artist")
#define VLC_META_GENRE N_("Genre")
#define VLC_META_COPYRIGHT N_("Copyright")
#define VLC_META_COLLECTION N_("Album/movie/show title")
#define VLC_META_SEQ_NUM N_("Track number/position in set")
#define VLC_META_DESCRIPTION N_("Description")
#define VLC_META_RATING N_("Rating")
#define VLC_META_DATE N_("Date")
......
......@@ -508,7 +508,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
p_access->info.i_title+1 );
pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
*pp_meta = vlc_meta_New();
vlc_meta_Add( *pp_meta, VLC_META_TITLE, psz_title );
vlc_meta_Add( *pp_meta, _(VLC_META_TITLE), psz_title );
free( psz_title );
break;
......@@ -593,7 +593,7 @@ static int GetTracks( access_t *p_access, vlc_bool_t b_separate,
}
else
{
char *psz_uri; int i_size, i_length;
char *psz_uri;
int i_path_len = p_access->psz_path ? strlen( p_access->psz_path )
: 0;
char *psz_opt;
......@@ -624,8 +624,8 @@ static int GetTracks( access_t *p_access, vlc_bool_t b_separate,
if( cddb_track_get_title( t ) != NULL )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
VLC_META_TITLE,
_(VLC_META_INFO_CAT),
_(VLC_META_TITLE),
cddb_track_get_title( t ) );
if( p_item->input.psz_name )
free( p_item->input.psz_name );
......@@ -636,8 +636,8 @@ static int GetTracks( access_t *p_access, vlc_bool_t b_separate,
if( psz_result )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
VLC_META_ARTIST, psz_result );
_(VLC_META_INFO_CAT),
_(VLC_META_ARTIST), psz_result );
}
}
}
......
......@@ -617,11 +617,11 @@ static void ParseVorbisComments( decoder_t *p_dec )
psz_value++;
input_Control( p_input, INPUT_ADD_INFO, _("Vorbis comment"),
psz_name, psz_value );
/* HACK, we should use meta */
if( strcasestr( psz_name, "artist" ) )
{
input_Control( p_input, INPUT_ADD_INFO, _("Meta-information"),
_("Artist"), psz_value );
vlc_input_item_AddInfo( p_input->input.p_item,
_(VLC_META_INFO_CAT), _(VLC_META_ARTIST),
"%s", psz_value );
}
else if( strcasestr( psz_name, "title" ) )
{
......
......@@ -321,7 +321,7 @@ static int Demux( demux_t *p_demux )
if( psz_now )
{
vlc_input_item_AddInfo( &(p_item->input),
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( VLC_META_NOW_PLAYING ),
"%s",
psz_now );
......@@ -329,7 +329,7 @@ static int Demux( demux_t *p_demux )
if( psz_genre )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( VLC_META_GENRE ),
"%s",
psz_genre );
......@@ -337,7 +337,7 @@ static int Demux( demux_t *p_demux )
if( psz_listeners )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Listeners" ),
"%s",
psz_listeners );
......@@ -345,7 +345,7 @@ static int Demux( demux_t *p_demux )
if( psz_bitrate )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Bitrate" ),
"%s",
psz_bitrate );
......
......@@ -206,8 +206,8 @@ static int Demux( demux_t *p_demux )
}
p_item->input.i_duration = i_duration;
if ( psz_artist && *psz_artist )
vlc_input_item_AddInfo( &p_item->input, _("Meta-information"),
_("Artist"), "%s", psz_artist );
vlc_input_item_AddInfo( &p_item->input, _(VLC_META_INFO_CAT),
_(VLC_META_ARTIST), "%s", psz_artist );
playlist_NodeAddItem( p_playlist, p_item,
p_current->pp_parents[0]->i_view,
p_current, PLAYLIST_APPEND,
......
......@@ -286,7 +286,7 @@ static int Demux( demux_t *p_demux )
&& !strcmp( psz_elname, "link" ) )
{
vlc_input_item_AddInfo( &(p_current->input),
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Link" ),
"%s",
psz_text );
......@@ -295,7 +295,7 @@ static int Demux( demux_t *p_demux )
&& !strcmp( psz_elname, "copyright" ) )
{
vlc_input_item_AddInfo( &(p_current->input),
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Copyright" ),
"%s",
psz_text );
......@@ -304,7 +304,7 @@ static int Demux( demux_t *p_demux )
&& !strcmp( psz_elname, "itunes:category" ) )
{
vlc_input_item_AddInfo( &(p_current->input),
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Category" ),
"%s",
psz_text );
......@@ -313,7 +313,7 @@ static int Demux( demux_t *p_demux )
&& !strcmp( psz_elname, "itunes:keywords" ) )
{
vlc_input_item_AddInfo( &(p_current->input),
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Keywords" ),
"%s",
psz_text );
......@@ -322,7 +322,7 @@ static int Demux( demux_t *p_demux )
&& !strcmp( psz_elname, "itunes:subtitle" ) )
{
vlc_input_item_AddInfo( &(p_current->input),
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Subtitle" ),
"%s",
psz_text );
......@@ -332,7 +332,7 @@ static int Demux( demux_t *p_demux )
||!strcmp( psz_elname, "description" ) ) )
{ /* <description> isn't standard iTunes podcast stuff */
vlc_input_item_AddInfo( &(p_current->input),
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Summary" ),
"%s",
psz_text );
......@@ -369,7 +369,7 @@ static int Demux( demux_t *p_demux )
if( psz_item_date )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Publication Date" ),
"%s",
psz_item_date );
......@@ -377,7 +377,7 @@ static int Demux( demux_t *p_demux )
if( psz_item_author )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Author" ),
"%s",
psz_item_author );
......@@ -385,7 +385,7 @@ static int Demux( demux_t *p_demux )
if( psz_item_category )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Subcategory" ),
"%s",
psz_item_category );
......@@ -393,7 +393,7 @@ static int Demux( demux_t *p_demux )
if( psz_item_duration )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Duration" ),
"%s",
psz_item_duration );
......@@ -401,7 +401,7 @@ static int Demux( demux_t *p_demux )
if( psz_item_keywords )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Keywords" ),
"%s",
psz_item_keywords );
......@@ -409,7 +409,7 @@ static int Demux( demux_t *p_demux )
if( psz_item_subtitle )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Subtitle" ),
"%s",
psz_item_subtitle );
......@@ -417,7 +417,7 @@ static int Demux( demux_t *p_demux )
if( psz_item_summary )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Summary" ),
"%s",
psz_item_summary );
......@@ -425,7 +425,7 @@ static int Demux( demux_t *p_demux )
if( psz_item_size )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Size" ),
"%s bytes",
psz_item_size );
......@@ -433,7 +433,7 @@ static int Demux( demux_t *p_demux )
if( psz_item_type )
{
vlc_input_item_AddInfo( &p_item->input,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_( "Podcast Type" ),
"%s",
psz_item_type );
......
......@@ -62,9 +62,9 @@ static int PlaylistNext( vlc_object_t *, const char *,
static int ItemChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
static int ItemAppended( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t oval, vlc_value_t nval, void *param );
vlc_value_t oval, vlc_value_t nval, void *param );
static int ItemDeleted( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t oval, vlc_value_t nval, void *param );
vlc_value_t oval, vlc_value_t nval, void *param );
/*****************************************************************************
* Event Table.
......@@ -494,8 +494,7 @@ void Playlist::UpdateTreeItem( wxTreeItemId item )
wxString msg;
wxString duration = wxU( "" );
char *psz_author = vlc_input_item_GetInfo( &p_item->input,
_("Meta-information"),
VLC_META_ARTIST );
_(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
if( !psz_author )
{
UnlockPlaylist( p_intf->p_sys, p_playlist );
......@@ -519,7 +518,7 @@ void Playlist::UpdateTreeItem( wxTreeItemId item )
else
{
msg = wxString(wxU( psz_author )) + wxT(" - ") +
wxString(wxU(p_item->input.psz_name)) + duration;
wxString(wxU(p_item->input.psz_name)) + duration;
}
free( psz_author );
treectrl->SetItemText( item , msg );
......
......@@ -145,7 +145,7 @@ void InputManager::UpdateInput()
void InputManager::UpdateNowPlaying()
{
char *psz_now_playing = vlc_input_item_GetInfo( p_input->input.p_item,
_("Meta-information"), _(VLC_META_NOW_PLAYING) );
_(VLC_META_INFO_CAT), _(VLC_META_NOW_PLAYING) );
if( psz_now_playing && *psz_now_playing )
{
p_main_intf->statusbar->SetStatusText(
......
......@@ -42,6 +42,7 @@
#include <wx/dynarray.h>
#include <wx/imaglist.h>
#include "vlc_meta.h"
namespace wxvlc {
/* Callback prototype */
......@@ -291,7 +292,7 @@ void PlaylistManager::UpdateTreeItem( wxTreeItemId item )
wxString duration = wxU( "" );
char *psz_author =
vlc_input_item_GetInfo( &p_item->input,
_("Meta-information"), _("Artist"));
_(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
if( !psz_author )
{
UnlockPlaylist( p_intf->p_sys, p_playlist );
......
......@@ -190,11 +190,11 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
/* Playing something ... */
psz_artist = vlc_input_item_GetInfo( p_input->input.p_item,
_("Meta-information"),
_(VLC_META_INFO_CAT),
_(VLC_META_ARTIST) );
psz_album = vlc_input_item_GetInfo( p_input->input.p_item,
_("Meta-information"),
_("Album/movie/show title" ) );
_(VLC_META_INFO_CAT),
_(VLC_META_COLLECTION) );
psz_title = strdup( p_input->input.p_item->psz_name );
if( psz_title == NULL ) psz_title = strdup( N_("(no title)") );
if( psz_artist == NULL ) psz_artist = strdup( N_("(no artist)") );
......
......@@ -28,6 +28,7 @@
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc_meta.h>
#include <errno.h> /* ENOMEM */
......@@ -65,7 +66,7 @@ int Export_M3U( vlc_object_t *p_this )
{
char *psz_artist =
vlc_input_item_GetInfo( &p_playlist->pp_items[i]->input,
_("Meta-information"), _("Artist") );
_(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
if( psz_artist && *psz_artist )
{
/* write EXTINF with artist */
......
......@@ -604,10 +604,10 @@ static void ProcessHost( services_discovery_t *p_sd, dhost_t *p_host )
p_host->p_songs[i].id );
p_item = playlist_ItemNew( p_sd, psz_buff,
p_host->p_songs[i].itemname );
vlc_input_item_AddInfo( &p_item->input, _("Meta-information"),
_("Artist"), p_host->p_songs[i].songartist );
vlc_input_item_AddInfo( &p_item->input, _("Meta-information"),
_("Album"), p_host->p_songs[i].songalbum );
vlc_input_item_AddInfo( &p_item->input, _(VLC_META_INFO_CAT),
_(VLC_META_ARTIST), p_host->p_songs[i].songartist );
vlc_input_item_AddInfo( &p_item->input, _(VLC_META_INFO_CAT),
_(VLC_META_COLLECTION), p_host->p_songs[i].songalbum );
playlist_NodeAddItem( p_playlist, p_item, VIEW_CATEGORY,
p_host->p_node, PLAYLIST_APPEND, PLAYLIST_END );
......
......@@ -462,8 +462,8 @@ static void EsOutProgramSelect( es_out_t *out, es_out_pgrm_t *p_pgrm )
char *psz_cat = malloc( strlen(_("Program")) + 10 );
sprintf( psz_cat, "%s %d", _("Program"), p_pgrm->i_id );
input_Control( p_input, INPUT_ADD_INFO, _("Meta-information"),
VLC_META_NOW_PLAYING, "%s", p_pgrm->psz_now_playing );
input_Control( p_input, INPUT_ADD_INFO, _(VLC_META_INFO_CAT),
_(VLC_META_NOW_PLAYING), "%s", p_pgrm->psz_now_playing );
free( psz_cat );
}
......@@ -631,8 +631,8 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
if( p_sys->p_pgrm == p_pgrm )
{
input_Control( p_input, INPUT_ADD_INFO, _("Meta-information"),
VLC_META_NOW_PLAYING, "%s", psz_now_playing );
input_Control( p_input, INPUT_ADD_INFO, _(VLC_META_INFO_CAT),
_(VLC_META_NOW_PLAYING), "%s", psz_now_playing );
}
}
free( psz_cat );
......
......@@ -223,8 +223,8 @@ 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, _("Meta-information"),
VLC_META_NOW_PLAYING );
input_Control( p_input, INPUT_DEL_INFO, _(VLC_META_INFO_CAT),
VLC_META_NOW_PLAYING ); /* ? Don't translate as it might has been copied ? */
return p_input;
}
......@@ -1896,15 +1896,15 @@ static int UpdateMeta( input_thread_t *p_input, vlc_bool_t b_quick )
msg_Dbg( p_input, " - '%s' = '%s'",
_(p_meta->name[i]), p_meta->value[i] );
if( !strcmp(p_meta->name[i], VLC_META_TITLE) && p_meta->value[i] &&
if( !strcmp(p_meta->name[i], _(VLC_META_TITLE)) && p_meta->value[i] &&
!p_input->input.p_item->b_fixed_name )
input_Control( p_input, INPUT_SET_NAME, p_meta->value[i] );
if( !strcmp( p_meta->name[i], VLC_META_AUTHOR ) )
if( !strcmp( p_meta->name[i], _(VLC_META_AUTHOR) ) )
input_Control( p_input, INPUT_ADD_INFO, _("General"),
_("Author"), p_meta->value[i] );
_(VLC_META_AUTHOR), p_meta->value[i] );
input_Control( p_input, INPUT_ADD_INFO, _("Meta-information"),
input_Control( p_input, INPUT_ADD_INFO, _(VLC_META_INFO_CAT),
_(p_meta->name[i]), "%s", p_meta->value[i] );
}
......@@ -2362,7 +2362,7 @@ static vlc_meta_t *InputMetaUser( input_thread_t *p_input )
#define GET_META( c, s ) \
var_Get( p_input, (s), &val ); \
if( *val.psz_string ) \
vlc_meta_Add( p_meta, c, val.psz_string ); \
vlc_meta_Add( p_meta, _(c), val.psz_string ); \
free( val.psz_string )
GET_META( VLC_META_TITLE, "meta-title" );
......
......@@ -187,10 +187,10 @@ int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
{
char *psz_a = vlc_input_item_GetInfo(
&pp_items[i]->input,
_( "Meta-information"), _("Artist") );
_(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
char *psz_b = vlc_input_item_GetInfo(
&pp_items[i_small]->input,
_( "Meta-information"), _("Artist") );
_(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
if( pp_items[i]->i_children == -1 &&
pp_items[i_small]->i_children >= 0 )
{
......@@ -230,10 +230,10 @@ int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
{
char *psz_a = vlc_input_item_GetInfo(
&pp_items[i]->input,
_( "Meta-information"), _("Album/movie/show title") );
_(VLC_META_INFO_CAT), _(VLC_META_COLLECTION) );
char *psz_b = vlc_input_item_GetInfo(
&pp_items[i_small]->input,
_( "Meta-information"), _("Album/movie/show title") );
_(VLC_META_INFO_CAT), _(VLC_META_COLLECTION) );
if( pp_items[i]->i_children == -1 &&
pp_items[i_small]->i_children >= 0 )
{
......@@ -325,17 +325,17 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view,
else if ( i_mode == SORT_AUTHOR )
{
psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
_("Meta-information"), _( "Artist" ) );
_(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
}
else if ( i_mode == SORT_ALBUM )
{
psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
_("Meta-information"), _( "Album/movie/show title" ) );
_(VLC_META_INFO_CAT), _(VLC_META_COLLECTION) );
}
else if ( i_mode == SORT_GENRE )
{
psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
_("Meta-information"), _( "Genre" ) );
_(VLC_META_INFO_CAT), _(VLC_META_GENRE) );
}
if( psz_search && !strcmp( psz_search, "" ) )
......
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