#include "someplayer.h"
#include "storage.h"
#include "playlist.h"
+#include <QRegExp>
#define _CURRENT_PLAYLIST_NAME_ "___current"
-#define _PLAYLIST_FILE_EXTENSION_ ".m3u"
+#define _PLAYLIST_FILE_EXTENSION_ "spls"
+#define _PLAYLIST_SIGNATURE_ "#SOMEPLAYLIST"
+#define _PLAYLIST_META_KEYWORD_ "#META"
+#define _PLAYLIST_PATH_KEYWORD_ "#PATH"
+
+// format:
+/*
+ #SOMEPLAYLIST
+ #META [seconds],::artist::,::album::,::title::
+ #PATH file_path
+ #META [seconds],::artist::,::album::,::title::
+ #PATH file_path
+ ...
+ */
// represents file-level storage
// it store data into separate files (e.g. playlist)
namespace SomePlayer {
namespace Storage {
- class FileStorage : public Storage {
+ class FileStorage {
public:
FileStorage(QString path);
QList<Playlist> getPlaylists();
+ QStringList getPlaylistsNames();
+ Playlist getPlaylist(QString name);
void savePlaylist(Playlist playlist);
void removePlaylist(Playlist playlist);
void removePlaylist(QString name);
void saveCurrentPlaylist(Playlist playlist);
private:
QString _path_prefix;
+ QRegExp _meta_regexp;
+ QRegExp _path_regexp;
};
};