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