mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +02:00
fix more sql stuff
This commit is contained in:
@@ -19,8 +19,8 @@ DatabaseCommand_CreateDynamicPlaylist::DatabaseCommand_CreateDynamicPlaylist( QO
|
|||||||
|
|
||||||
DatabaseCommand_CreateDynamicPlaylist::DatabaseCommand_CreateDynamicPlaylist( const source_ptr& author,
|
DatabaseCommand_CreateDynamicPlaylist::DatabaseCommand_CreateDynamicPlaylist( const source_ptr& author,
|
||||||
const dynplaylist_ptr& playlist )
|
const dynplaylist_ptr& playlist )
|
||||||
: DatabaseCommand_CreatePlaylist( author, playlist.staticCast<Playlist>() )
|
: DatabaseCommand_CreatePlaylist( author, playlist.staticCast<Playlist>() )
|
||||||
, m_playlist( playlist )
|
, m_playlist( playlist )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "creating dynamiccreatecommand 2";
|
qDebug() << Q_FUNC_INFO << "creating dynamiccreatecommand 2";
|
||||||
}
|
}
|
||||||
@@ -34,13 +34,14 @@ DatabaseCommand_CreateDynamicPlaylist::exec( DatabaseImpl* lib )
|
|||||||
Q_ASSERT( !source().isNull() );
|
Q_ASSERT( !source().isNull() );
|
||||||
|
|
||||||
DatabaseCommand_CreatePlaylist::exec( lib );
|
DatabaseCommand_CreatePlaylist::exec( lib );
|
||||||
|
qDebug() << "Created normal playlist, now creating additional dynamic info!" << m_playlist.isNull();
|
||||||
|
|
||||||
TomahawkSqlQuery cre = lib->newquery();
|
TomahawkSqlQuery cre = lib->newquery();
|
||||||
cre.prepare( "INSERT INTO dynamic_playlist( guid, pltype, plmode) "
|
cre.prepare( "INSERT INTO dynamic_playlist( guid, pltype, plmode ) "
|
||||||
"VALUES( :guid, :pltype, :plmode )" );
|
"VALUES( ?, ?, ? )" );
|
||||||
cre.bindValue( ":guid", m_playlist->guid() );
|
cre.bindValue( 0, m_playlist->guid() );
|
||||||
cre.bindValue( ":pltype", m_playlist->type() );
|
cre.bindValue( 1, m_playlist->type() );
|
||||||
cre.bindValue( ":plmode", m_playlist->mode() );
|
cre.bindValue( 2, m_playlist->mode() );
|
||||||
|
|
||||||
qDebug() << "CREATE DYNPLAYLIST:" << cre.boundValues();
|
qDebug() << "CREATE DYNPLAYLIST:" << cre.boundValues();
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ void DatabaseCommand_LoadAllPlaylists::exec( DatabaseImpl* dbi )
|
|||||||
TomahawkSqlQuery query = dbi->newquery();
|
TomahawkSqlQuery query = dbi->newquery();
|
||||||
|
|
||||||
query.exec( QString( "SELECT guid, title, info, creator, lastmodified, shared, currentrevision "
|
query.exec( QString( "SELECT guid, title, info, creator, lastmodified, shared, currentrevision "
|
||||||
"FROM playlist WHERE source %1" )
|
"FROM playlist WHERE source %1 AND NOT dynplaylist" )
|
||||||
.arg( source()->isLocal() ? "IS NULL" :
|
.arg( source()->isLocal() ? "IS NULL" :
|
||||||
QString( "=%1" ).arg( source()->id() )
|
QString( "=%1" ).arg( source()->id() )
|
||||||
) );
|
) );
|
||||||
|
@@ -60,7 +60,8 @@ CREATE TABLE IF NOT EXISTS playlist (
|
|||||||
info TEXT,
|
info TEXT,
|
||||||
creator TEXT,
|
creator TEXT,
|
||||||
lastmodified INTEGER NOT NULL DEFAULT 0,
|
lastmodified INTEGER NOT NULL DEFAULT 0,
|
||||||
currentrevision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED
|
currentrevision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED,
|
||||||
|
dynplaylist BOOLEAN DEFAULT false
|
||||||
);
|
);
|
||||||
|
|
||||||
--INSERT INTO playlist(guid, title, info, currentrevision)
|
--INSERT INTO playlist(guid, title, info, currentrevision)
|
||||||
@@ -97,27 +98,27 @@ CREATE TABLE IF NOT EXISTS playlist_revision (
|
|||||||
previous_revision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED
|
previous_revision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS dynamic_playlist {
|
CREATE TABLE IF NOT EXISTS dynamic_playlist (
|
||||||
guid TEXT PRIMARY KEY,
|
guid TEXT PRIMARY KEY,
|
||||||
pltype TEXT, -- the generator type
|
pltype TEXT, -- the generator type
|
||||||
plmode INTEGER -- the mode of this playlist
|
plmode INTEGER -- the mode of this playlist
|
||||||
};
|
);
|
||||||
|
|
||||||
-- list of controls in each playlist. each control saves a selectedType, a match, and an input
|
-- list of controls in each playlist. each control saves a selectedType, a match, and an input
|
||||||
CREATE TABLE IF NOT EXISTS dynamic_playlist_controls {
|
CREATE TABLE IF NOT EXISTS dynamic_playlist_controls (
|
||||||
id TEXT PRIMARY KEY,
|
id TEXT PRIMARY KEY,
|
||||||
playlist TEXT NOT NULL REFERENCES playlist(guid) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
|
playlist TEXT NOT NULL REFERENCES playlist(guid) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
|
||||||
selectedType TEXT,
|
selectedType TEXT,
|
||||||
match TEXT,
|
match TEXT,
|
||||||
input TEXT
|
input TEXT
|
||||||
};
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS dynamic_playlist_revision {
|
CREATE TABLE IF NOT EXISTS dynamic_playlist_revision (
|
||||||
guid TEXT PRIMARY KEY,
|
guid TEXT PRIMARY KEY,
|
||||||
controls TEXT, -- qlist( id, id, id )
|
controls TEXT, -- qlist( id, id, id )
|
||||||
plmode INTEGER REFERENCES dynamic_playlist( plmode ) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
|
plmode INTEGER REFERENCES dynamic_playlist( plmode ) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
|
||||||
pltype TEXT REFERENCES dynamic_playlist( pltype ) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED
|
pltype TEXT REFERENCES dynamic_playlist( pltype ) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED
|
||||||
};
|
);
|
||||||
|
|
||||||
--INSERT INTO playlist_revision(guid, playlist, entries)
|
--INSERT INTO playlist_revision(guid, playlist, entries)
|
||||||
-- VALUES('revisionguid-1', 'playlistguid-1', '["itemguid-2","itemguid-1","itemguid-3"]');
|
-- VALUES('revisionguid-1', 'playlistguid-1', '["itemguid-2","itemguid-1","itemguid-3"]');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
This file was automatically generated from schema.sql on Tue Jul 13 12:23:44 CEST 2010.
|
This file was automatically generated from schema.sql on Mon Dec 6 22:41:52 EST 2010.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char * tomahawk_schema_sql =
|
static const char * tomahawk_schema_sql =
|
||||||
@@ -49,7 +49,8 @@ static const char * tomahawk_schema_sql =
|
|||||||
" info TEXT,"
|
" info TEXT,"
|
||||||
" creator TEXT,"
|
" creator TEXT,"
|
||||||
" lastmodified INTEGER NOT NULL DEFAULT 0,"
|
" lastmodified INTEGER NOT NULL DEFAULT 0,"
|
||||||
" currentrevision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED"
|
" currentrevision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED,"
|
||||||
|
" dynplaylist BOOLEAN DEFAULT false"
|
||||||
");"
|
");"
|
||||||
"CREATE TABLE IF NOT EXISTS playlist_item ("
|
"CREATE TABLE IF NOT EXISTS playlist_item ("
|
||||||
" guid TEXT PRIMARY KEY,"
|
" guid TEXT PRIMARY KEY,"
|
||||||
@@ -72,6 +73,25 @@ static const char * tomahawk_schema_sql =
|
|||||||
" timestamp INTEGER NOT NULL DEFAULT 0,"
|
" timestamp INTEGER NOT NULL DEFAULT 0,"
|
||||||
" previous_revision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED"
|
" previous_revision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED"
|
||||||
");"
|
");"
|
||||||
|
"CREATE TABLE IF NOT EXISTS dynamic_playlist ("
|
||||||
|
" guid TEXT PRIMARY KEY,"
|
||||||
|
" pltype TEXT, "
|
||||||
|
" plmode INTEGER "
|
||||||
|
");"
|
||||||
|
"CREATE TABLE IF NOT EXISTS dynamic_playlist_controls ("
|
||||||
|
" id TEXT PRIMARY KEY,"
|
||||||
|
" playlist TEXT NOT NULL REFERENCES playlist(guid) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
|
||||||
|
" selectedType TEXT,"
|
||||||
|
" match TEXT,"
|
||||||
|
" input TEXT"
|
||||||
|
");"
|
||||||
|
""
|
||||||
|
"CREATE TABLE IF NOT EXISTS dynamic_playlist_revision ("
|
||||||
|
" guid TEXT PRIMARY KEY,"
|
||||||
|
" controls TEXT, "
|
||||||
|
" plmode INTEGER REFERENCES dynamic_playlist( plmode ) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
|
||||||
|
" pltype TEXT REFERENCES dynamic_playlist( pltype ) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED"
|
||||||
|
");"
|
||||||
"CREATE TABLE IF NOT EXISTS artist_search_index ("
|
"CREATE TABLE IF NOT EXISTS artist_search_index ("
|
||||||
" ngram TEXT NOT NULL,"
|
" ngram TEXT NOT NULL,"
|
||||||
" id INTEGER NOT NULL REFERENCES artist(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
|
" id INTEGER NOT NULL REFERENCES artist(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
|
||||||
|
@@ -15,6 +15,9 @@
|
|||||||
#include "database/databasecommand_collectionstats.h"
|
#include "database/databasecommand_collectionstats.h"
|
||||||
#include "database/databaseresolver.h"
|
#include "database/databaseresolver.h"
|
||||||
#include "sip/SipHandler.h"
|
#include "sip/SipHandler.h"
|
||||||
|
#include "dynamic/generatorfactory.h"
|
||||||
|
#include "dynamic/echonest/echonestgenerator.h"
|
||||||
|
#include "jabber/jabber.h"
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
#include "xmppbot/xmppbot.h"
|
#include "xmppbot/xmppbot.h"
|
||||||
#include "web/api_v1.h"
|
#include "web/api_v1.h"
|
||||||
@@ -215,6 +218,8 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
|||||||
m_mainwindow->showSettingsDialog();
|
m_mainwindow->showSettingsDialog();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GeneratorFactory::registerFactory( "echonest", new EchonestFactory );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -169,6 +169,7 @@ TomahawkWindow::setupSignals()
|
|||||||
connect( ui->actionRescanCollection, SIGNAL( triggered() ), SLOT( rescanCollectionManually() ) );
|
connect( ui->actionRescanCollection, SIGNAL( triggered() ), SLOT( rescanCollectionManually() ) );
|
||||||
connect( ui->actionLoadXSPF, SIGNAL( triggered() ), SLOT( loadSpiff() ));
|
connect( ui->actionLoadXSPF, SIGNAL( triggered() ), SLOT( loadSpiff() ));
|
||||||
connect( ui->actionCreatePlaylist, SIGNAL( triggered() ), SLOT( createPlaylist() ));
|
connect( ui->actionCreatePlaylist, SIGNAL( triggered() ), SLOT( createPlaylist() ));
|
||||||
|
connect( ui->actionCreateDynamicPlaylist, SIGNAL( triggered() ), SLOT( createDynamicPlaylist() ));
|
||||||
connect( ui->actionAboutTomahawk, SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) );
|
connect( ui->actionAboutTomahawk, SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) );
|
||||||
connect( ui->actionExit, SIGNAL( triggered() ), APP, SLOT( quit() ) );
|
connect( ui->actionExit, SIGNAL( triggered() ), APP, SLOT( quit() ) );
|
||||||
|
|
||||||
@@ -319,9 +320,15 @@ TomahawkWindow::loadSpiff()
|
|||||||
loader->load( url );
|
loader->load( url );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::createDynamicPlaylist()
|
||||||
|
{
|
||||||
|
createPlaylist( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::createPlaylist()
|
TomahawkWindow::createPlaylist( bool dynamic )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
@@ -334,6 +341,9 @@ TomahawkWindow::createPlaylist()
|
|||||||
QString id = uuid();
|
QString id = uuid();
|
||||||
QString info = ""; // FIXME
|
QString info = ""; // FIXME
|
||||||
QString creator = "someone"; // FIXME
|
QString creator = "someone"; // FIXME
|
||||||
|
if( dynamic )
|
||||||
|
DynamicPlaylist::create( author, id, name, info, creator, false );
|
||||||
|
else
|
||||||
Playlist::create( author, id, name, info, creator, false /* shared */ );
|
Playlist::create( author, id, name, info, creator, false /* shared */ );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,8 @@ protected:
|
|||||||
void closeEvent( QCloseEvent* e );
|
void closeEvent( QCloseEvent* e );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void createPlaylist();
|
void createDynamicPlaylist();
|
||||||
|
void createPlaylist( bool dynamic = false );
|
||||||
void loadSpiff();
|
void loadSpiff();
|
||||||
void showSettingsDialog();
|
void showSettingsDialog();
|
||||||
|
|
||||||
|
@@ -81,6 +81,7 @@
|
|||||||
<string>&Playlist</string>
|
<string>&Playlist</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionCreatePlaylist"/>
|
<addaction name="actionCreatePlaylist"/>
|
||||||
|
<addaction name="actionCreateDynamicPlaylist"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionLoadXSPF"/>
|
<addaction name="actionLoadXSPF"/>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -156,6 +157,11 @@
|
|||||||
<enum>QAction::AboutRole</enum>
|
<enum>QAction::AboutRole</enum>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionCreateDynamicPlaylist">
|
||||||
|
<property name="text">
|
||||||
|
<string>Create New &Dynamic Playlist</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
Reference in New Issue
Block a user