- vlc_event_attach( &p_sd->p_sys->p_input->event_manager, vlc_InputItemSubItemAdded, ItemAdded, p_sd );
- input_Read( p_sd, p_sd->p_sys->p_input, VLC_TRUE );
- vlc_event_detach( &p_sd->p_sys->p_input->event_manager, vlc_InputItemSubItemAdded, ItemAdded, p_sd );
+ services_discovery_t *p_sd = data;
+ services_discovery_sys_t *p_sys = p_sd->p_sys;
+ enum type_e i_type = p_sys->i_type;
+ int i, j;
+ int canc = vlc_savecancel();
+
+ if( !p_items[i_type].p_children )
+ {
+ AddSubitemsOfShoutItemURL( p_sd, &p_items[i_type], NULL );
+ vlc_restorecancel(canc);
+ return NULL;
+ }
+ for( i = 0; p_items[i_type].p_children[i].psz_name; i++ )
+ {
+ const struct shout_item_t * p_subitem = &p_items[i_type].p_children[i];
+ if( !p_subitem->p_children )
+ {
+ AddSubitemsOfShoutItemURL( p_sd, p_subitem, p_subitem->psz_name );
+ continue;
+ }
+ for( j = 0; p_subitem->p_children[j].psz_name; j++ )
+ {
+ input_item_t *p_input = CreateInputItemFromShoutItem( p_sd, &p_subitem->p_children[j] );
+ services_discovery_AddItem( p_sd,
+ p_input,
+ p_subitem->psz_name );
+ vlc_gc_decref( p_input );
+ }
+ }
+ vlc_restorecancel(canc);
+ return NULL;