improve decoding file switchover

This commit is contained in:
Jakob Ketterl 2021-05-02 00:06:50 +02:00
parent 0fa8774493
commit 290f67735d
1 changed files with 3 additions and 1 deletions

View File

@ -56,7 +56,9 @@ class AudioWriter(object):
return WaveFile(filename)
def getNextDecodingTime(self):
t = datetime.utcnow()
# add one second to have the intervals tick over one second earlier
# this avoids filename collisions, but also avoids decoding wave files with less than one second of audio
t = datetime.utcnow() + timedelta(seconds=1)
zeroed = t.replace(minute=0, second=0, microsecond=0)
delta = t - zeroed
seconds = (int(delta.total_seconds() / self.interval) + 1) * self.interval