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 "Helper/Singleton.h"
25 #include "Database/DatabasePlaylist.h"
26 
27 class DatabaseConnector;
28 class MetaDataList;
29 
37 {
38  SINGLETON(PlaylistDBWrapper)
39 
40 private:
41  DatabaseConnector* _db=nullptr;
42 
43  void apply_tags(MetaDataList& v_md);
44  bool get_playlists(CustomPlaylists& playlists,
45  DatabasePlaylist::PlaylistChooserType type,
46  Playlist::SortOrder sortorder);
47 
48 // bool extract_stream(CustomPlaylist& pl, QString name, QString url);
49 
50 
51 public:
52 
53  bool get_skeletons(CustomPlaylistSkeletons& skeletons,
54  DatabasePlaylist::PlaylistChooserType type,
55  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
56 
57  bool get_all_skeletons(CustomPlaylistSkeletons& skeletons,
58  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
59 
60  bool get_non_temporary_skeletons(CustomPlaylistSkeletons& skeletons,
61  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
62 
63  bool get_temporary_skeletons(CustomPlaylistSkeletons& skeletons,
64  Playlist::SortOrder so);
65 
66  bool get_all_playlists(CustomPlaylists& playlists,
67  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
68 
69  bool get_temporary_playlists(CustomPlaylists& playlists,
70  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
71 
72  bool get_non_temporary_playlists(CustomPlaylists& playlists,
73  Playlist::SortOrder so=Playlist::SortOrder::IDAsc);
74 
75  CustomPlaylist get_playlist_by_id(int id);
76  CustomPlaylist get_playlist_by_name(const QString& name);
77 
78  bool rename_playlist(int id, const QString& new_name);
79  bool save_playlist_as(const MetaDataList& v_md, const QString& name);
80  bool save_playlist_temporary(const MetaDataList& v_md, const QString& name);
81  bool save_playlist(const CustomPlaylist& pl);
82  bool save_playlist(const MetaDataList& v_md, int id, bool is_temporary);
83 
84  bool delete_playlist(int id);
85  bool delete_playlist(const QString& name);
86  bool exists(const QString& name);
87 };
88 
89 #endif // PLAYLISTDBCONNECTOR_H
Definition: DatabaseConnector.h:38
Definition: MetaDataList.h:39
PlaylistDBWrapper is responsible for fetching playlist data from database, especially the handling be...
Definition: PlaylistDBWrapper.h:36
The CustomPlaylist class.
Definition: CustomPlaylist.h:31