Sayonara Player
Playlist.h
1 /* DatabasePlaylist.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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/Module.h"
25 #include "Utils/Playlist/CustomPlaylistFwd.h"
26 #include "Utils/Playlist/Sorting.h"
27 
28 class MetaData;
29 class MetaDataList;
30 
31 namespace Playlist
32 {
33  enum class StoreType : uint8_t
34  {
35  OnlyTemporary=1,
36  OnlyPermanent=2,
37  TemporaryAndPermanent=3
38  };
39 }
40 
41 using PlaylistStoreType=::Playlist::StoreType;
42 
43 namespace DB
44 {
45  class Playlist :
46  private Module
47  {
48  public:
49  Playlist(const QString& connectionName, DbId databaseId);
50  ~Playlist();
51 
52  bool getAllPlaylistSkeletons(CustomPlaylistSkeletons& skeletons, ::Playlist::StoreType type, ::Playlist::SortOrder sortorder=::Playlist::SortOrder::NameAsc);
53  bool getPlaylistSkeletonById(CustomPlaylistSkeleton& skeleton);
54 
55  int createPlaylist(QString playlist_name, bool temporary);
56  bool renamePlaylist(int id, const QString& new_name);
57 
58  int getPlaylistIdByName(const QString& name);
59  bool getPlaylistById(CustomPlaylist& pl);
60 
61  // checks if playlist is already there and inserts it, if necessary
62  bool storePlaylist(const MetaDataList& vec_md, QString playlist_name, bool temporary);
63  bool storePlaylist(const MetaDataList& vec_md, int playlist_id, bool temporary);
64 
65  bool deletePlaylist(int playlist_id);
66  bool emptyPlaylist(int playlist_id);
67 
68  bool insertTrackIntoPlaylist(const MetaData& md, int playlist_id, int pos);
69  };
70 }
71 
72 #endif // DATABASEPLAYLIST_H
DB::Module
Definition: Module.h:33
CustomPlaylistSkeleton
The CustomPlaylistSkeleton class.
Definition: CustomPlaylistSkeleton.h:31
MetaDataList
The MetaDataList class.
Definition: MetaDataList.h:37
QList
Definition: EngineUtils.h:33
CustomPlaylist
The CustomPlaylist class.
Definition: CustomPlaylist.h:34
DB::Playlist
Definition: Playlist.h:47
MetaData
The MetaData class.
Definition: MetaData.h:47