Implemented playlist storage
[someplayer] / src / filestorage.h
index 144828e..e8b8a23 100644 (file)
@@ -4,9 +4,23 @@
 #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)
@@ -16,11 +30,13 @@ using SomePlayer::DataObjects::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);
@@ -29,6 +45,8 @@ namespace SomePlayer {
                        void saveCurrentPlaylist(Playlist playlist);
                private:
                        QString _path_prefix;
+                       QRegExp _meta_regexp;
+                       QRegExp _path_regexp;
                };
 
        };