- (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 )
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;
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;
}
- (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;
}
vlc_object_release( p_playlist );
+NSLog( @"expandable" );
if( i_return <= 0 )
return NO;
else
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:
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"] )
{
o_value = @"-:--:--";
}
}
- vlc_object_release( p_playlist );
return( o_value );
}
[o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",
[o_value pointerValue]]];
-
+NSLog( @"add item %p", [o_value pointerValue] );
return o_value;
}
/* 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 */
[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];
[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: @"-"];
}
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 );
}