File indexing completed on 2024-05-12 04:55:37
0001 /** 0002 * \file discogsimporter.h 0003 * Discogs importer. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 13 Oct 2006 0008 * 0009 * Copyright (C) 2006-2024 Urs Fleisch 0010 * 0011 * This file is part of Kid3. 0012 * 0013 * Kid3 is free software; you can redistribute it and/or modify 0014 * it under the terms of the GNU General Public License as published by 0015 * the Free Software Foundation; either version 2 of the License, or 0016 * (at your option) any later version. 0017 * 0018 * Kid3 is distributed in the hope that it will be useful, 0019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0021 * GNU General Public License for more details. 0022 * 0023 * You should have received a copy of the GNU General Public License 0024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0025 */ 0026 0027 #pragma once 0028 0029 #include "serverimporter.h" 0030 0031 /** 0032 * Discogs importer. 0033 */ 0034 class DiscogsImporter : public ServerImporter { 0035 public: 0036 /** 0037 * Constructor. 0038 * 0039 * @param netMgr network access manager 0040 * @param trackDataModel track data to be filled with imported values 0041 */ 0042 DiscogsImporter(QNetworkAccessManager* netMgr, 0043 TrackDataModel *trackDataModel); 0044 0045 /** 0046 * Destructor. 0047 */ 0048 ~DiscogsImporter() override; 0049 0050 /** 0051 * Name of import source. 0052 * @return name. 0053 */ 0054 const char* name() const override; 0055 0056 /** anchor to online help, 0 to disable */ 0057 const char* helpAnchor() const override; 0058 0059 /** configuration, 0 if not used */ 0060 ServerImporterConfig* config() const override; 0061 0062 /** additional tags option, false if not used */ 0063 bool additionalTags() const override; 0064 0065 /** 0066 * Process finished findCddbAlbum request. 0067 * 0068 * @param searchStr search data received 0069 */ 0070 void parseFindResults(const QByteArray& searchStr) override; 0071 0072 /** 0073 * Parse result of album request and populate m_trackDataModel with results. 0074 * 0075 * @param albumStr album data received 0076 */ 0077 void parseAlbumResults(const QByteArray& albumStr) override; 0078 0079 /** 0080 * Send a query command to search on the server. 0081 * 0082 * @param cfg import source configuration 0083 * @param artist artist to search 0084 * @param album album to search 0085 */ 0086 void sendFindQuery( 0087 const ServerImporterConfig* cfg, 0088 const QString& artist, const QString& album) override; 0089 0090 /** 0091 * Send a query command to fetch the track list 0092 * from the server. 0093 * 0094 * @param cfg import source configuration 0095 * @param cat category 0096 * @param id ID 0097 */ 0098 void sendTrackListQuery( 0099 const ServerImporterConfig* cfg, const QString& cat, const QString& id) override; 0100 0101 private: 0102 class BaseImpl; 0103 class HtmlImpl; 0104 class JsonImpl; 0105 0106 BaseImpl* selectImpl(const ServerImporterConfig* cfg) const; 0107 0108 BaseImpl* const m_htmlImpl; 0109 BaseImpl* const m_jsonImpl; 0110 BaseImpl* m_impl; 0111 };