summaryrefslogtreecommitdiffstats
path: root/amarok/src/magnatunebrowser/magnatunedatabasehandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'amarok/src/magnatunebrowser/magnatunedatabasehandler.cpp')
-rw-r--r--amarok/src/magnatunebrowser/magnatunedatabasehandler.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/amarok/src/magnatunebrowser/magnatunedatabasehandler.cpp b/amarok/src/magnatunebrowser/magnatunedatabasehandler.cpp
index 48a52599..e66700bc 100644
--- a/amarok/src/magnatunebrowser/magnatunedatabasehandler.cpp
+++ b/amarok/src/magnatunebrowser/magnatunedatabasehandler.cpp
@@ -48,19 +48,19 @@ MagnatuneDatabaseHandler::createDatabase( )
//Get database instance
CollectionDB *db = CollectionDB::instance();
- QString tracksAutoIncrement = "";
- QString albumsAutoIncrement = "";
- QString artistAutoIncrement = "";
+ TQString tracksAutoIncrement = "";
+ TQString albumsAutoIncrement = "";
+ TQString artistAutoIncrement = "";
if ( db->getDbConnectionType() == DbConnection::postgresql )
{
- db->query( QString( "CREATE SEQUENCE magnatune_track_seq;" ) );
- db->query( QString( "CREATE SEQUENCE magnatune_album_seq;" ) );
- db->query( QString( "CREATE SEQUENCE magnatune_artist_seq;" ) );
+ db->query( TQString( "CREATE SEQUENCE magnatune_track_seq;" ) );
+ db->query( TQString( "CREATE SEQUENCE magnatune_album_seq;" ) );
+ db->query( TQString( "CREATE SEQUENCE magnatune_artist_seq;" ) );
- tracksAutoIncrement = QString( "DEFAULT nextval('magnatune_track_seq')" );
- albumsAutoIncrement = QString( "DEFAULT nextval('magnatune_album_seq')" );
- artistAutoIncrement = QString( "DEFAULT nextval('magnatune_artist_seq')" );
+ tracksAutoIncrement = TQString( "DEFAULT nextval('magnatune_track_seq')" );
+ albumsAutoIncrement = TQString( "DEFAULT nextval('magnatune_album_seq')" );
+ artistAutoIncrement = TQString( "DEFAULT nextval('magnatune_artist_seq')" );
}
else if ( db->getDbConnectionType() == DbConnection::mysql )
@@ -72,7 +72,7 @@ MagnatuneDatabaseHandler::createDatabase( )
}
// create table containing tracks
- QString queryString = "CREATE TABLE magnatune_tracks ("
+ TQString queryString = "CREATE TABLE magnatune_tracks ("
"id INTEGER PRIMARY KEY " + tracksAutoIncrement + ',' +
"name " + db->textColumnType() + ',' +
"track_number INTEGER,"
@@ -85,7 +85,7 @@ MagnatuneDatabaseHandler::createDatabase( )
debug() << "Creating mangnatune_tracks: " << queryString << endl;
- QStringList result = db->query( queryString );
+ TQStringList result = db->query( queryString );
//Create album table
queryString = "CREATE TABLE magnatune_albums ("
@@ -121,31 +121,31 @@ void
MagnatuneDatabaseHandler::destroyDatabase( )
{
CollectionDB *db = CollectionDB::instance();
- QStringList result = db->query( "DROP TABLE magnatune_tracks;" );
+ TQStringList result = db->query( "DROP TABLE magnatune_tracks;" );
result = db->query( "DROP TABLE magnatune_albums;" );
result = db->query( "DROP TABLE magnatune_artists;" );
if ( db->getDbConnectionType() == DbConnection::postgresql )
{
- db->query( QString( "DROP SEQUENCE magnatune_track_seq;" ) );
- db->query( QString( "DROP SEQUENCE magnatune_album_seq;" ) );
- db->query( QString( "DROP SEQUENCE magnatune_artist_seq;" ) );
+ db->query( TQString( "DROP SEQUENCE magnatune_track_seq;" ) );
+ db->query( TQString( "DROP SEQUENCE magnatune_album_seq;" ) );
+ db->query( TQString( "DROP SEQUENCE magnatune_artist_seq;" ) );
}
}
int
MagnatuneDatabaseHandler::insertTrack( MagnatuneTrack *track, int albumId, int artistId )
{
- QString numberString;
+ TQString numberString;
CollectionDB *db = CollectionDB::instance();
- QString queryString = "INSERT INTO magnatune_tracks ( name, track_number, length, "
+ TQString queryString = "INSERT INTO magnatune_tracks ( name, track_number, length, "
"album_id, artist_id, preview_lofi, preview_hifi ) VALUES ( '"
+ db->escapeString( track->getName() ) + "', "
- + QString::number( track->getTrackNumber() ) + ", "
- + QString::number( track->getDuration() ) + ", "
- + QString::number( albumId ) + ", "
- + QString::number( artistId ) + ", '"
+ + TQString::number( track->getTrackNumber() ) + ", "
+ + TQString::number( track->getDuration() ) + ", "
+ + TQString::number( albumId ) + ", "
+ + TQString::number( artistId ) + ", '"
+ db->escapeString( track->getLofiURL() ) + "', '"
+ db->escapeString( track->getHifiURL() ) + "' );";
@@ -158,13 +158,13 @@ MagnatuneDatabaseHandler::insertTrack( MagnatuneTrack *track, int albumId, int a
int
MagnatuneDatabaseHandler::insertAlbum( MagnatuneAlbum *album, int artistId )
{
- QString queryString;
+ TQString queryString;
CollectionDB *db = CollectionDB::instance();
queryString = "INSERT INTO magnatune_albums ( name, year, artist_id, "
"genre, album_code, cover_url ) VALUES ( '"
+ db->escapeString( db->escapeString( album->getName() ) ) + "', "
- + QString::number( album->getLaunchDate().year() ) + ", "
- + QString::number( artistId ) + ", '"
+ + TQString::number( album->getLaunchDate().year() ) + ", "
+ + TQString::number( artistId ) + ", '"
+ db->escapeString( album->getMp3Genre() ) + "', '"
+ album->getAlbumCode() + "', '"
+ db->escapeString( album->getCoverURL() ) + "' );";
@@ -179,7 +179,7 @@ MagnatuneDatabaseHandler::insertAlbum( MagnatuneAlbum *album, int artistId )
int
MagnatuneDatabaseHandler::insertArtist( MagnatuneArtist *artist )
{
- QString queryString;
+ TQString queryString;
CollectionDB *db = CollectionDB::instance();
queryString = "INSERT INTO magnatune_artists ( name, artist_page, description, "
"photo_url ) VALUES ( '"
@@ -195,48 +195,48 @@ MagnatuneDatabaseHandler::insertArtist( MagnatuneArtist *artist )
int
-MagnatuneDatabaseHandler::getArtistIdByExactName( QString name )
+MagnatuneDatabaseHandler::getArtistIdByExactName( TQString name )
{
CollectionDB *db = CollectionDB::instance();
- QString queryString = "SELECT id from magnatune_artists WHERE name='" + db->escapeString( name ) + "';";
- QStringList result = db->query( queryString );
+ TQString queryString = "SELECT id from magnatune_artists WHERE name='" + db->escapeString( name ) + "';";
+ TQStringList result = db->query( queryString );
//debug() << "Looking for id of artist " << name << ":" << endl;
if ( result.size() < 1 ) return -1;
int artistId = result.first().toInt();
- //debug() << " Found: " << QString::number( artistId ) << ":" << endl;
+ //debug() << " Found: " << TQString::number( artistId ) << ":" << endl;
return artistId;
}
-int MagnatuneDatabaseHandler::getAlbumIdByAlbumCode( QString albumcode )
+int MagnatuneDatabaseHandler::getAlbumIdByAlbumCode( TQString albumcode )
{
CollectionDB *db = CollectionDB::instance();
- QString queryString = "SELECT id from magnatune_albums WHERE album_code='" + db->escapeString( albumcode ) + "';";
- QStringList result = db->query( queryString );
+ TQString queryString = "SELECT id from magnatune_albums WHERE album_code='" + db->escapeString( albumcode ) + "';";
+ TQStringList result = db->query( queryString );
//debug() << "Looking for id of album " << albumcode << ":" << endl;
if ( result.size() < 1 ) return -1;
int albumId = result.first().toInt();
- //debug() << " Found: " << QString::number( albumId ) << ":" << endl;
+ //debug() << " Found: " << TQString::number( albumId ) << ":" << endl;
return albumId;
}
MagnatuneArtistList
-MagnatuneDatabaseHandler::getArtistsByGenre( QString genre )
+MagnatuneDatabaseHandler::getArtistsByGenre( TQString genre )
{
- QString genreSql = "";
+ TQString genreSql = "";
if ( genre != "All" )
{
@@ -245,7 +245,7 @@ MagnatuneDatabaseHandler::getArtistsByGenre( QString genre )
CollectionDB *db = CollectionDB::instance();
- QString queryString;
+ TQString queryString;
queryString = "SELECT DISTINCT magnatune_artists.id, "
"magnatune_artists.name, magnatune_artists.artist_page, "
"magnatune_artists.description, magnatune_artists.photo_url "
@@ -253,7 +253,7 @@ MagnatuneDatabaseHandler::getArtistsByGenre( QString genre )
"WHERE " + genreSql + "magnatune_albums.artist_id "
"= magnatune_artists.id;";
- QStringList result = db->query( queryString );
+ TQStringList result = db->query( queryString );
debug() << "Looking for artist in genre: " << genre << endl;
@@ -287,10 +287,10 @@ MagnatuneDatabaseHandler::getArtistsByGenre( QString genre )
}
MagnatuneAlbumList
-MagnatuneDatabaseHandler::getAlbumsByArtistId( int id, QString genre )
+MagnatuneDatabaseHandler::getAlbumsByArtistId( int id, TQString genre )
{
- QString genreSqlString;
+ TQString genreSqlString;
if ( genre.isEmpty() )
{
@@ -303,19 +303,19 @@ MagnatuneDatabaseHandler::getAlbumsByArtistId( int id, QString genre )
CollectionDB *db = CollectionDB::instance();
- QString queryString;
+ TQString queryString;
queryString = "SELECT DISTINCT id, "
"name, year, "
"artist_id, genre, "
"album_code, cover_url "
"FROM magnatune_albums "
- "WHERE artist_id = '" + QString::number( id ) + '\'';
+ "WHERE artist_id = '" + TQString::number( id ) + '\'';
queryString += genreSqlString;
queryString += ';';
- QStringList result = db->query( queryString );
+ TQStringList result = db->query( queryString );
MagnatuneAlbumList list;
@@ -333,7 +333,7 @@ MagnatuneDatabaseHandler::getAlbumsByArtistId( int id, QString genre )
album.setName( result.front() );
result.pop_front();
- album.setLaunchDate( QDate( result.front().toInt(), 1, 1 ) );
+ album.setLaunchDate( TQDate( result.front().toInt(), 1, 1 ) );
result.pop_front();
album.setArtistId( result.front().toInt() );
@@ -362,16 +362,16 @@ MagnatuneDatabaseHandler::getTracksByAlbumId( int id )
CollectionDB *db = CollectionDB::instance();
- QString queryString;
+ TQString queryString;
queryString = "SELECT DISTINCT id, "
"name, track_number, "
"length, album_id, "
"artist_id, preview_lofi, "
"preview_hifi "
"FROM magnatune_tracks "
- "WHERE album_id = '" + QString::number( id ) + "';";
+ "WHERE album_id = '" + TQString::number( id ) + "';";
- QStringList result = db->query( queryString );
+ TQStringList result = db->query( queryString );
MagnatuneTrackList list;
@@ -418,13 +418,13 @@ MagnatuneDatabaseHandler::getTracksByAlbumId( int id )
}
-QStringList
+TQStringList
MagnatuneDatabaseHandler::getAlbumGenres( )
{
CollectionDB *db = CollectionDB::instance();
- QString queryString;
+ TQString queryString;
queryString = "SELECT DISTINCT genre "
"FROM magnatune_albums "
"ORDER BY genre;";
@@ -438,7 +438,7 @@ MagnatuneDatabaseHandler::begin( )
CollectionDB *db = CollectionDB::instance();
- QString queryString = "BEGIN;";
+ TQString queryString = "BEGIN;";
db->query( queryString );
}
@@ -447,7 +447,7 @@ void
MagnatuneDatabaseHandler::commit( )
{
CollectionDB *db = CollectionDB::instance();
- QString queryString = "COMMIT;";
+ TQString queryString = "COMMIT;";
db->query( queryString );
@@ -459,14 +459,14 @@ MagnatuneDatabaseHandler::getArtistById( int id )
CollectionDB *db = CollectionDB::instance();
- QString queryString;
+ TQString queryString;
queryString = "SELECT id, "
"name, artist_page, "
"description, photo_url "
"FROM magnatune_artists "
- "WHERE id = '" + QString::number( id ) + "';";
+ "WHERE id = '" + TQString::number( id ) + "';";
- QStringList result = db->query( queryString );
+ TQStringList result = db->query( queryString );
MagnatuneArtist artist;
@@ -501,15 +501,15 @@ MagnatuneDatabaseHandler::getAlbumById( int id )
CollectionDB *db = CollectionDB::instance();
- QString queryString;
+ TQString queryString;
queryString = "SELECT id, "
"name, year, "
"artist_id, genre, "
"album_code, cover_url "
"FROM magnatune_albums "
- "WHERE id = '" + QString::number( id ) + "';";
+ "WHERE id = '" + TQString::number( id ) + "';";
- QStringList result = db->query( queryString );
+ TQStringList result = db->query( queryString );
MagnatuneAlbum album;
@@ -522,7 +522,7 @@ MagnatuneDatabaseHandler::getAlbumById( int id )
album.setName( result.front() );
result.pop_front();
- album.setLaunchDate( QDate( result.front().toInt(), 1, 1 ) );
+ album.setLaunchDate( TQDate( result.front().toInt(), 1, 1 ) );
result.pop_front();
album.setArtistId( result.front().toInt() );