Skip to content

Commit

Permalink
Get the main user in a better way
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr0grog committed Aug 29, 2024
1 parent 754ba7a commit 24cc9f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion scripts/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
'corp': 3,
}

ZOOM_ROLES = {
'owner': 0,
'admin': 1,
'member': 2,
}

VIDEO_CATEGORY_IDS = {
'Film & Animation': 1,
'Autos & Vehicles': 2,
Expand Down Expand Up @@ -36,4 +42,4 @@
'Shorts': 42,
'Shows': 43,
'Trailers': 44,
}
}
7 changes: 3 additions & 4 deletions scripts/upload_zoom_recordings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from typing import Dict
from urllib.parse import urlparse
from zoomus import ZoomClient
from lib.constants import USER_TYPES, VIDEO_CATEGORY_IDS
from lib.constants import VIDEO_CATEGORY_IDS, ZOOM_ROLES
from lib.youtube import get_youtube_client, upload_video, add_video_to_playlist, validate_youtube_credentials

YOUTUBE_CREDENTIALS_PATH = '.youtube-upload-credentials.json'
Expand Down Expand Up @@ -175,9 +175,8 @@ def main():

zoom = ZoomClient(ZOOM_CLIENT_ID, ZOOM_CLIENT_SECRET, ZOOM_ACCOUNT_ID)

# Get main account, which should be 'pro'
zoom_user_id = next(user['id'] for user in zoom.user.list().json()['users']
if user['type'] >= USER_TYPES['pro'])
# Official meeting recordings we will upload belong to the account owner.
zoom_user_id = zoom.user.list(role_id=ZOOM_ROLES['owner']).json()['users'][0]['id']

with tempfile.TemporaryDirectory() as tmpdirname:
print(f'Creating tmp dir: {tmpdirname}\n')
Expand Down

0 comments on commit 24cc9f9

Please sign in to comment.