Commit f02a46fd authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Fixed Meta for OSX, so i know what music i'm listening to.

(debug left in place. when you run into a crash please not the console info so we can investigate)
parent 6f5d2c79
......@@ -150,6 +150,7 @@
- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
{
int i_return = 0;
playlist_item_t *p_item = NULL;
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
......@@ -163,32 +164,29 @@
if( item == nil )
{
/* root object */
if( p_playlist->p_root_category )
{
i_return = p_playlist->p_root_category->i_children;
}
p_item = p_playlist->p_root_category;
}
else
{
playlist_item_t *p_item = (playlist_item_t *)[item pointerValue];
if( p_item )
i_return = p_item->i_children;
p_item = (playlist_item_t *)[item pointerValue];
}
if( p_item )
i_return = p_item->i_children;
vlc_object_release( p_playlist );
if( i_return <= 0 )
i_return = 0;
NSLog( @"%d children for %s", i_return, p_item->p_input->psz_name );
return i_return;
}
/* return the child at index for the Obj-C pointer item */ /* DONE */
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
{
playlist_item_t *p_return = NULL;
playlist_item_t *p_return = NULL, *p_item = NULL;
NSValue *o_value;
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
NSValue *o_value;
if( p_playlist == NULL )
return nil;
......@@ -196,24 +194,23 @@
if( item == nil )
{
/* root object */
if( p_playlist->p_root_category )
{
p_return = p_playlist->p_root_category->pp_children[index];
}
p_item = p_playlist->p_root_category;
}
else
{
playlist_item_t *p_item = (playlist_item_t *)[item pointerValue];
if( p_item && index < p_item->i_children && index >= 0 )
p_return = p_item->pp_children[index];
p_item = (playlist_item_t *)[item pointerValue];
}
if( p_item && index < p_item->i_children && index >= 0 )
p_return = p_item->pp_children[index];
vlc_object_release( p_playlist );
o_value = [o_outline_dict objectForKey:[NSString stringWithFormat: @"%p", p_return]];
NSLog( @"%s", p_return->p_input->psz_name);
if( o_value == nil )
{
o_value = [[NSValue valueWithPointer: p_return] retain];
NSLog( @"error missing value" );
}
return o_value;
}
......@@ -222,7 +219,7 @@
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
{
int i_return = 0;
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
return NO;
......@@ -243,6 +240,7 @@
}
vlc_object_release( p_playlist );
NSLog( @"expandable" );
if( i_return <= 0 )
return NO;
else
......@@ -259,21 +257,18 @@
if( item == nil || ![item isKindOfClass: [NSValue class]] ) return( @"error" );
p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return( @"error" );
}
/* Check to see if the playlist is present */
p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL ) return( @"error");
vlc_object_release( p_playlist);
p_item = (playlist_item_t *)[item pointerValue];
if( p_item == NULL )
{
vlc_object_release( p_playlist );
return( @"error");
}
NSLog( @"values for %p", p_item );
if( [[o_tc identifier] isEqualToString:@"1"] )
{
o_value = [NSString stringWithUTF8String:
......@@ -282,22 +277,14 @@
o_value = [NSString stringWithCString:
p_item->p_input->psz_name];
}
else if( [[o_tc identifier] isEqualToString:@"2"] )
else if( [[o_tc identifier] isEqualToString:@"2"] && p_item->p_input->p_meta &&
p_item->p_input->p_meta->psz_artist && *p_item->p_input->p_meta->psz_artist )
{
char *psz_temp;
psz_temp = vlc_input_item_GetInfo( p_item->p_input ,_("Meta-information"),_("Artist") );
if( psz_temp == NULL )
o_value = @"";
else
{
o_value = [NSString stringWithUTF8String: psz_temp];
if( o_value == NULL )
{
o_value = [NSString stringWithCString: psz_temp];
}
free( psz_temp );
}
o_value = [NSString stringWithUTF8String:
p_item->p_input->p_meta->psz_artist];
if( o_value == NULL )
o_value = [NSString stringWithCString:
p_item->p_input->p_meta->psz_artist];
}
else if( [[o_tc identifier] isEqualToString:@"3"] )
{
......@@ -313,7 +300,6 @@
o_value = @"-:--:--";
}
}
vlc_object_release( p_playlist );
return( o_value );
}
......@@ -1545,7 +1531,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
[o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",
[o_value pointerValue]]];
NSLog( @"add item %p", [o_value pointerValue] );
return o_value;
}
......
......@@ -181,7 +181,6 @@
/* check whether our item is valid, because we would crash if not */
if(! [self isItemInPlaylist: p_item] ) return;
char *psz_temp;
vlc_mutex_lock( &p_item->p_input->lock );
/* fill uri / title / author info */
......@@ -200,27 +199,21 @@
[NSString stringWithCString:p_item->p_input->psz_name] :
[NSString stringWithUTF8String:p_item->p_input->psz_name]];
}
vlc_mutex_unlock( &p_item->p_input->lock );
psz_temp = vlc_input_item_GetInfo( p_item->p_input, _("Meta-information"), _("Artist") );
if( psz_temp )
{
[o_author_txt setStringValue: [NSString stringWithUTF8String: psz_temp]];
free( psz_temp );
}
/* fill the other fields */
[self setMeta: VLC_META_GENRE forLabel: o_genre_txt];
[self setMeta: VLC_META_COPYRIGHT forLabel: o_copyright_txt];
[self setMeta: VLC_META_COLLECTION forLabel: o_collection_txt];
[self setMeta: VLC_META_SEQ_NUM forLabel: o_seqNum_txt];
[self setMeta: VLC_META_DESCRIPTION forLabel: o_description_txt];
[self setMeta: VLC_META_RATING forLabel: o_rating_txt];
[self setMeta: VLC_META_DATE forLabel: o_date_txt];
[self setMeta: VLC_META_LANGUAGE forLabel: o_language_txt];
[self setMeta: VLC_META_NOW_PLAYING forLabel: o_nowPlaying_txt];
[self setMeta: VLC_META_PUBLISHER forLabel: o_publisher_txt];
#define p_m p_item->p_input->p_meta
[self setMeta: p_m->psz_artist forLabel: o_author_txt];
[self setMeta: p_m->psz_album forLabel: o_collection_txt];
[self setMeta: p_m->psz_tracknum forLabel: o_seqNum_txt];
[self setMeta: p_m->psz_genre forLabel: o_genre_txt];
[self setMeta: p_m->psz_copyright forLabel: o_copyright_txt];
[self setMeta: p_m->psz_rating forLabel: o_rating_txt];
[self setMeta: p_m->psz_publisher forLabel: o_publisher_txt];
[self setMeta: p_m->psz_nowplaying forLabel: o_nowPlaying_txt];
[self setMeta: p_m->psz_language forLabel: o_language_txt];
[self setMeta: p_m->psz_date forLabel: o_date_txt];
#undef p_m
vlc_mutex_unlock( &p_item->p_input->lock );
/* reload the advanced table */
[[VLCInfoTreeItem rootItem] refresh];
......@@ -230,12 +223,13 @@
[self updateStatistics: nil];
}
- (void)setMeta: (char *)meta forLabel: (id)theItem
- (void)setMeta: (char *)psz_meta forLabel: (id)theItem
{
char *psz_meta = vlc_input_item_GetInfo( p_item->p_input, \
_(VLC_META_INFO_CAT), _(meta) );
if( psz_meta != NULL && *psz_meta)
[theItem setStringValue: [NSString stringWithUTF8String: psz_meta]];
[theItem setStringValue:
([NSString stringWithUTF8String:psz_meta] == nil ) ?
[NSString stringWithCString:psz_meta] :
[NSString stringWithUTF8String:psz_meta]];
else
[theItem setStringValue: @"-"];
}
......@@ -306,9 +300,9 @@
p_item->p_input->psz_uri = strdup( [[o_uri_txt stringValue] UTF8String] );
p_item->p_input->psz_name = strdup( [[o_title_txt stringValue] UTF8String] );
vlc_meta_SetArtist( p_item->p_input->p_meta, [[o_author_txt stringValue] UTF8String] )
vlc_mutex_unlock( &p_item->p_input->lock );
vlc_input_item_AddInfo( p_item->p_input, _("Meta-information"), _("Artist"), [[o_author_txt stringValue] UTF8String]);
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
}
......
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