[CI] fix a few lint errors
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d7a483f386
commit
e197117c0e
1 changed files with 15 additions and 10 deletions
23
timer.py
23
timer.py
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
"""
|
||||||
|
OBS countdown timer for OBS
|
||||||
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
@ -13,15 +17,16 @@ args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def write_countdown(filename, stimer):
|
def write_countdown(filename, stimer):
|
||||||
t = stimer
|
""" decrease counter anf write synchronously to dest file """
|
||||||
with open(filename, 'w') as f:
|
tsec = stimer
|
||||||
while t > 0:
|
with open(filename, 'w') as destfile:
|
||||||
t -= 1
|
while tsec > 0:
|
||||||
min, sec = divmod(t, 60)
|
tsec -= 1
|
||||||
print(f'{min:02d}:{sec:02d}')
|
minutes, sec = divmod(tsec, 60)
|
||||||
f.seek(0)
|
print(f'{minutes:02d}:{sec:02d}')
|
||||||
f.write(f'{min:02d}:{sec:02d}')
|
destfile.seek(0)
|
||||||
os.fsync(f)
|
destfile.write(f'{minutes:02d}:{sec:02d}')
|
||||||
|
os.fsync(destfile)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue