1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-11 08:34:34 +02:00

Hopefully fix infinite loop caused by requesting a cover when the cache has issues and/or can't find the cover.

This commit is contained in:
Alejandro Wainzinger
2011-08-21 11:57:23 -07:00
parent 48aeddc0a9
commit 573e36fdfd

View File

@@ -493,7 +493,7 @@ MprisPlugin::audioStarted( const QVariant &input )
return; return;
m_playbackStatus = "Playing"; m_playbackStatus = "Playing";
//notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata"); notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata");
//hash["artist"]; //hash["artist"];
//hash["title"]; //hash["title"];
@@ -576,15 +576,16 @@ MprisPlugin::onTrackCountChanged( unsigned int tracks )
void void
MprisPlugin::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ) MprisPlugin::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{ {
// If the caller for the request was not us, or not the type of info we are seeking, ignore it
if ( requestData.caller != s_mpInfoIdentifier || requestData.type != Tomahawk::InfoSystem::InfoAlbumCoverArt ) if ( requestData.caller != s_mpInfoIdentifier || requestData.type != Tomahawk::InfoSystem::InfoAlbumCoverArt )
{ {
notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata" ); //notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata" );
return; return;
} }
if ( !output.canConvert< QVariantMap >() ) if ( !output.canConvert< QVariantMap >() )
{ {
notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata" ); //notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata" );
tDebug( LOGINFO ) << "Cannot convert fetched art from a QByteArray"; tDebug( LOGINFO ) << "Cannot convert fetched art from a QByteArray";
return; return;
} }
@@ -623,11 +624,16 @@ MprisPlugin::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData,
{ {
qDebug() << Q_FUNC_INFO << "Image saving successful, notifying"; qDebug() << Q_FUNC_INFO << "Image saving successful, notifying";
qDebug() << "Saving to: " << QFileInfo( *m_coverTempFile ).absoluteFilePath(); qDebug() << "Saving to: " << QFileInfo( *m_coverTempFile ).absoluteFilePath();
m_coverTempFile->close();
notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata" );
} }
else else
{
qDebug() << Q_FUNC_INFO << " failed to save image!"; qDebug() << Q_FUNC_INFO << " failed to save image!";
m_coverTempFile->close(); m_coverTempFile->close();
}
/* /*
if( m_coverTempFile->open() ) if( m_coverTempFile->open() )
@@ -639,8 +645,6 @@ MprisPlugin::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData,
} }
*/ */
} }
notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata" );
} }