@@ -324,6 +324,12 @@ def _on_track_start(self, bus: Any, message: Any):
324324 self .seek (self .seek_after_sink_reload )
325325 self .seek_after_sink_reload = None
326326
327+ self .can_go_prev = len (self .played_songs ) > 0
328+ # Only notify to deactivate
329+ if not self .can_go_prev :
330+ self .notify ("can-go-prev" )
331+ GLib .timeout_add (2000 , self .previous_timer_callback )
332+
327333 def play_this (
328334 self , thing : Union [Mix , Album , Playlist , List [Track ], Track ], index : int = 0
329335 ) -> None :
@@ -594,6 +600,11 @@ def play_previous(self):
594600 # if not in the first 2 seconds of the track restart song
595601 if self .query_position () > 2 * Gst .SECOND :
596602 self .seek (0 )
603+ self .can_go_prev = len (self .played_songs ) > 0
604+ # only notify when can't go to previous
605+ if not self .can_go_prev :
606+ self .notify ("can-go-prev" )
607+ GLib .timeout_add (2000 , self .previous_timer_callback )
597608 return
598609
599610 if not self .played_songs :
@@ -605,6 +616,11 @@ def play_previous(self):
605616 self ._tracks_to_play .insert (0 , self .playing_track )
606617 self .play_track (track )
607618
619+ def previous_timer_callback (self ):
620+ """Send a notify Event after 2s of the song playing"""
621+ self .can_go_prev = True
622+ self .notify ("can-go-prev" )
623+
608624 def _update_shuffle_queue (self ):
609625 if self .shuffle :
610626 self ._shuffled_tracks_to_play = self ._tracks_to_play .copy ()
0 commit comments