1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

bugfixing adding spotify account

This commit is contained in:
Leo Franchi
2012-05-16 22:49:29 -04:00
parent ff431b1183
commit 34656e6395
4 changed files with 22 additions and 10 deletions

View File

@@ -495,11 +495,6 @@ for plugin in VLC_PLUGINS:
for plugin in TOMAHAWK_PLUGINS:
FixPlugin(plugin, '../MacOS')
try:
FixPlugin('spotify_tomahawkresolver', '../MacOS')
except:
print 'Failed to find spotify resolver'
try:
FixPlugin('tomahawk_crash_reporter', '../MacOS')
except:

View File

@@ -27,6 +27,7 @@
#include "utils/TomahawkUtils.h"
#include "ActionCollection.h"
#include "Pipeline.h"
#include "accounts/AccountManager.h"
#ifndef ENABLE_HEADLESS
#include "jobview/JobStatusView.h"
@@ -86,6 +87,13 @@ SpotifyAccount::~SpotifyAccount()
void
SpotifyAccount::init()
{
if ( !AtticaManager::instance()->resolversLoaded() )
{
// If we're still waiting to load, wait for the attica resolvers to come down the pipe
connect( AtticaManager::instance(), SIGNAL( resolversLoaded( Attica::Content::List ) ), this, SLOT( init() ), Qt::UniqueConnection );
return;
}
qRegisterMetaType< Tomahawk::Accounts::SpotifyPlaylistInfo* >( "Tomahawk::Accounts::SpotifyPlaylist*" );
setAccountFriendlyName( "Spotify" );
@@ -122,6 +130,7 @@ SpotifyAccount::hookupResolver()
const AtticaManager::Resolver data = AtticaManager::instance()->resolverData( res.id() );
qDebug() << "Starting spotify resolver with path:" << data.scriptPath;
m_spotifyResolver = QWeakPointer< ScriptResolver >( qobject_cast< ScriptResolver* >( Pipeline::instance()->addScriptResolver( data.scriptPath, enabled() ) ) );
connect( m_spotifyResolver.data(), SIGNAL( changed() ), this, SLOT( resolverChanged() ) );
@@ -226,14 +235,20 @@ SpotifyAccount::connectionState() const
void
SpotifyAccount::resolverInstalled(const QString& resolverId)
{
if ( resolverId == s_resolverId )
{
// We requested this install, so we want to launch it
hookupResolver();
AccountManager::instance()->enableAccount( this );
}
}
void
SpotifyAccount::atticaLoaded( Attica::Content::List )
{
disconnect( AtticaManager::instance(), SIGNAL( resolversLoaded( Attica::Content::List ) ), this, SLOT( atticaLoaded( Attica::Content::List ) ) );
authenticate();
}

View File

@@ -115,8 +115,8 @@ private slots:
void startPlaylistSyncWithPlaylist( const QString& msgType, const QVariantMap& msg );
void playlistCreated( const QString& msgType, const QVariantMap& msg );
private:
void init();
private:
void hookupResolver();
bool checkForResolver();

View File

@@ -58,7 +58,7 @@ public:
public slots:
void installSucceeded( const QString& path )
{
qDebug() << Q_FUNC_INFO << "install of binary resolver succeeded, enabling";
qDebug() << Q_FUNC_INFO << "install of binary resolver succeeded, enabling: " << path;
if ( m_manager.isNull() )
return;
@@ -72,7 +72,9 @@ public slots:
Tomahawk::Accounts::AccountManager::instance()->enableAccount( acct );
}
m_manager.data()->m_resolverStates[ m_resolverId ].scriptPath = path;
m_manager.data()->m_resolverStates[ m_resolverId ].state = AtticaManager::Installed;
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_manager.data()->m_resolverStates );
emit m_manager.data()->resolverInstalled( m_resolverId );
emit m_manager.data()->resolverStateChanged( m_resolverId );
@@ -106,7 +108,7 @@ AtticaManager::AtticaManager( QObject* parent )
// resolvers
// m_manager.addProviderFile( QUrl( "http://bakery.tomahawk-player.org/resolvers/providers.xml" ) );
m_manager.addProviderFile( QUrl( "http://lycophron/resolvers/providers.xml" ) );
m_manager.addProviderFile( QUrl( "http://localhost/resolvers/providers.xml" ) );
qRegisterMetaType< Attica::Content >( "Attica::Content" );
}