Sayonara Player
DatabasePlaylist.h
1 /* DatabasePlaylist.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef DATABASEPLAYLIST_H
22 #define DATABASEPLAYLIST_H
23 
24 #include "Database/DatabaseModule.h"
25 #include "Helper/Playlist/CustomPlaylistFwd.h"
26 #include "Helper/Playlist/Sorting.h"
27 
28 class MetaData;
29 class MetaDataList;
30 
32 {
33 public:
34 
35  enum class PlaylistChooserType : quint8
36  {
37  OnlyTemporary=1,
38  OnlyPermanent=2,
39  TemporaryAndPermanent=3
40  };
41 
42 
43  DatabasePlaylist(const QSqlDatabase& db, quint8 db_id);
44 
45  bool getAllPlaylistSkeletons(CustomPlaylistSkeletons& skeletons, DatabasePlaylist::PlaylistChooserType type, Playlist::SortOrder sortorder=Playlist::SortOrder::NameAsc);
46  bool getPlaylistSkeletonById(CustomPlaylistSkeleton& skeleton);
47 
48  int createPlaylist(QString playlist_name, bool temporary);
49  bool renamePlaylist(int id, const QString& new_name);
50 
51  int getPlaylistIdByName(const QString& name);
52  bool getPlaylistById(CustomPlaylist& pl);
53 
54  // checks if playlist is already there and inserts it, if necessary
55  bool storePlaylist(const MetaDataList& vec_md, QString playlist_name, bool temporary);
56  bool storePlaylist(const MetaDataList& vec_md, int playlist_id, bool temporary);
57 
58  bool deletePlaylist(int playlist_id);
59  bool emptyPlaylist(int playlist_id);
60 
61  bool insertTrackIntoPlaylist(const MetaData& md, int playlist_id, int pos);
62 };
63 
64 #endif // DATABASEPLAYLIST_H
The MetaData class MetaDataHelper.
Definition: MetaData.h:55
Definition: MetaDataList.h:39
Definition: DatabaseModule.h:47
Definition: DatabasePlaylist.h:31
The CustomPlaylist class.
Definition: CustomPlaylist.h:31
The CustomPlaylistSkeleton class.
Definition: CustomPlaylistSkeleton.h:31