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