Answer the question
In order to leave comments, you need to log in
How to insert a pause in the execution of a python script?
There is a Linux player Rhythmbox and a plug-in for it - Remember the rhythm, which records the time the song is played in dconf, and if the player is closed, it allows playback to be restored from that time.
The problem is that it writes every second, if not more, which is why dconf-service eats up more than two percent of the processor. After reading the code, I did not see a key there that determines the frequency of recording. Is there such a key there or is it possible to add it there, even if only by roughly pausing the execution of the entire script?
Script text: https://github.com/owais/remember-the-rhythm/blob/...
Answer the question
In order to leave comments, you need to log in
After reading the code, I did not see a key there that determines the frequency of recording. Is there such a key there or is it possible to add it there, even if only by roughly pausing the execution of the entire script?
def do_activate ...
self.shell_player.connect('elapsed-changed', self.elapsed_changed)
def elapsed_changed(self, player, entry, data=None):
try:
pb_time = self.shell_player.get_playing_time()[1]
if pb_time % 5 == 0:
self.playback_time = self.shell_player.get_playing_time()[1]
except:
pass
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question