1 /*****************************************************************************
2 * cmd_playlist.cpp
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
5 * $Id: ab5d94c1194f5d3be337b6887a141ec95c83c343 $
6 *
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
24
25 #include "cmd_playlist.hpp"
26 #include <vlc_playlist.h>
27 #include <vlc_url.h>
28 #include "../src/vlcproc.hpp"
29 #include "../utils/var_bool.hpp"
30
execute()31 void CmdPlaylistDel::execute()
32 {
33 m_rList.delSelected();
34 }
35
execute()36 void CmdPlaylistNext::execute()
37 {
38 playlist_Next( getPL() );
39 }
40
41
execute()42 void CmdPlaylistPrevious::execute()
43 {
44 playlist_Prev( getPL() );
45 }
46
47
execute()48 void CmdPlaylistRandom::execute()
49 {
50 var_SetBool( getPL(), "random", m_value );
51 }
52
53
execute()54 void CmdPlaylistLoop::execute()
55 {
56 var_SetBool( getPL(), "loop", m_value );
57 }
58
59
execute()60 void CmdPlaylistRepeat::execute()
61 {
62 var_SetBool( getPL(), "repeat", m_value );
63 }
64
65
execute()66 void CmdPlaylistLoad::execute()
67 {
68 char* psz_path = vlc_uri2path( m_file.c_str() );
69 if ( !psz_path )
70 {
71 msg_Err(getIntf(),"unable to load playlist %s", m_file.c_str() );
72 return;
73 }
74 playlist_Import( getPL(), psz_path );
75 free( psz_path );
76 }
77
78
execute()79 void CmdPlaylistSave::execute()
80 {
81 const char *psz_module;
82 if( m_file.find( ".xsp", 0 ) != std::string::npos )
83 psz_module = "export-xspf";
84 else if( m_file.find( "m3u", 0 ) != std::string::npos )
85 psz_module = "export-m3u";
86 else if( m_file.find( "html", 0 ) != std::string::npos )
87 psz_module = "export-html";
88 else
89 {
90 msg_Err(getIntf(),"Did not recognise playlist export file type");
91 return;
92 }
93
94 playlist_Export( getPL(), m_file.c_str(), true, psz_module );
95 }
96
execute()97 void CmdPlaylistFirst::execute()
98 {
99 playlist_Control(getPL(), PLAYLIST_PLAY, pl_Unlocked);
100 }
101