mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-01-17 14:28:24 +01:00
Wait for the first playable track when starting playback of a PlaylistInterface.
This commit is contained in:
parent
cf7ce9aa0e
commit
7c3d7303a3
@ -952,7 +952,7 @@ AudioEngine::playItem( const Tomahawk::artist_ptr& artist )
|
||||
emit stopped(); // we do this so the original caller knows we couldn't find this track
|
||||
}
|
||||
else
|
||||
playItem( pli, pli->tracks().first() );
|
||||
playPlaylistInterface( pli );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -978,7 +978,7 @@ AudioEngine::playItem( const Tomahawk::album_ptr& album )
|
||||
emit stopped(); // we do this so the original caller knows we couldn't find this track
|
||||
}
|
||||
else
|
||||
playItem( pli, pli->tracks().first() );
|
||||
playPlaylistInterface( pli );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -989,6 +989,30 @@ AudioEngine::playItem( const Tomahawk::album_ptr& album )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::playPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlist )
|
||||
{
|
||||
if ( !playlist->hasFirstPlayableTrack() )
|
||||
{
|
||||
NewClosure( playlist.data(), SIGNAL( foundFirstPlayableTrack() ),
|
||||
const_cast<AudioEngine*>(this), SLOT( playPlaylistInterface( Tomahawk::playlistinterface_ptr ) ), playlist );
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( const Tomahawk::query_ptr& query, playlist->tracks() )
|
||||
{
|
||||
if ( query->playable() )
|
||||
{
|
||||
playItem( playlist, query );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// No playable track found
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Sorry, couldn't find any playable tracks" ), 15 ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::onPlaylistNextTrackAvailable()
|
||||
{
|
||||
|
@ -138,6 +138,7 @@ public slots:
|
||||
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query );
|
||||
void playItem( const Tomahawk::artist_ptr& artist );
|
||||
void playItem( const Tomahawk::album_ptr& album );
|
||||
void playPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlist );
|
||||
void setPlaylist( Tomahawk::playlistinterface_ptr playlist );
|
||||
void setQueue( const Tomahawk::playlistinterface_ptr& queue );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user