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

Configs for user/topic filters and folder/file format #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.venv
.venv
config.py
__pycache__
.DS_Store
.vscode
10 changes: 8 additions & 2 deletions config_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@

# Date range (inclusive) for downloads, None value for Days gets replaced by first/last day of the month.
START_DAY, START_MONTH, START_YEAR = None, 5, 2020
END_DAY, END_MONTH, END_YEAR = None , 3, 2022
END_DAY, END_MONTH, END_YEAR = None, 3, 2022
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls revert the added spaces


# Put here emails of the users you want to check for recordings. If empty, all users under the account will be checked.
USERS = [
USERS_INCLUDE = [
# R"####@####.####",
# R"####@####.####",
]

# Put here emails of the users you want to exclude from checking for recordings. Optional.
USERS_EXCLUDE = [
# R"####@####.####",
# R"####@####.####",
]
Comment on lines -14 to 23
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here isn't clear to me from the docs, What gets precedence?

Expand Down
40 changes: 28 additions & 12 deletions zoom_batch_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ def print_filter_warnings():
if CONFIG.TOPICS:
utils.print_bright(f'Topics filter is active {CONFIG.TOPICS}')
did_print = True
if CONFIG.USERS:
utils.print_bright(f'Users filter is active {CONFIG.USERS}')
if CONFIG.USERS_INCLUDE:
utils.print_bright(f'Users include filter is active {CONFIG.USERS_INCLUDE}')
did_print = True
if CONFIG.USERS_EXCLUDE:
utils.print_bright(f'Users exclude filter is active {CONFIG.USERS_EXCLUDE}')
did_print = True
if CONFIG.RECORDING_FILE_TYPES:
utils.print_bright(f'Recording file types filter is active {CONFIG.RECORDING_FILE_TYPES}')
Expand All @@ -49,16 +52,29 @@ def print_filter_warnings():
print()

def get_users():
if CONFIG.USERS:
return [(email, '') for email in CONFIG.USERS]

return paginate_reduce(
'https://api.zoom.us/v2/users?status=active', [],
lambda users, page: users + [(user['email'], get_user_name(user)) for user in page['users']]
) + paginate_reduce(
'https://api.zoom.us/v2/users?status=inactive', [],
lambda users, page: users + [(user['email'], get_user_name(user)) for user in page['users']]
)
if CONFIG.USERS_INCLUDE:
users = [(email, '') for email in CONFIG.USERS_INCLUDE]
else:
users = paginate_reduce(
'https://api.zoom.us/v2/users?status=active', [],
lambda users, page: users + [(user['email'], get_user_name(user)) for user in page['users']]
) + paginate_reduce(
'https://api.zoom.us/v2/users?status=inactive', [],
lambda users, page: users + [(user['email'], get_user_name(user)) for user in page['users']]
)

if CONFIG.VERBOSE_OUTPUT:
utils.print_dim('Found matching users:')

for user_email, user_name in users:
if user_email in CONFIG.USERS_EXCLUDE:
users.pop(users.index((user_email, user_name)))
continue

if CONFIG.VERBOSE_OUTPUT:
utils.print_dim(f'{user_name} <{user_email}>')
Comment on lines +69 to +78
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just run a filter on the list, then print it as is


return users

def paginate_reduce(url, initial, reduce):
initial_url = utils.add_url_params(url, {'page_size': 300})
Expand Down