Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix whisper-fetch.py --drop timestamps #306

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions bin/whisper-fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@
except (whisper.WhisperException, IOError) as exc:
raise SystemExit('[ERROR] %s' % str(exc))

if options.drop:
fcn = _DROP_FUNCTIONS.get(options.drop)
values = [x for x in values if fcn(x)]
keep = _DROP_FUNCTIONS.get(options.drop, lambda x: True)

(start, end, step) = timeInfo

if options.json:
if options.drop is not None:
values = [x for x in values if keep(x)]
values_json = str(values).replace('None', 'null')
print('''{
"start" : %d,
Expand All @@ -82,6 +82,11 @@

t = start
for value in values:
if options.drop is not None:
if not keep(value):
t += step
continue

if options.pretty:
if options.time_format:
timestr = time.strftime(options.time_format, time.localtime(t))
Expand Down