cdp-backend icon indicating copy to clipboard operation
cdp-backend copied to clipboard

Allow audio files to be processed as events

Open isaacna opened this issue 3 years ago • 5 comments

Describe the Bug

Not sure if I should count this as a feature or bug, but currently, if the file passed to get_static_thumbnail has no fetchable thumbnail (a .wav audio file), the method and event gather pipeline will error out with

[ERROR: runner:  66 2021-08-16 00:06:27,588] Unexpected error: ValueError('Could not find a format to read the specified file in any-mode mode')
Traceback (most recent call last):
  File "/Users/Isaac/.pyenv/versions/3.7.9/lib/python3.7/site-packages/prefect/engine/runner.py", line 48, in inner
    new_state = method(self, state, *args, **kwargs)
  File "/Users/Isaac/.pyenv/versions/3.7.9/lib/python3.7/site-packages/prefect/engine/task_runner.py", line 860, in get_task_run_state
    logger=self.logger,
  File "/Users/Isaac/.pyenv/versions/3.7.9/lib/python3.7/site-packages/prefect/utilities/executors.py", line 298, in run_task_with_timeout
    return task.run(*args, **kwargs)  # type: ignore
  File "/Users/Isaac/Desktop/cdp-backend/cdp_backend/pipeline/event_gather_pipeline.py", line 747, in get_video_and_generate_thumbnails
    tmp_video_path, session_content_hash
  File "/Users/Isaac/Desktop/cdp-backend/cdp_backend/utils/file_utils.py", line 208, in get_static_thumbnail
    reader = imageio.get_reader(video_path)
  File "/Users/Isaac/.pyenv/versions/3.7.9/lib/python3.7/site-packages/imageio/core/functions.py", line 182, in get_reader
    "Could not find a format to read the specified file in %s mode" % modename
ValueError: Could not find a format to read the specified file in any-mode mode

I think to generalize the event gather as much as possible, we should account for events that are just audio files (in addition to video files). This may require some minor refactoring in the pipeline as well if we want to avoid redundancy with the audio splitters.

Expected Behavior

Allow events that are just audio to be processed in the event gather pipeline.

Reproduction

Run an event gather flow with the event linked to a URI of audio instead of video

isaacna avatar Aug 16 '21 07:08 isaacna