Let hms use pipeable.input_many instead of go.
This commit is contained in:
parent
93605e2577
commit
f5e5db1908
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,8 @@
|
||||||
import math
|
import math
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from voussoirkit import pipeable
|
||||||
|
|
||||||
def hms_to_seconds(hms):
|
def hms_to_seconds(hms):
|
||||||
'''
|
'''
|
||||||
Convert hh:mm:ss string to an integer seconds.
|
Convert hh:mm:ss string to an integer seconds.
|
||||||
|
@ -37,8 +39,8 @@ def seconds_to_hms(seconds, force_minutes=False, force_hours=False):
|
||||||
return hms
|
return hms
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
from voussoirkit import pipeable
|
lines = pipeable.input_many(args, strip=True, skip_blank=True)
|
||||||
for line in pipeable.go(args, strip=True, skip_blank=True):
|
for line in lines:
|
||||||
if ':' in line:
|
if ':' in line:
|
||||||
line = hms_to_seconds(line)
|
line = hms_to_seconds(line)
|
||||||
else:
|
else:
|
||||||
|
@ -46,7 +48,7 @@ def main(args):
|
||||||
if line > 60:
|
if line > 60:
|
||||||
line = seconds_to_hms(line)
|
line = seconds_to_hms(line)
|
||||||
|
|
||||||
pipeable.stdout(f'{line}')
|
pipeable.stdout(line)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
raise SystemExit(main(sys.argv[1:]))
|
raise SystemExit(main(sys.argv[1:]))
|
||||||
|
|
Loading…
Reference in a new issue