mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Wait for the first playable track when starting playback of a PlaylistInterface.
This commit is contained in:
@@ -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
|
emit stopped(); // we do this so the original caller knows we couldn't find this track
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
playItem( pli, pli->tracks().first() );
|
playPlaylistInterface( pli );
|
||||||
}
|
}
|
||||||
else
|
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
|
emit stopped(); // we do this so the original caller knows we couldn't find this track
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
playItem( pli, pli->tracks().first() );
|
playPlaylistInterface( pli );
|
||||||
}
|
}
|
||||||
else
|
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
|
void
|
||||||
AudioEngine::onPlaylistNextTrackAvailable()
|
AudioEngine::onPlaylistNextTrackAvailable()
|
||||||
{
|
{
|
||||||
|
@@ -138,6 +138,7 @@ public slots:
|
|||||||
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query );
|
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query );
|
||||||
void playItem( const Tomahawk::artist_ptr& artist );
|
void playItem( const Tomahawk::artist_ptr& artist );
|
||||||
void playItem( const Tomahawk::album_ptr& album );
|
void playItem( const Tomahawk::album_ptr& album );
|
||||||
|
void playPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlist );
|
||||||
void setPlaylist( Tomahawk::playlistinterface_ptr playlist );
|
void setPlaylist( Tomahawk::playlistinterface_ptr playlist );
|
||||||
void setQueue( const Tomahawk::playlistinterface_ptr& queue );
|
void setQueue( const Tomahawk::playlistinterface_ptr& queue );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user