Exemple #1
0
void
add_to_playlist_recursive ( songdata *list, songdata_song *position, songdata_song *file )
{
	char *prevpwd = NULL;
	songdata *templist = NULL;
	if ( ! ( file->flags & F_DIR ) )
		return;

	templist = malloc( sizeof ( songdata ) );
    memset(templist, 0, sizeof(songdata));
	prevpwd = getcwd ( NULL, 0 );

	songdata_read_mp3_list ( templist, file->fullpath, L_NEW );
	if (templist->selected && !strncmp ( templist->selected->filename, "../", 3 ) )
		templist->selected = templist->head->next; // skip ../ entry

	while ( templist->selected )
	{
		if ( templist->selected->flags & F_DIR )
			add_to_playlist_recursive ( list, list->tail, templist->selected );
		else if ( ! ( templist->selected->flags & F_PLAYLIST ) )
			add_to_playlist ( list, list->tail, templist->selected );

		templist->selected = songdata_next_valid ( templist, templist->selected->next, KEY_DOWN );
	}

	songdata_clear ( templist );
	free ( templist );
	if(chdir ( prevpwd ) != 0){
		//TODO Log this error
	}
	free ( prevpwd );
}
Exemple #2
0
void http_delete_playlist()
{
    controller_stop();
    songdata_clear ( playlist );
    gui_update_playlist();
    gui_update_info();
    update_panels ();
}
Exemple #3
0
songdata * controller_init (Config * init_config)
{
	conf = init_config;
	playlist = malloc ( sizeof ( songdata ) );
    memset(playlist, 0, sizeof(songdata));
	playlist->head = NULL;
	songdata_clear ( playlist );
    http_controller_init(conf);
	return playlist;
}
Exemple #4
0
void controller_clear_playlist()
{
  if (gui_ask_yes_no(CLEARPLAYLIST))
  {
    controller_stop();

    songdata_clear ( playlist );

    gui_update_playlist();
    
    gui_update_info();
    
    update_panels ();
  }
}
Exemple #5
0
void controller_shutdown ( void )
{
	http_controller_shutdown();
	songdata_clear(playlist);
	free ( playlist );
}