I have a script that calculates a variable every second (my program reads the output of the script bash and interprets the data every second). Is there a way to detect if this var has changed?
Here is part of my code, the text is ffmpeg or avconv output read from vte terminal:
def terminal(self):
self.v = vte.Terminal()
self.v.connect ("child-exited", lambda term: self.verif(self, my_class))
self.v.connect('contents-changed', self.term_output)
[...]
def term_output(self, my_class, donnees=None):
text = str(self.v.get_text(lambda *a: True).rstrip())
[...]
print "time", self.time
print "duration", self.duration
Return in vte terminal (avconv output):
Duration: 00:00:23.00, start: 0.100511, bitrate: 0 kb/s
Output #0, matroska, to '/media/guillaume/XT/Telechargements/uzz/la_qualite_de_l_air_1000019643.mkv':
Press [q] to stop, [?] for help
frame= 589 fps=115 q=-1.0 Lsize= 2191kB time=00:00:23.79 bitrate= 754.3kbits/s
FIN DU TRAITEMENT
Votre Fichier Final Est:
/media/guillaume/XT/Telechargements/uzz/la_qualite_de_l_air_1000019643.mkv
Output example (vte output time and duration):
time 5.1
duration 23.0
time 6.1
duration 23.0
time 9.1
duration 23.0
time 14.1
duration 23.0
time 14.1
duration 23.0
time 16.1
duration 23.0
time 18.1
duration 23.0
time 19.1
duration 23.0
time 21.1
duration 23.0
time 23.1
duration 23.0
time 23.1
duration 23.0
time 23.1
duration 23.0
time 23.1
duration 23.0
time 23.1
duration 3960.0 # detect this change? (correspond to a second output of avconv)
time 1.1
duration 3960.0
time 7.1
duration 3960.0
time 10.1
duration 3960.0
time 20.1
duration 3960.0
time 20.1
duration 3960.0
source
share