00001 /***************************************************************************** 00002 * old.c : Old playlist format import/export 00003 ***************************************************************************** 00004 * Copyright (C) 2004 the VideoLAN team 00005 * $Id: old.c 12742 2005-10-02 12:47:49Z jpsaman $ 00006 * 00007 * Authors: Cl�ent Stenac <[email protected]> 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. 00022 *****************************************************************************/ 00023 00024 /***************************************************************************** 00025 * Preamble 00026 *****************************************************************************/ 00027 #include <stdlib.h> /* malloc(), free() */ 00028 00029 #include <vlc/vlc.h> 00030 #include <vlc/intf.h> 00031 #include <charset.h> 00032 00033 #include <errno.h> /* ENOMEM */ 00034 00035 #define PLAYLIST_FILE_HEADER "# vlc playlist file version 0.5" 00036 00037 /***************************************************************************** 00038 * Local prototypes 00039 *****************************************************************************/ 00040 int Export_Old ( vlc_object_t * ); 00041 00042 /***************************************************************************** 00043 * Export_Old : main export function 00044 *****************************************************************************/ 00045 int Export_Old( vlc_object_t *p_this ) 00046 { 00047 playlist_t *p_playlist = (playlist_t*)p_this; 00048 playlist_export_t *p_export = (playlist_export_t *)p_playlist->p_private; 00049 int i; 00050 00051 msg_Dbg(p_playlist, "Saving using old format"); 00052 00053 /* Write header */ 00054 fprintf( p_export->p_file , PLAYLIST_FILE_HEADER "\n" ); 00055 00056 for ( i = 0 ; i < p_playlist->i_size ; i++ ) 00057 { 00058 char *psz_uri; 00059 00060 psz_uri = ToLocale( p_playlist->pp_items[i]->input.psz_uri ); 00061 fprintf( p_export->p_file , "%s\n" , psz_uri ); 00062 LocaleFree( psz_uri ); 00063 } 00064 return VLC_SUCCESS; 00065 }