Sayonara Player
Loading...
Searching...
No Matches
LibraryDatabase.h
1/* LibraryDatabase.h */
2
3/* Copyright (C) 2011-2024 Michael Lugmair (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 LIBRARYDATABASE_H
22#define LIBRARYDATABASE_H
23
24#include "Database/Base.h"
25#include "Database/Albums.h"
26#include "Database/Artists.h"
27#include "Database/Tracks.h"
28#include "Database/Library.h"
29#include "Utils/Pimpl.h"
30
31#include <QHash>
32
33class Album;
34class Artist;
35namespace DB
36{
38 public DB::Albums,
39 public DB::Artists,
40 public DB::Tracks,
41 public DB::Module
42 {
43 PIMPL(LibraryDatabase)
44
45 public:
46 LibraryDatabase(const QString& connectionName, DbId databaseId, LibraryId libraryId);
47 ~LibraryDatabase() override;
48
49 virtual bool storeMetadata(const MetaDataList& tracks);
50
51 [[nodiscard]] LibraryId libraryId() const override;
52
53 bool fixEmptyAlbums();
54 void updateSearchMode();
55 void changeArtistIdField(ArtistIdInfo::ArtistIdField field);
56 MetaDataList insertMissingArtistsAndAlbums(const MetaDataList& tracks);
57
58 private:
59 Module* module() override;
60 [[nodiscard]] const Module* module() const override;
61 [[nodiscard]] ArtistIdInfo artistIdInfo() const override;
62 [[nodiscard]] QString trackView() const override;
63 [[nodiscard]] QString trackSearchView() const override;
64
65 int checkArtist(const QString& artist, QHash<QString, Artist>& artistMap);
66 int
67 checkAlbum(const QString& album, const QString& albumArtist, Year year, QHash<QString, Album>& albumMap);
68 };
69}
70
71#endif // LIBRARYDATABASE_H
Definition Album.h:37
Definition Artist.h:34
Definition Albums.h:40
Definition Artists.h:40
Definition LibraryDatabase.h:42
Definition Module.h:32
Definition Tracks.h:42
Definition MetaDataList.h:34
Definition Utils.h:48