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/Sorting.h"
26
27#include <QList>
28
29class CustomPlaylist;
30class MetaData;
31class MetaDataList;
32
33namespace Playlist
34{
35 enum class StoreType : uint8_t
36 {
37 OnlyTemporary = 1,
38 OnlyPermanent = 2,
39 TemporaryAndPermanent = 3
40 };
41}
42
43using PlaylistStoreType = ::Playlist::StoreType;
44using PlaylistSortOrder = ::Playlist::SortOrder;
45
46namespace DB
47{
48 class Playlist :
49 private Module
50 {
51 public:
52 Playlist(const QString& connectionName, DbId databaseId);
53 ~Playlist();
54
55 int getPlaylistIdByName(const QString& name);
56
57 CustomPlaylist getPlaylistById(int playlistId, bool getTrack);
58 QList<CustomPlaylist> getAllPlaylists(PlaylistStoreType storeType, bool getTracks, PlaylistSortOrder sortOrder = PlaylistSortOrder::NameAsc);
59
60 int createPlaylist(const QString& playlistName, bool temporary);
61 bool updatePlaylistTracks(int playlistId, const MetaDataList& tracks);
62 bool updatePlaylist(int playlistId, const QString& name, bool temporary);
63 bool renamePlaylist(int playlistId, const QString& newName);
64
65 bool deletePlaylist(int playlistId);
66 bool clearPlaylist(int playlistId);
67
68 bool insertTrackIntoPlaylist(const MetaData& md, int playlistId, int pos);
69
70 private:
71 MetaDataList getPlaylistWithDatabaseTracks(int playlistId);
72 MetaDataList getPlaylistWithNonDatabaseTracks(int playlistId);
73 };
74}
75
76#endif // DATABASEPLAYLIST_H
Definition: CustomPlaylist.h:30
Definition: Module.h:33
Definition: Playlist.h:50
The MetaDataList class.
Definition: MetaDataList.h:39
The MetaData class.
Definition: MetaData.h:47
Definition: EngineUtils.h:33