add_subdirectory( amarok )
add_subdirectory( banshee )
add_subdirectory( clementine )
-add_subdirectory( fastforward )
add_subdirectory( itunes )
add_subdirectory( rhythmbox )
+++ /dev/null
-include_directories(
- ${KDE4_INCLUDE_DIR}
- ${QT_INCLUDES}
-)
-
-set( amarok_importer-fastforward_PART_SRCS
- FastForwardConfigWidget.cpp
- FastForwardManager.cpp
- FastForwardProvider.cpp
- FastForwardTrack.cpp
-)
-
-kde4_add_ui_files( amarok_importer-fastforward_PART_SRCS FastForwardConfigWidget.ui )
-
-kde4_add_plugin( amarok_importer-fastforward ${amarok_importer-fastforward_PART_SRCS} )
-
-target_link_libraries( amarok_importer-fastforward
- amarokcore
- amaroklib
- ${KDE4_KIO_LIBS}
- ${QT_QTSQL_LIBRARY}
-)
-
-install( TARGETS amarok_importer-fastforward DESTINATION ${PLUGIN_INSTALL_DIR} )
-
-install( FILES amarok_importer-fastforward.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+++ /dev/null
-/****************************************************************************************
- * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify it under *
- * the terms of the GNU General Public License as published by the Free Software *
- * Foundation; either version 2 of the License, or (at your option) any later *
- * version. *
- * *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License along with *
- * this program. If not, see <http://www.gnu.org/licenses/>. *
- ****************************************************************************************/
-
-#include "FastForwardConfigWidget.h"
-
-#include <QDir>
-#include <QLayout>
-#include <QMetaEnum>
-
-using namespace StatSyncing;
-
-FastForwardConfigWidget::FastForwardConfigWidget( const QVariantMap &config,
- QWidget *parent, Qt::WindowFlags f )
- : ProviderConfigWidget( parent, f )
- , m_config( config )
-{
- setupUi( this );
-
- m_embeddedDbSettings << m_databaseLocation << m_databaseLocationLabel;
- m_externalDbSettings << m_databaseName << m_databaseNameLabel << m_hostname
- << m_hostnameLabel << m_password << m_passwordLabel
- << m_port << m_portLabel << m_username << m_usernameLabel;
-
- connect( m_connectionType, SIGNAL(currentIndexChanged(int)),
- SLOT(connectionTypeChanged(int)) );
- populateFields();
-}
-
-FastForwardConfigWidget::~FastForwardConfigWidget()
-{
-}
-
-QVariantMap
-FastForwardConfigWidget::config() const
-{
- QVariantMap cfg = m_config;
-
- const int enumId = metaObject()->indexOfEnumerator( "Driver" );
- QMetaEnum driverEnum = metaObject()->enumerator( enumId );
-
- cfg.insert( "name", m_targetName->text() );
- cfg.insert( "dbDriver", driverEnum.valueToKey(
- Driver( m_connectionType->currentIndex() ) ) );
-
- cfg.insert( "dbPath", m_databaseLocation->text() );
- cfg.insert( "dbName", m_databaseName->text() );
- cfg.insert( "dbHost", m_hostname->text() );
- cfg.insert( "dbUser", m_username->text() );
- cfg.insert( "dbPass", m_password->text() );
- cfg.insert( "dbPort", m_port->value() );
-
- return cfg;
-}
-
-void
-FastForwardConfigWidget::connectionTypeChanged( const int index )
-{
- const bool embedded = ( index == QSQLITE );
- const QList<QWidget*> &hide = embedded ? m_externalDbSettings : m_embeddedDbSettings;
- const QList<QWidget*> &show = embedded ? m_embeddedDbSettings : m_externalDbSettings;
-
- foreach( QWidget *widget, hide )
- widget->hide();
- foreach( QWidget *widget, show )
- widget->show();
-}
-
-void
-FastForwardConfigWidget::populateFields()
-{
- m_targetName->setText( m_config.value( "name", "Amarok 1.4" ).toString() );
-
- const int enumId = metaObject()->indexOfEnumerator( "Driver" );
- QMetaEnum driverEnum = metaObject()->enumerator( enumId );
-
- m_connectionType->insertItem( QMYSQL, "MySQL" );
- m_connectionType->insertItem( QPSQL, "PostgreSQL" );
- m_connectionType->insertItem( QSQLITE, "SQLite" );
-
- const QByteArray dbDriver = m_config.value( "dbDriver",
- driverEnum.valueToKey( QSQLITE ) ).toByteArray();
-
- int index = driverEnum.keyToValue( dbDriver.constData() );
- if( index == -1 )
- index = QSQLITE;
-
- m_connectionType->setCurrentIndex( index );
-
- const QString defaultPath = QDir::toNativeSeparators(
- QDir::homePath() + "/.kde/share/apps/amarok/collection.db" );
-
- m_databaseLocation->setText( m_config.value( "dbPath", defaultPath ).toString() );
- m_databaseName->setText( m_config.value( "dbName", "amarokdb" ).toString() );
- m_hostname->setText( m_config.value( "dbHost", "localhost" ).toString() );
- m_username->setText( m_config.value( "dbUser", "amarokuser" ).toString() );
- m_password->setText( m_config.value( "dbPass", "" ).toString() );
- m_port->setValue( m_config.value( "dbPort", 3306 ).toInt() );
-}
+++ /dev/null
-/****************************************************************************************
- * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify it under *
- * the terms of the GNU General Public License as published by the Free Software *
- * Foundation; either version 2 of the License, or (at your option) any later *
- * version. *
- * *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License along with *
- * this program. If not, see <http://www.gnu.org/licenses/>. *
- ****************************************************************************************/
-
-#ifndef STATSYNCING_FAST_FORWARD_CONFIG_WIDGET_H
-#define STATSYNCING_FAST_FORWARD_CONFIG_WIDGET_H
-
-#include "statsyncing/Provider.h"
-#include "ui_FastForwardConfigWidget.h"
-
-namespace StatSyncing
-{
-
-class FastForwardConfigWidget : public ProviderConfigWidget,
- public Ui::FastForwardConfigWidget
-{
- Q_OBJECT
- Q_ENUMS( Driver )
-
-public:
- explicit FastForwardConfigWidget( const QVariantMap &config, QWidget *parent = 0,
- Qt::WindowFlags f = 0 );
- ~FastForwardConfigWidget();
-
- QVariantMap config() const;
-
- enum Driver
- {
- QMYSQL,
- QPSQL,
- QSQLITE
- };
-
-private:
- void populateFields();
-
- const QVariantMap m_config;
- QList<QWidget*> m_externalDbSettings;
- QList<QWidget*> m_embeddedDbSettings;
-
-private slots:
- void connectionTypeChanged( const int index );
-};
-
-} // namespace StatSyncing
-
-#endif // STATSYNCING_FAST_FORWARD_CONFIG_WIDGET_H
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>FastForwardConfigWidget</class>
- <widget class="QWidget" name="FastForwardConfigWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>366</width>
- <height>262</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout" columnstretch="0,1" columnminimumwidth="100,250">
- <item row="8" column="0">
- <widget class="QLabel" name="m_usernameLabel">
- <property name="text">
- <string>Username</string>
- </property>
- <property name="buddy">
- <cstring>m_username</cstring>
- </property>
- </widget>
- </item>
- <item row="8" column="1">
- <widget class="KLineEdit" name="m_username"/>
- </item>
- <item row="2" column="1">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="9" column="0" colspan="2">
- <widget class="QLabel" name="m_passwordLabel">
- <property name="text">
- <string>Password</string>
- </property>
- <property name="buddy">
- <cstring>m_password</cstring>
- </property>
- </widget>
- </item>
- <item row="9" column="1">
- <widget class="QLineEdit" name="m_password">
- <property name="text">
- <string/>
- </property>
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QLabel" name="m_connectionTypeLabel">
- <property name="text">
- <string>Connection type</string>
- </property>
- <property name="buddy">
- <cstring>m_connectionType</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KComboBox" name="m_connectionType"/>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="m_databaseLocationLabel">
- <property name="text">
- <string>Database location</string>
- </property>
- <property name="buddy">
- <cstring>m_databaseLocation</cstring>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="KIntSpinBox" name="m_port">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>65535</number>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="2">
- <widget class="QLabel" name="m_targetNameLabel">
- <property name="text">
- <string>Target name</string>
- </property>
- <property name="buddy">
- <cstring>m_targetName</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KLineEdit" name="m_targetName"/>
- </item>
- <item row="5" column="0" colspan="2">
- <widget class="QLabel" name="m_hostnameLabel">
- <property name="text">
- <string>Hostname</string>
- </property>
- <property name="buddy">
- <cstring>m_hostname</cstring>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="KLineEdit" name="m_hostname"/>
- </item>
- <item row="6" column="0" colspan="2">
- <widget class="QLabel" name="m_portLabel">
- <property name="text">
- <string>Port</string>
- </property>
- <property name="buddy">
- <cstring>m_port</cstring>
- </property>
- </widget>
- </item>
- <item row="7" column="0" colspan="2">
- <widget class="QLabel" name="m_databaseNameLabel">
- <property name="text">
- <string>Database name</string>
- </property>
- <property name="buddy">
- <cstring>m_databaseName</cstring>
- </property>
- </widget>
- </item>
- <item row="7" column="1">
- <widget class="KLineEdit" name="m_databaseName"/>
- </item>
- <item row="4" column="1">
- <widget class="KUrlRequester" name="m_databaseLocation">
- <property name="filter">
- <string notr="true">collection.db</string>
- </property>
- <property name="mode">
- <set>KFile::ExistingOnly|KFile::File</set>
- </property>
- </widget>
- </item>
- <item row="10" column="1">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- <customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- <customwidget>
- <class>KIntSpinBox</class>
- <extends>QSpinBox</extends>
- <header>knuminput.h</header>
- </customwidget>
- <customwidget>
- <class>KUrlRequester</class>
- <extends>QFrame</extends>
- <header>kurlrequester.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
+++ /dev/null
-/****************************************************************************************
- * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify it under *
- * the terms of the GNU General Public License as published by the Free Software *
- * Foundation; either version 2 of the License, or (at your option) any later *
- * version. *
- * *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License along with *
- * this program. If not, see <http://www.gnu.org/licenses/>. *
- ****************************************************************************************/
-
-#include "importers/SimpleImporterManager.h"
-
-#include "FastForwardConfigWidget.h"
-#include "FastForwardProvider.h"
-
-AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( fastforward,
- "FastForwardImporter",
- i18n( "Amarok 1.4 (FastForward)" ),
- i18n( "Amarok 1.4 Statistics Importer" ),
- KIcon( "amarok" ),
- StatSyncing::FastForwardConfigWidget,
- StatSyncing::FastForwardProvider )
+++ /dev/null
-/****************************************************************************************
- * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify it under *
- * the terms of the GNU General Public License as published by the Free Software *
- * Foundation; either version 2 of the License, or (at your option) any later *
- * version. *
- * *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License along with *
- * this program. If not, see <http://www.gnu.org/licenses/>. *
- ****************************************************************************************/
-
-#include "FastForwardProvider.h"
-
-#include "FastForwardTrack.h"
-#include "core/support/Debug.h"
-#include "importers/ImporterManager.h"
-#include "importers/ImporterSqlConnection.h"
-
-using namespace StatSyncing;
-
-FastForwardProvider::FastForwardProvider( const QVariantMap &config,
- ImporterManager *importer )
- : ImporterProvider( config, importer )
-{
- if( config.value( "dbDriver" ).toString() == "QSQLITE" )
- {
- m_connection = ImporterSqlConnectionPtr(
- new ImporterSqlConnection( config.value( "dbPath" ).toString() ) );
- }
- else
- {
- m_connection = ImporterSqlConnectionPtr( new ImporterSqlConnection(
- m_config.value( "dbDriver" ).toString(),
- m_config.value( "dbHost" ).toString(),
- m_config.value( "dbPort" ).toUInt(),
- m_config.value( "dbName" ).toString(),
- m_config.value( "dbUser" ).toString(),
- m_config.value( "dbPass" ).toString()
- ) );
- }
-}
-
-FastForwardProvider::~FastForwardProvider()
-{
-}
-
-qint64
-FastForwardProvider::reliableTrackMetaData() const
-{
- return Meta::valTitle | Meta::valArtist | Meta::valAlbum | Meta::valComposer
- | Meta::valYear | Meta::valTrackNr | Meta::valDiscNr;
-}
-
-qint64
-FastForwardProvider::writableTrackStatsData() const
-{
- return Meta::valRating | Meta::valFirstPlayed | Meta::valLastPlayed
- | Meta::valPlaycount | Meta::valLabel;
-}
-
-QSet<QString>
-FastForwardProvider::artists()
-{
- QSet<QString> result;
- foreach( const QVariantList &row, m_connection->query( "SELECT name FROM artist" ) )
- result.insert( row[0].toString() );
-
- return result;
-}
-
-TrackList
-FastForwardProvider::artistTracks( const QString &artistName )
-{
- const QString query = "SELECT t.url, t.title, al.name, ar.name, c.name, y.name, "
- "t.track, t.discnumber, s.rating, s.createdate, s.accessdate, s.playcounter "
- "FROM tags t "
- "INNER JOIN artist ar ON ar.id = t.artist "
- "LEFT JOIN album al ON al.id = t.album "
- "LEFT JOIN composer c ON c.id = t.composer "
- "LEFT JOIN year y ON y.id = t.year "
- "LEFT JOIN statistics s ON s.url = t.url "
- "WHERE ar.name = :artist";
-
- QVariantMap bindValues;
- bindValues.insert( ":artist", artistName );
-
- const QList<qint64> fields = QList<qint64>() << Meta::valTitle << Meta::valAlbum
- << Meta::valArtist << Meta::valComposer << Meta::valYear
- << Meta::valTrackNr << Meta::valDiscNr << Meta::valRating
- << Meta::valFirstPlayed << Meta::valLastPlayed << Meta::valPlaycount;
-
- TrackList result;
- foreach( const QVariantList &row, m_connection->query( query, bindValues ) )
- {
- const QString trackUrl = row[0].toString();
-
- Meta::FieldHash metadata;
- for( int i = 0; i < fields.size(); ++i )
- metadata.insert( fields[i], row[i + 1] );
-
- const QString lblQuery = "SELECT l.name FROM labels l "
- "INNER JOIN tags_labels tl ON tl.labelid = l.id "
- "WHERE tl.url = :url";
-
- QVariantMap lblBindValues;
- lblBindValues.insert( ":url", trackUrl );
-
- QSet<QString> labels;
- foreach( const QVariantList &row, m_connection->query( lblQuery, lblBindValues ) )
- labels.insert( row[0].toString() );
-
- result << TrackPtr( new FastForwardTrack( trackUrl, m_connection, metadata,
- labels ) );
- }
-
- return result;
-}
+++ /dev/null
-/****************************************************************************************
- * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify it under *
- * the terms of the GNU General Public License as published by the Free Software *
- * Foundation; either version 2 of the License, or (at your option) any later *
- * version. *
- * *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License along with *
- * this program. If not, see <http://www.gnu.org/licenses/>. *
- ****************************************************************************************/
-
-#ifndef STATSYNCING_FAST_FORWARD_PROVIDER_H
-#define STATSYNCING_FAST_FORWARD_PROVIDER_H
-
-#include "importers/ImporterProvider.h"
-
-namespace StatSyncing
-{
-
-class ImporterSqlConnection;
-typedef QSharedPointer<ImporterSqlConnection> ImporterSqlConnectionPtr;
-
-class FastForwardProvider : public ImporterProvider
-{
-public:
- FastForwardProvider( const QVariantMap &config, ImporterManager *importer );
- ~FastForwardProvider();
-
- qint64 reliableTrackMetaData() const;
- qint64 writableTrackStatsData() const;
-
- QSet<QString> artists();
- TrackList artistTracks( const QString &artistName );
-
-private:
- ImporterSqlConnectionPtr m_connection;
-};
-
-} // namespace StatSyncing
-
-#endif // STATSYNCING_FAST_FORWARD_PROVIDER_H
+++ /dev/null
-/****************************************************************************************
- * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify it under *
- * the terms of the GNU General Public License as published by the Free Software *
- * Foundation; either version 2 of the License, or (at your option) any later *
- * version. *
- * *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License along with *
- * this program. If not, see <http://www.gnu.org/licenses/>. *
- ****************************************************************************************/
-
-#include "FastForwardTrack.h"
-
-#include "core/support/Debug.h"
-#include "importers/ImporterSqlConnection.h"
-
-using namespace StatSyncing;
-
-FastForwardTrack::FastForwardTrack( const QString &trackUrl,
- const ImporterSqlConnectionPtr &connection,
- const Meta::FieldHash &metadata,
- const QSet<QString> labels )
- : SimpleWritableTrack( metadata, labels )
- , m_connection( connection )
- , m_trackUrl( trackUrl )
-{
-}
-
-FastForwardTrack::~FastForwardTrack()
-{
-}
-
-void
-StatSyncing::FastForwardTrack::doCommit( const qint64 fields )
-{
- m_connection->transaction();
- bool ok = true;
-
- const QString query = "SELECT deviceid, uniqueid FROM uniqueid WHERE url = :url";
- QVariantMap bindValues;
- bindValues.insert( ":url", m_trackUrl );
-
- const QList<QVariantList> result = m_connection->query( query, bindValues, &ok );
- if( !ok )
- {
- m_connection->rollback();
- return;
- }
-
- const int deviceId = result.front()[0].toInt();
- const QString uniqueId = result.front()[1].toString();
-
- QStringList updates;
- QVariantMap uBindValues;
-
- if( fields & Meta::valFirstPlayed )
- {
- updates << "createdate = :createdate";
- uBindValues.insert( ":createdate", m_statistics.value( Meta::valFirstPlayed ) );
- }
- if( fields & Meta::valLastPlayed )
- {
- updates << "accessdate = :accessdate";
- uBindValues.insert( ":accessdate", m_statistics.value( Meta::valLastPlayed ) );
- }
- if( fields & Meta::valRating )
- {
- updates << "rating = :rating";
- uBindValues.insert( ":rating", m_statistics.value( Meta::valRating ) );
- }
- if( fields & Meta::valPlaycount )
- {
- updates << "playcounter = :playcount";
- uBindValues.insert( ":playcount", m_statistics.value( Meta::valPlaycount ) );
- }
-
- if( !updates.isEmpty() )
- {
- const QString query = "SELECT COUNT(*) FROM statistics WHERE url = :url";
- QVariantMap bindValues;
- bindValues.insert( ":url", m_trackUrl );
-
- const QList<QVariantList> result = m_connection->query( query, bindValues, &ok );
- if( !ok )
- {
- m_connection->rollback();
- return;
- }
-
- // Statistic row doesn't exist
- if( !result.front()[0].toInt() )
- {
- const QString query = "INSERT INTO statistics (url, deviceid, uniqueid) "
- "VALUES ( :url, :devid, :uniqid )";
- QVariantMap bindValues;
- bindValues.insert( ":url", m_trackUrl );
- bindValues.insert( ":devid", deviceId );
- bindValues.insert( ":url", uniqueId );
-
- m_connection->query( query, bindValues, &ok );
- if( !ok )
- {
- m_connection->rollback();
- return;
- }
- }
-
- // Update statistics
- const QString uQuery = "UPDATE statistics SET " + updates.join(", ") +
- " WHERE url = :url";
-
- uBindValues.insert( ":url", m_trackUrl );
- m_connection->query( uQuery, uBindValues, &ok );
- if( !ok )
- {
- m_connection->rollback();
- return;
- }
- }
-
- if( fields & Meta::valLabel )
- {
- // Drop old label associations
- const QString query = "DELETE FROM tags_labels WHERE url = :url";
- QVariantMap bindValues;
- bindValues.insert( ":url", m_trackUrl );
- m_connection->query( query, bindValues, &ok );
- if( !ok )
- {
- m_connection->rollback();
- return;
- }
-
- foreach( const QString &label, m_labels )
- {
- {
- // Check if the label exists
- const QString query = "SELECT COUNT(*) FROM labels WHERE name = :name";
- QVariantMap bindValues;
- bindValues.insert( ":name", label );
-
- const QList<QVariantList> result = m_connection->query( query, bindValues,
- &ok );
- if( !ok )
- {
- m_connection->rollback();
- return;
- }
-
- // Insert label if it doesn't
- if( !result.front()[0].toInt() )
- {
- const QString query = "INSERT INTO labels (name, type) "
- "VALUES (:name, 1)";
- QVariantMap bindValues;
- bindValues.insert( ":name", label );
-
- m_connection->query( query, bindValues, &ok );
- if( !ok )
- {
- m_connection->rollback();
- return;
- }
- }
- }
-
- // Insert track <-> label association
- const QString query = "INSERT INTO tags_labels (deviceid, url, uniqueid, "
- "labelid) VALUES ( :devid, :url, :uniqid, "
- "(SELECT id FROM labels WHERE name = :name) )";
- QVariantMap bindValues;
- bindValues.insert( ":devid", deviceId );
- bindValues.insert( ":url", m_trackUrl );
- bindValues.insert( ":uniqid", uniqueId );
- bindValues.insert( ":name", label );
-
- m_connection->query( query, bindValues, &ok );
- if( !ok )
- {
- m_connection->rollback();
- return;
- }
- }
- }
-
- m_connection->commit();
-}
+++ /dev/null
-/****************************************************************************************
- * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify it under *
- * the terms of the GNU General Public License as published by the Free Software *
- * Foundation; either version 2 of the License, or (at your option) any later *
- * version. *
- * *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License along with *
- * this program. If not, see <http://www.gnu.org/licenses/>. *
- ****************************************************************************************/
-
-#ifndef STATSYNCING_FAST_FORWARD_TRACK_H
-#define STATSYNCING_FAST_FORWARD_TRACK_H
-
-#include "statsyncing/SimpleWritableTrack.h"
-
-namespace StatSyncing
-{
-
-class ImporterSqlConnection;
-typedef QSharedPointer<ImporterSqlConnection> ImporterSqlConnectionPtr;
-
-class FastForwardTrack : public SimpleWritableTrack
-{
-public:
- FastForwardTrack( const QString &trackUrl, const ImporterSqlConnectionPtr &connection,
- const Meta::FieldHash &metadata, const QSet<QString> labels );
- ~FastForwardTrack();
-
-protected:
- void doCommit( const qint64 fields );
-
-private:
- const ImporterSqlConnectionPtr m_connection;
- const QString m_trackUrl;
-};
-
-} // namespace StatSyncing
-
-#endif // STATSYNCING_FAST_FORWARD_TRACK_H
+++ /dev/null
-[Desktop Entry]
-Type=Service
-Icon=amarok
-Name=Amarok 1.4 (FastForward) Importer
-Name[ca]=Importador de l'Amarok 1.4 (FastForward)
-Name[ca@valencia]=Importador de l'Amarok 1.4 (FastForward)
-Name[cs]=Import Amarok 1.4 (FastForward)
-Name[da]=Amarok 1.4 (FastForward)-importør
-Name[de]=Amarok 1.4 (FastForward) Import
-Name[el]=Amarok 1.4 (FastForward) εισαγωγέας
-Name[en_GB]=Amarok 1.4 (FastForward) Importer
-Name[es]=Importador de Amarok 1.4 (FastForward)
-Name[fi]=Amarok 1.4 (Fast Forward) -tuonti
-Name[fr]=Importateur d'Amarok 1.4 (FastForward)
-Name[hu]=Amarok 1.4 (FastForward) importáló
-Name[id]=Pengimpor Amarok 1.4 (FastForward)
-Name[it]=Importatore di Amarok 1.4 (FastForward)
-Name[nl]=Programma voor importeren van Amarok 1.4 (snel vooruit)
-Name[pl]=Importowanie z Amaroka 1.4 (FastForward)
-Name[pt]=Importação do Amarok 1.4 (FastForward)
-Name[pt_BR]=Importação do Amarok 1.4 (FastForward)
-Name[ro]=Importator Amarok 1.4 (FastForward)
-Name[ru]=Импорт из Amarok 1.4
-Name[sk]=Importér Amarok 1.4 (FastForward)
-Name[sl]=Uvoznik iz Amarok 1.4 (FastForward)
-Name[sr]=Увозник из Амарока 1.4 (FastForward)
-Name[sr@ijekavian]=Увозник из Амарока 1.4 (FastForward)
-Name[sr@ijekavianlatin]=Uvoznik iz Amaroka 1.4 (FastForward)
-Name[sr@latin]=Uvoznik iz Amaroka 1.4 (FastForward)
-Name[sv]=Amarok 1.4 (FastForward)-importverktyg
-Name[tr]=Amarok 1.4 (FastForward) İçe Aktarıcı
-Name[uk]=Засіб імпортування даних Amarok 1.4 (FastForward)
-Name[x-test]=xxAmarok 1.4 (FastForward) Importerxx
-Name[zh_TW]=Amarok 1.4 (快轉)匯入器
-Comment=Import statistics from Amarok 1.4 database
-Comment[ca]=Importa estadístiques des de base de dades de l'Amarok 1.4
-Comment[ca@valencia]=Importa estadístiques des de base de dades de l'Amarok 1.4
-Comment[cs]=Importovat statistiky z databáze Amarok 1.4
-Comment[da]=Importér statistik fra Amarok 1.4-database
-Comment[de]=Importiert die Statistik von Datenbanken von Amarok 1.4
-Comment[el]=Εισάγει στατιστικά από τη βάση δεδομένων του Amarok 1.4
-Comment[en_GB]=Import statistics from Amarok 1.4 database
-Comment[es]=Importa estadísticas de la base de datos de Amarok 1.4
-Comment[fi]=Tuo tilastot Amarok 1.4:n tietokannasta
-Comment[fr]=Importe les statistiques de la base de données d'Amarok 1.4
-Comment[hu]=Statisztikák importálása az Amarok 1.4 adatbázisából
-Comment[id]=Impor statistik dari database Amarok 1.4
-Comment[it]=Importa le statistiche dal database di Amarok 1.4
-Comment[nl]=Statistieken uit de Amarok 1.4 database importeren
-Comment[pl]=Importowanie statystyk z bazy danych Amaroka 1.4
-Comment[pt]=Importa as estatísticas da base de dados do Amarok 1.4
-Comment[pt_BR]=Importa as estatísticas do banco de dados do Amarok 1.4
-Comment[ro]=Importă statistici din bază de date Amarok 1.4
-Comment[ru]=Импорт статистики из базы данных Amarok 1.4
-Comment[sk]=Importovať štatistiky z databázy Amarok 1.4
-Comment[sl]=Uvozite statistiko iz podatkovne zbirke Amarok 1.4
-Comment[sr]=Увозник статистике из базе Амарока 1.4
-Comment[sr@ijekavian]=Увозник статистике из базе Амарока 1.4
-Comment[sr@ijekavianlatin]=Uvoznik statistike iz baze Amaroka 1.4
-Comment[sr@latin]=Uvoznik statistike iz baze Amaroka 1.4
-Comment[sv]=Importera statistik från Amarok 1.4-databas
-Comment[tr]=İstatistikleri Amarok 1.4 veritabanından al
-Comment[uk]=Імпортування статистичних даних з бази даних Amarok 1.4
-Comment[x-test]=xxImport statistics from Amarok 1.4 databasexx
-Comment[zh_TW]=從 Amarok 1.4 資料庫中匯入統計資料
-
-ServiceTypes=Amarok/Plugin
-
-X-KDE-Amarok-authors=Konrad Zemek
-X-KDE-Amarok-email=konrad.zemek@gmail.com
-X-KDE-Amarok-framework-version=72
-X-KDE-Amarok-name=FastForwardImporter
-X-KDE-Amarok-plugintype=importer
-X-KDE-Amarok-rank=100
-X-KDE-Amarok-version=1
-
-X-KDE-PluginInfo-Author=Konrad Zemek
-X-KDE-PluginInfo-Email=konrad.zemek@gmail.com
-X-KDE-PluginInfo-Version=1.0
-X-KDE-PluginInfo-Category=Importer
-X-KDE-PluginInfo-License=GPL
-X-KDE-PluginInfo-EnabledByDefault=true
-X-KDE-PluginInfo-Name=amarok_importer-fastforward
-X-KDE-Library=amarok_importer-fastforward