* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <vlc/vlc.h>
-#include <vlc/input.h>
-#include "vlc_playlist.h"
+#include <vlc_playlist.h>
#include "playlist_internal.h"
-#include "charset.h"
+#include "misc/configuration.h"
+#include <vlc_charset.h>
+
#include <errno.h>
-/**
- * Export a node of the playlist to a certain type of playlistfile
- *
- * \param p_playlist the playlist to export
- * \param psz_filename the location where the exported file will be saved
- * \param p_export_root the root node to export
- * \param psz_type the type of playlist file to create.
- * \return VLC_SUCCESS on success
- */
int playlist_Export( playlist_t * p_playlist, const char *psz_filename ,
playlist_item_t *p_export_root,const char *psz_type )
{
int playlist_MLDump( playlist_t *p_playlist )
{
- char *psz_uri, *psz_homedir =p_playlist->p_libvlc->psz_homedir;
+ char *psz_uri, *psz_homedir = p_playlist->p_libvlc->psz_homedir;
if( !config_GetInt( p_playlist, "media-library") ) return VLC_SUCCESS;
if( !psz_homedir )
{
- msg_Err( p_playlist, "no home directory, cannot load media library") ;
+ msg_Err( p_playlist, "no home directory, cannot save media library") ;
return VLC_EGENERIC;
}
- asprintf( &psz_uri, "%s" DIR_SEP CONFIG_DIR DIR_SEP
- "ml.xsp", psz_homedir );
+
+ char psz_dirname[ strlen( psz_homedir ) + sizeof( DIR_SEP CONFIG_DIR ) ];
+ sprintf( psz_dirname, "%s" DIR_SEP CONFIG_DIR, psz_homedir );
+ if( config_CreateDir( (vlc_object_t *)p_playlist, psz_dirname ) )
+ {
+ return VLC_EGENERIC;
+ }
+
+ asprintf( &psz_uri, "%s" DIR_SEP "%s", psz_dirname, "ml.xsp" );
stats_TimerStart( p_playlist, "ML Dump", STATS_TIMER_ML_DUMP );
playlist_Export( p_playlist, psz_uri, p_playlist->p_ml_category,
"export-xspf" );