Sayonara Player
DatabasePlaylist.h
1 /* DatabasePlaylist.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef DATABASEPLAYLIST_H
24 #define DATABASEPLAYLIST_H
25 
26 #include "Components/Library/Sorting.h"
27 #include "Database/DatabaseModule.h"
28 #include "Helper/Playlist/CustomPlaylist.h"
29 
31 {
32 
33 public:
34 
35  enum class PlaylistChooserType : quint8 {
36  OnlyTemporary=1,
37  OnlyPermanent=2,
38  TemporaryAndPermanent=3
39  };
40 
41 
42  DatabasePlaylist(QSqlDatabase db, quint8 db_id);
43 
44  bool getAllPlaylistSkeletons(CustomPlaylistSkeletons& skeletons, DatabasePlaylist::PlaylistChooserType type, SortOrderPlaylists sortorder=SortOrderPlaylists::NameAsc);
45  bool getPlaylistSkeletonById(CustomPlaylistSkeleton& skeleton);
46 
47  int createPlaylist(QString playlist_name, bool temporary);
48  bool deleteTrackFromPlaylists(int track_id);
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 updatePlaylistTempState(int playlist_id, bool temporary);
59  bool deletePlaylist(int playlist_id);
60  bool emptyPlaylist(int playlist_id);
61 
62  bool insertTrackIntoPlaylist(const MetaData& md, int playlist_id, int pos);
63 
64 
65 };
66 
67 #endif // DATABASEPLAYLIST_H
Definition: MetaData.h:49
Definition: MetaDataList.h:44
Definition: DatabaseModule.h:54
Definition: DatabasePlaylist.h:30
The CustomPlaylist class.
Definition: CustomPlaylist.h:50
The CustomPlaylistSkeleton class.
Definition: CustomPlaylist.h:34