Sayonara Player
PlaylistDBWrapper.h
1 /* PlaylistDBWrapper.h */
2 
3 /* Copyright (C) 2011-2019 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 PLAYLISTDB_WRAPPER_H
22 #define PLAYLISTDB_WRAPPER_H
23 
24 #include "Utils/Pimpl.h"
25 #include "Utils/Playlist/CustomPlaylistFwd.h"
26 #include "Database/Playlist.h"
27 
28 namespace Playlist
29 {
36  class DBWrapper
37  {
38  PIMPL(DBWrapper)
39 
40  public:
41  DBWrapper();
42  ~DBWrapper();
43 
44  bool get_skeletons(CustomPlaylistSkeletons& skeletons,
45  Playlist::StoreType type,
46  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
47 
48  bool get_all_skeletons(CustomPlaylistSkeletons& skeletons,
49  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
50 
51  bool get_non_temporary_skeletons(CustomPlaylistSkeletons& skeletons,
52  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
53 
54  bool get_temporary_skeletons(CustomPlaylistSkeletons& skeletons,
55  Playlist::SortOrder so);
56 
57  bool get_all_playlists(CustomPlaylists& playlists,
58  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
59 
60  bool get_temporary_playlists(CustomPlaylists& playlists,
61  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
62 
63  bool get_non_temporary_playlists(CustomPlaylists& playlists,
64  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
65 
66  CustomPlaylist get_playlist_by_id(int id);
67  CustomPlaylist get_playlist_by_name(const QString& name);
68 
69  bool rename_playlist(int id, const QString& new_name);
70  bool save_playlist_as(const MetaDataList& v_md, const QString& name);
71  bool save_playlist_temporary(const MetaDataList& v_md, const QString& name);
72  bool save_playlist(const CustomPlaylist& pl);
73  bool save_playlist(const MetaDataList& v_md, int id, bool is_temporary);
74 
75  bool delete_playlist(int id);
76  bool delete_playlist(const QString& name);
77  bool exists(const QString& name);
78 
79  private:
80  void apply_tags(MetaDataList& v_md);
81  bool get_playlists(CustomPlaylists& playlists,
82  Playlist::StoreType type,
83  Playlist::SortOrder sortorder);
84  };
85 
86  using DBWrapperPtr=std::shared_ptr<DBWrapper>;
87 }
88 
89 #endif // PLAYLISTDBCONNECTOR_H
The MetaDataList class.
Definition: MetaDataList.h:37
DBWrapper is responsible for fetching playlist data from database, especially the handling between sk...
Definition: PlaylistDBWrapper.h:36
The CustomPlaylist class.
Definition: CustomPlaylist.h:31
Definition: AbstractPlaylist.h:32
Definition: org_mpris_media_player2_adaptor.h:20