- /* create the new entry */
- asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current->p_input->psz_name ) );
- p_entry = input_ItemNew( p_playlist, psz_string, psz_name );
- FREENULL( psz_name );
-
- input_ItemCopyOptions( p_current->p_input, p_entry );
- p_entry->p_meta = vlc_meta_New();
- if( psz_title_entry ) vlc_meta_SetTitle( p_entry->p_meta, psz_title_entry );
- if( psz_artist_entry ) vlc_meta_SetArtist( p_entry->p_meta, psz_artist_entry );
- if( psz_copyright_entry ) vlc_meta_SetCopyright( p_entry->p_meta, psz_copyright_entry );
- if( psz_moreinfo_entry ) vlc_meta_SetURL( p_entry->p_meta, psz_moreinfo_entry );
- if( psz_abstract_entry ) vlc_meta_SetDescription( p_entry->p_meta, psz_abstract_entry );
- playlist_BothAddInput( p_playlist, p_entry,
- p_item_in_category,
- PLAYLIST_APPEND | PLAYLIST_SPREPARSE
- , PLAYLIST_END);
- free( psz_string );
+ if( psz_href )
+ {
+ /* we have allready one href in this entry, lets make new input from it and
+ continue with new href, don't free meta/options*/
+ input_item_t *p_entry = NULL;
+ char *psz_name = input_item_GetName( p_current_input );
+
+ char *psz_mrl = ProcessMRL( psz_href, p_demux->p_sys->psz_prefix );
+ p_entry = input_item_NewExt( p_demux, psz_mrl, psz_name,
+ 0, NULL, VLC_INPUT_OPTION_TRUSTED, -1 );
+ free( psz_mrl );
+ input_item_CopyOptions( p_current_input, p_entry );
+ if( psz_title_entry ) input_item_SetTitle( p_entry, psz_title_entry );
+ if( psz_artist_entry ) input_item_SetArtist( p_entry, psz_artist_entry );
+ if( psz_copyright_entry ) input_item_SetCopyright( p_entry, psz_copyright_entry );
+ if( psz_moreinfo_entry ) input_item_SetURL( p_entry, psz_moreinfo_entry );
+ if( psz_abstract_entry ) input_item_SetDescription( p_entry, psz_abstract_entry );
+ input_item_node_AppendItem( p_subitems, p_entry );
+ vlc_gc_decref( p_entry );
+ }
+
+ free( psz_href );
+ psz_href = xmalloc( i_strlen +1);
+ memcpy( psz_href, psz_backup, i_strlen );
+ psz_href[i_strlen] = '\0';
+ psz_tmp = psz_href + (i_strlen-1);
+ while( psz_tmp >= psz_href &&
+ ( *psz_tmp == '\r' || *psz_tmp == '\n' ) )
+ {
+ *psz_tmp = '\0';
+ psz_tmp++;
+ }
+ }
+ else continue;
+ }
+ else continue;
+ }
+ if( ( psz_parse = strcasestr( psz_parse, ">" ) ) )
+ psz_parse++;
+ else continue;
+ }
+ else if( !strncasecmp( psz_parse, "<starttime ", 11 ) )
+ {
+ psz_parse = SkipBlanks(psz_parse+11, (unsigned)-1);
+ if( !b_entry )
+ {
+ msg_Err( p_demux, "starttime outside an entry section" );
+ continue;
+ }
+
+ if( !strncasecmp( psz_parse, "value", 5 ) )
+ {
+ if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )
+ {
+ psz_backup = ++psz_parse;
+ if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )
+ {
+ i_strlen = psz_parse-psz_backup;
+ if( i_strlen < 1 ) continue;
+
+ i_starttime = ParseTime(psz_backup, i_strlen);
+ }
+ else continue;
+ }
+ else continue;
+ }
+ if( ( psz_parse = strcasestr( psz_parse, ">" ) ) )
+ psz_parse++;
+ else continue;
+ }
+ else if( !strncasecmp( psz_parse, "<duration ", 11 ) )
+ {
+ psz_parse = SkipBlanks(psz_parse+5, (unsigned)-1);
+ if( !b_entry )
+ {
+ msg_Err( p_demux, "duration outside an entry section" );
+ continue;
+ }
+
+ if( !strncasecmp( psz_parse, "value", 5 ) )
+ {
+ if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )
+ {
+ psz_backup = ++psz_parse;
+ if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )
+ {
+ i_strlen = psz_parse-psz_backup;
+ if( i_strlen < 1 ) continue;
+
+ i_duration = ParseTime(psz_backup, i_strlen);