Skip to content

Commit

Permalink
Handle still-running meetings (#78)
Browse files Browse the repository at this point in the history
Correctly skip meetings that are still ongoing or where the recordings are still being processed.

Also fixes a typo in the `ZoomError` constructor.
  • Loading branch information
Mr0grog authored Nov 15, 2024
1 parent e7fef15 commit dce1ab5
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/upload_zoom_recordings.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(self, response, message=None):

data['http_status'] = response.status_code
full_message = f'{message} ({data!r}) Check the docs for details: https://developers.zoom.us/docs/api/.'
super.__init__(full_message)
super().__init__(full_message)

@classmethod
def is_error(cls, response):
Expand Down Expand Up @@ -138,6 +138,16 @@ def meeting_had_no_participants(client: ZoomClient, meeting: Dict) -> bool:
)


def recording_status(meeting: Dict) -> str:
for file in meeting['recording_files']:
if file['recording_end'] == '':
return 'ongoing'
elif file['status'] != 'completed':
return 'processing'

return 'ready'


def video_has_audio(file_path: str) -> bool:
"""Detect whether a video file has a non-silent audio track."""
result = subprocess.run([
Expand Down Expand Up @@ -193,6 +203,11 @@ def main():
print(' Skipping: meeting not in topic list.')
continue

status = recording_status(meeting)
if status != 'ready':
print(f' Skipping: recording is still {status}.')
continue

if meeting_had_no_participants(zoom, meeting):
print(' Deleting recording: nobody attended this meeting.')
if not DRY_RUN:
Expand Down

0 comments on commit dce1ab5

Please sign in to comment.