Sayonara Player
SoundcloudData.h
1 /* SoundcloudData.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 SOUNDCLOUDDATA_H
22 #define SOUNDCLOUDDATA_H
23 
24 #include "Database/Base.h"
25 #include "Database/LibraryDatabase.h"
26 #include <QObject>
27 
28 /* this is the database interface
29  * TODO: make database connector my parent
30  * TODO: create real (new) database
31  */
32 class MetaData;
33 class MetaDataList;
34 class Artist;
35 class AlbumList;
36 
37 
38 namespace SC
39 {
40  class SearchInformationList;
41 
42  class Database :
43  public DB::Base,
44  public DB::LibraryDatabase
45  {
46  Q_OBJECT
47 
48  public:
49  Database();
50  ~Database();
51 
52  bool db_fetch_tracks(::DB::Query& q, MetaDataList& result) override;
53  bool db_fetch_albums(::DB::Query& q, AlbumList& result) override;
54  bool db_fetch_artists(::DB::Query& q, ArtistList& result) override;
55 
56  ArtistId updateArtist(const Artist& artist) override;
57  ArtistId insertArtistIntoDatabase (const Artist& artist) override;
58  ArtistId insertArtistIntoDatabase (const QString& artist) override;
59 
60  AlbumId updateAlbum(const Album& album) override;
61  AlbumId insertAlbumIntoDatabase (const Album& album) override;
62  AlbumId insertAlbumIntoDatabase (const QString& album) override;
63 
64  bool updateTrack(const MetaData& md) override;
65  bool store_metadata(const MetaDataList& v_md) override;
66  bool insertTrackIntoDatabase(const MetaData& md, int artist_id, int album_id, int album_artist_id) override;
67  bool insertTrackIntoDatabase(const MetaData& md, int artist_id, int album_id) override;
68 
69  // todo: assure to be called
70  bool apply_fixes() override;
71 
72  QString load_setting(const QString& key);
73  bool save_setting(const QString& key, const QString& value);
74  bool insert_setting(const QString& key, const QString& value);
75 
76  bool getSearchInformation(SC::SearchInformationList& list);
77 
78  QString fetch_query_albums(bool also_empty=false) const override;
79  QString fetch_query_artists(bool also_empty=false) const override;
80  QString fetch_query_tracks() const override;
81 
82  private:
83  const DB::Module* module() const;
84  };
85 }
86 
87 #endif // SOUNDCLOUDDATA_H
Definition: SoundcloudData.h:42
Definition: Module.h:32
Definition: Query.h:35
The MetaData class.
Definition: MetaData.h:44
The MetaDataList class.
Definition: MetaDataList.h:37
Definition: LibraryDatabase.h:33
Definition: Base.h:32
The AlbumList class.
Definition: Album.h:89
ArtistList.
Definition: Artist.h:70
The Album class.
Definition: Album.h:39
Definition: SearchInformation.h:44
Definition: SoundcloudLibraryContainer.h:30
The Artist class.
Definition: Artist.h:36