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