File indexing completed on 2024-05-19 04:50:13
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef JAMENDODATABASEHANDLER_H 0018 #define JAMENDODATABASEHANDLER_H 0019 0020 #include "JamendoMeta.h" 0021 0022 #include <QStringList> 0023 #include <QMap> 0024 0025 /** 0026 * This class wraps the database operations needed by the JamendoBrowser 0027 * 0028 * @author Nikolaj Hald Nielsen <nhn@kde.org> 0029 */ 0030 class JamendoDatabaseHandler 0031 { 0032 public: 0033 /** 0034 * Private constructor (singleton pattern) 0035 * @return Pointer to new object 0036 */ 0037 JamendoDatabaseHandler(); 0038 0039 ~JamendoDatabaseHandler(); 0040 0041 /** 0042 * Creates the tables needed to store Jamendo info 0043 */ 0044 void createDatabase(); 0045 0046 /** 0047 * Destroys Jamendo tables 0048 */ 0049 void destroyDatabase(); 0050 0051 /** 0052 * Inserts a new track into the Jamendo database 0053 * @param track pointer to the track to insert 0054 * @return the database id of the newly inserted track 0055 */ 0056 int insertTrack( Meta::ServiceTrack *track ); 0057 0058 /** 0059 * inserts a new album into the Jamendo database 0060 * @param album pointer to the album to insert 0061 * @return the database id of the newly inserted album 0062 */ 0063 int insertAlbum( Meta::ServiceAlbum *album ); 0064 0065 /** 0066 * inserts a new artist into the Jamendo database 0067 * @param artist pointer to the artist to insert 0068 * @return the database id of the newly inserted artist 0069 */ 0070 int insertArtist( Meta::ServiceArtist *artist ); 0071 0072 /** 0073 * inserts a new genre into the Jamendo database 0074 * @param genre pointer to the genre to insert 0075 * @return the database id of the newly inserted genre 0076 */ 0077 int insertGenre( Meta::ServiceGenre *genre ); 0078 0079 /** 0080 * Begins a database transaction. Must be followed by a later call to commit() 0081 */ 0082 void begin(); 0083 0084 /** 0085 * Completes (executes) a database transaction. Must be preceded by a call to begin() 0086 */ 0087 void commit(); 0088 0089 /** 0090 * Remove all genres that are applied to too few albums in an attempt to weed out the worst mistags and 0091 * speed up queries a bit! 0092 * @param minCount cutoff value... 0093 */ 0094 void trimGenres( int minCount ); 0095 }; 0096 0097 #endif