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