cmd_playlist.cpp 3.11 KB
Newer Older
1 2 3
/*****************************************************************************
 * cmd_playlist.cpp
 *****************************************************************************
4
 * Copyright (C) 2003 the VideoLAN team
5
 * $Id$
6 7
 *
 * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8
 *          Olivier Teulière <ipkiss@via.ecp.fr>
9 10 11 12 13 14 15 16 17 18 19
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
20 21 22
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 24 25
 *****************************************************************************/

#include "cmd_playlist.hpp"
Clément Stenac's avatar
Clément Stenac committed
26
#include <vlc_playlist.h>
27 28
#include "../src/vlcproc.hpp"
#include "../utils/var_bool.hpp"
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

void CmdPlaylistDel::execute()
{
    m_rList.delSelected();
}

void CmdPlaylistNext::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist != NULL )
        playlist_Next( pPlaylist );
}


void CmdPlaylistPrevious::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist != NULL )
        playlist_Prev( pPlaylist );
}
49 50 51 52 53 54


void CmdPlaylistRandom::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist != NULL )
Rémi Duraffort's avatar
Rémi Duraffort committed
55
        var_SetBool( pPlaylist , "random", m_value );
56 57
}

58 59 60 61 62

void CmdPlaylistLoop::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist != NULL )
Rémi Duraffort's avatar
Rémi Duraffort committed
63
        var_SetBool( pPlaylist , "loop", m_value );
64 65
}

66 67 68 69 70

void CmdPlaylistRepeat::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist != NULL )
Rémi Duraffort's avatar
Rémi Duraffort committed
71
        var_SetBool( pPlaylist , "repeat", m_value );
72 73
}

74 75 76 77 78

void CmdPlaylistLoad::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist != NULL )
79
        playlist_Import( pPlaylist, m_file.c_str() );
80 81 82 83 84 85 86 87
}


void CmdPlaylistSave::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist != NULL )
    {
88
        const char *psz_module;
89
        if( m_file.find( ".xsp", 0 ) != std::string::npos )
90
            psz_module = "export-xspf";
91
        else if( m_file.find( "m3u", 0 ) != std::string::npos )
92
            psz_module = "export-m3u";
93
        else if( m_file.find( "html", 0 ) != std::string::npos )
94
            psz_module = "export-html";
95 96
        else
        {
97
            msg_Err(getIntf(),"Did not recognise playlist export file type");
98
            return;
99
        }
100

101
        playlist_Export( pPlaylist, m_file.c_str(),
102
                         pPlaylist->p_playing, psz_module );
103 104
    }
}
105 106 107

void CmdPlaylistFirst::execute()
{
108
    playlist_Control(getIntf()->p_sys->p_playlist,PLAYLIST_PLAY,pl_Unlocked);
109
}