Commit 481943b0 authored by Stan Hu's avatar Stan Hu

Add topic to folder

parent b3afa6d8
......@@ -224,7 +224,8 @@ class ZoomSyncher
puts "Scanning recordings for #{user['email']}"
client.recordings(user_id: host_id, from: start_date, to: end_date).each do |recording|
sync_recording(recording)
username = user['email'].gsub('@gitlab.com', '')
sync_recording(recording, username)
end
# Zoom rate limits API requests, so pause between users
......@@ -233,7 +234,7 @@ class ZoomSyncher
end
end
def sync_recording(item)
def sync_recording(item, prefix)
unless item['topic'].match(REC_REGEX)
puts "Skipping '#{item['topic']}' as it doesn't include [REC]"
return
......@@ -261,7 +262,7 @@ class ZoomSyncher
end
ext = file_extension(file_type)
folder = subfolder(topic, file_type)
folder = subfolder(prefix, topic, file_type)
filename = sanitize_filename("#{topic}-#{event_date}-#{uuid}-#{index}") + ".#{ext}"
video_url = file['download_url'] + "?access_token=#{client.access_token}"
file_size = file['file_size']
......@@ -349,10 +350,11 @@ class ZoomSyncher
end
end
def subfolder(topic, file_type)
return [topic, 'audio'] if file_type.casecmp('m4a').zero?
def subfolder(prefix, topic, file_type)
base_name = "#{prefix}-#{topic}"
return [base_name, 'audio'] if file_type.casecmp('m4a').zero?
[topic]
[base_name]
end
def file_extension(file_type)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment