1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-14 13:01:53 +02:00

* Spit out error messages when we couldn't resolve a track, album or artist.

This commit is contained in:
Christian Muehlhaeuser 2012-06-26 05:02:28 +02:00
parent d0fdff760e
commit f303fcbebc
2 changed files with 41 additions and 11 deletions

View File

@ -37,6 +37,9 @@
#include "infosystem/InfoSystem.h"
#include "Album.h"
#include "Pipeline.h"
#include "jobview/JobStatusView.h"
#include "jobview/JobStatusModel.h"
#include "jobview/ErrorStatusMessage.h"
#include "utils/Logger.h"
@ -94,12 +97,9 @@ AudioEngine::AudioEngine()
AudioEngine::~AudioEngine()
{
tDebug() << Q_FUNC_INFO;
m_mediaObject->stop();
TomahawkSettings::instance()->setVolume( volume() );
delete m_audioOutput;
delete m_mediaObject;
}
@ -604,8 +604,20 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
{
if ( query->resolvingFinished() )
{
if ( query->numResults() )
playItem( playlist, query->results().first() );
foreach ( const result_ptr& result, query->results() )
{
if ( result->isOnline() )
{
playItem( playlist, result );
return;
}
}
JobStatusView::instance()->model()->addJob(
new ErrorStatusMessage( tr( "Sorry, Tomahawk couldn't find the track '%1' by %2" ).arg( query->track() ).arg( query->artist() ), 15 ) );
if ( isStopped() )
emit stopped(); // we do this so the original caller knows we couldn't find this track
}
else
{
@ -621,9 +633,18 @@ void
AudioEngine::playItem( const Tomahawk::artist_ptr& artist )
{
playlistinterface_ptr pli = artist->playlistInterface( Mixed );
if ( pli->trackCount() )
if ( pli->isFinished() )
{
playItem( pli, pli->tracks().first() );
if ( !pli->tracks().count() )
{
JobStatusView::instance()->model()->addJob(
new ErrorStatusMessage( tr( "Sorry, Tomahawk couldn't find the artist '%1'" ).arg( artist->name() ), 15 ) );
if ( isStopped() )
emit stopped(); // we do this so the original caller knows we couldn't find this track
}
else
playItem( pli, pli->tracks().first() );
}
else
{
@ -638,9 +659,18 @@ void
AudioEngine::playItem( const Tomahawk::album_ptr& album )
{
playlistinterface_ptr pli = album->playlistInterface( Mixed );
if ( pli->trackCount() )
if ( pli->isFinished() )
{
playItem( pli, pli->tracks().first() );
if ( !pli->tracks().count() )
{
JobStatusView::instance()->model()->addJob(
new ErrorStatusMessage( tr( "Sorry, Tomahawk couldn't find the album '%1' by %2" ).arg( album->name() ).arg( album->artist()->name() ), 15 ) );
if ( isStopped() )
emit stopped(); // we do this so the original caller knows we couldn't find this track
}
else
playItem( pli, pli->tracks().first() );
}
else
{

View File

@ -138,7 +138,7 @@ private slots:
void sendNowPlayingNotification( const Tomahawk::InfoSystem::InfoType type );
void sendWaitingNotification() const;
void queueStateSafety();
private: