]> git.sesse.net Git - vlc/blob - modules/misc/playlist/old.c
FSF address change.
[vlc] / modules / misc / playlist / old.c
1 /*****************************************************************************
2  * old.c : Old playlist format import/export
3  *****************************************************************************
4  * Copyright (C) 2004 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cl�ent Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <stdlib.h>                                      /* malloc(), free() */
28
29 #include <vlc/vlc.h>
30 #include <vlc/intf.h>
31 #include <charset.h>
32
33 #include <errno.h>                                                 /* ENOMEM */
34
35 #define PLAYLIST_FILE_HEADER "# vlc playlist file version 0.5"
36
37 /*****************************************************************************
38  * Local prototypes
39  *****************************************************************************/
40 int Export_Old ( vlc_object_t * );
41
42 /*****************************************************************************
43  * Export_Old : main export function
44  *****************************************************************************/
45 int Export_Old( vlc_object_t *p_this )
46 {
47     playlist_t *p_playlist = (playlist_t*)p_this;
48     playlist_export_t *p_export = (playlist_export_t *)p_playlist->p_private;
49     int i;
50
51     msg_Dbg(p_playlist, "Saving using old format");
52
53     /* Write header */
54     fprintf( p_export->p_file , PLAYLIST_FILE_HEADER "\n" );
55
56     for ( i = 0 ; i < p_playlist->i_size ; i++ )
57     {
58         char *psz_uri;
59
60         psz_uri = ToLocale( p_playlist->pp_items[i]->input.psz_uri );
61         fprintf( p_export->p_file , "%s\n" , psz_uri );
62         LocaleFree( psz_uri );
63     }
64     return VLC_SUCCESS;
65 }