@@ -887,8 +887,8 @@ impl SpircTask {
887887 let tracks_len = self . state . get_track ( ) . len ( ) as u32 ;
888888 debug ! (
889889 "At track {:?} of {:?} <{:?}> update [{}]" ,
890- new_index,
891- self . state . get_track ( ) . len ( ) ,
890+ new_index + 1 ,
891+ tracks_len ,
892892 self . state. get_context_uri( ) ,
893893 tracks_len - new_index < CONTEXT_FETCH_THRESHOLD
894894 ) ;
@@ -902,27 +902,25 @@ impl SpircTask {
902902 self . context_fut = self . resolve_station ( & context_uri) ;
903903 self . update_tracks_from_context ( ) ;
904904 }
905- let last_track = new_index == tracks_len - 1 ;
906- if self . config . autoplay && last_track {
907- // Extend the playlist
908- // Note: This doesn't seem to reflect in the UI
909- // the additional tracks in the frame don't show up as with station view
910- debug ! ( "Extending playlist <{}>" , context_uri) ;
911- self . update_tracks_from_context ( ) ;
912- }
913905 if new_index >= tracks_len {
914- new_index = 0 ; // Loop around back to start
915- continue_playing = self . state . get_repeat ( ) ;
906+ if self . config . autoplay {
907+ // Extend the playlist
908+ debug ! ( "Extending playlist <{}>" , context_uri) ;
909+ self . update_tracks_from_context ( ) ;
910+ self . player . set_auto_normalise_as_album ( false ) ;
911+ } else {
912+ new_index = 0 ;
913+ continue_playing = self . state . get_repeat ( ) ;
914+ debug ! (
915+ "Looping around back to start, repeat is {}" ,
916+ continue_playing
917+ ) ;
918+ }
916919 }
917920
918921 if tracks_len > 0 {
919922 self . state . set_playing_track_index ( new_index) ;
920923 self . load_track ( continue_playing, 0 ) ;
921- if self . config . autoplay && last_track {
922- // If we're now playing the last track of an album, then
923- // switch to track normalisation mode for the autoplay to come.
924- self . player . set_auto_normalise_as_album ( false ) ;
925- }
926924 } else {
927925 info ! ( "Not playing next track because there are no more tracks left in queue." ) ;
928926 self . state . set_playing_track_index ( 0 ) ;
0 commit comments