1
// -------------------------------------------------------------------------------- //
2
// Copyright (C) 2008-2010 J.Rios
5
// This Program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 2, or (at your option)
10
// This Program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
15
// You should have received a copy of the GNU General Public License
16
// along with this program; see the file LICENSE. If not, write to
17
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18
// http://www.gnu.org/copyleft/gpl.html
20
// -------------------------------------------------------------------------------- //
21
#ifndef PLAYLISTFILE_H
22
#define PLAYLISTFILE_H
24
#include <wx/arrstr.h>
25
#include <wx/dynarray.h>
26
#include <wx/string.h>
27
#include <wx/xml/xml.h>
29
class guStationPlayListItem
35
guStationPlayListItem() {};
37
guStationPlayListItem( const wxString &location, const wxString &title )
40
m_Location = location;
43
WX_DECLARE_OBJARRAY(guStationPlayListItem, guStationPlayList);
45
// -------------------------------------------------------------------------------- //
49
void ReadXspfPlayList( wxXmlNode * XmlNode );
50
void ReadXspfTrackList( wxXmlNode * XmlNode );
51
void ReadXspfTrack( wxXmlNode * XmlNode );
53
void ReadAsxEntry( wxXmlNode * XmlNode );
54
void ReadAsxPlayList( wxXmlNode * XmlNode );
58
guStationPlayList m_PlayList;
60
bool ReadPlsStream( wxInputStream &playlist, const wxString &path = wxEmptyString );
61
bool ReadM3uStream( wxInputStream &playlist, const wxString &path = wxEmptyString );
62
bool ReadXspfStream( wxInputStream &playlist );
63
bool ReadAsxStream( wxInputStream &playlist );
65
bool ReadPlsFile( const wxString &filename );
66
bool ReadM3uFile( const wxString &filename );
67
bool ReadXspfFile( const wxString &filename );
68
bool ReadAsxFile( const wxString &filename );
70
bool WritePlsFile( const wxString &filename );
71
bool WriteM3uFile( const wxString &filename );
72
bool WriteXspfFile( const wxString &filename );
73
bool WriteAsxFile( const wxString &filename );
76
guPlayListFile( void ) {};
77
guPlayListFile( const wxString &uri );
80
bool Load( const wxString &uri );
81
bool Save( const wxString &filename );
83
wxString GetName( void ) { return m_Name; };
84
void SetName( const wxString &name ) { m_Name = name; };
85
guStationPlayList GetPlayList( void ) { return m_PlayList; };
86
void SetPlayList( const guStationPlayList &playlist ) { m_PlayList = playlist; };
88
size_t Count( void ) const { return m_PlayList.Count(); };
90
guStationPlayListItem GetItem( const size_t index )
92
return m_PlayList[ index ];
95
void AddItem( const wxString &location, const wxString &title = wxEmptyString )
97
m_PlayList.Add( new guStationPlayListItem( location, title ) );
100
void AddItem( const guStationPlayListItem &item )
102
m_PlayList.Add( new guStationPlayListItem( item ) );
105
static bool IsValidPlayList( const wxString &uri );
111
// -------------------------------------------------------------------------------- //