diff --git a/classes/task/get_meeting_recordings.php b/classes/task/get_meeting_recordings.php index 05dcd5c8..615479e2 100644 --- a/classes/task/get_meeting_recordings.php +++ b/classes/task/get_meeting_recordings.php @@ -76,28 +76,6 @@ public function execute() { mtrace('Finding meeting recordings for this account...'); - $recordingtypestrings = [ - 'active_speaker' => get_string('recordingtype_active_speaker', 'mod_zoom'), - 'audio_interpretation' => get_string('recordingtype_audio_interpretation', 'mod_zoom'), - 'audio_only' => get_string('recordingtype_audio_only', 'mod_zoom'), - 'audio_transcript' => get_string('recordingtype_audio_transcript', 'mod_zoom'), - 'chat_file' => get_string('recordingtype_chat', 'mod_zoom'), - 'closed_caption' => get_string('recordingtype_closed_caption', 'mod_zoom'), - 'gallery_view' => get_string('recordingtype_gallery', 'mod_zoom'), - 'poll' => get_string('recordingtype_poll', 'mod_zoom'), - 'production_studio' => get_string('recordingtype_production_studio', 'mod_zoom'), - 'shared_screen' => get_string('recordingtype_shared', 'mod_zoom'), - 'shared_screen_with_gallery_view' => get_string('recordingtype_shared_gallery', 'mod_zoom'), - 'shared_screen_with_speaker_view' => get_string('recordingtype_shared_speaker', 'mod_zoom'), - 'shared_screen_with_speaker_view(CC)' => get_string('recordingtype_shared_speaker_cc', 'mod_zoom'), - 'sign_interpretation' => get_string('recordingtype_sign', 'mod_zoom'), - 'speaker_view' => get_string('recordingtype_speaker', 'mod_zoom'), - 'summary' => get_string('recordingtype_summary', 'mod_zoom'), - 'summary_next_steps' => get_string('recordingtype_summary_next_steps', 'mod_zoom'), - 'summary_smart_chapters' => get_string('recordingtype_summary_smart_chapters', 'mod_zoom'), - 'timeline' => get_string('recordingtype_timeline', 'mod_zoom'), - ]; - $localmeetings = zoom_get_all_meeting_records(); $now = time(); @@ -126,22 +104,19 @@ public function execute() { $zoomrecordings = $service->get_user_recordings($hostid, $from, $to); foreach ($zoomrecordings as $recordingid => $recording) { - if (isset($localrecordings[$recording->meetinguuid][$recordingid])) { - mtrace('Recording id: ' . $recordingid . ' exists...verifying current data.'); - if ($localrecordings[$recording->meetinguuid][$recordingid]->name != $meetings[$recording->meetingid]->name) { - $updatemeeting = $localrecordings[$recording->meetinguuid][$recordingid]; - $updatemeeting->name = $meetings[$recording->meetingid]->name; - $DB->update_record('zoom_meeting_recordings', $updatemeeting); - } - continue; - } - if (empty($meetings[$recording->meetingid])) { // Skip meetings that are not in Moodle. mtrace('Meeting id: ' . $recording->meetingid . ' does not exist...skipping'); continue; } + $zoom = $meetings[$recording->meetingid]; + + if (isset($localrecordings[$recording->meetinguuid][$recordingid])) { + mtrace('Recording id: ' . $recordingid . ' exists...skipping'); + continue; + } + // As of 2023-09-24, 'password' is not present in the user recordings API response. if (empty($meetingpasscodes[$recording->meetinguuid])) { try { @@ -152,10 +127,7 @@ public function execute() { } } - $zoom = $meetings[$recording->meetingid]; - $recordingtype = $recording->recordingtype; - $recordingtypestring = $recordingtypestrings[$recordingtype]; $record = new stdClass(); $record->zoomid = $zoom->id; diff --git a/classes/webservice.php b/classes/webservice.php index 0a5f3e07..1f22008c 100644 --- a/classes/webservice.php +++ b/classes/webservice.php @@ -1005,11 +1005,12 @@ public function get_recording_url_list($meetingid) { if (!empty($response->recording_files)) { foreach ($response->recording_files as $recording) { - if (!empty($recording->play_url) && isset($allowedrecordingtypes[$recording->file_type])) { + $url = $recording->play_url ?? $recording->download_url ?? null; + if (!empty($url) && isset($allowedrecordingtypes[$recording->file_type])) { $recordinginfo = new stdClass(); $recordinginfo->recordingid = $recording->id; $recordinginfo->meetinguuid = $response->uuid; - $recordinginfo->url = $recording->play_url; + $recordinginfo->url = $url; $recordinginfo->filetype = $recording->file_type; $recordinginfo->recordingtype = $recording->recording_type; $recordinginfo->passcode = $response->password; @@ -1062,7 +1063,7 @@ public function get_user_recordings($userid, $from, $to) { $recordinginfo->recordingid = $recording->id; $recordinginfo->meetingid = $meeting->id; $recordinginfo->meetinguuid = $meeting->uuid; - $recordinginfo->url = $recording->play_url; + $recordinginfo->url = $url; $recordinginfo->filetype = $recording->file_type; $recordinginfo->recordingtype = $recording->recording_type; $recordinginfo->recordingstart = strtotime($recording->recording_start); diff --git a/db/upgrade.php b/db/upgrade.php index 49b08626..39f69569 100755 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -965,5 +965,22 @@ function xmldb_zoom_upgrade($oldversion) { upgrade_mod_savepoint(true, 2024030100, 'zoom'); } + if ($oldversion < 2024030101) { + + // Update existing recording names to default for translatable recordingtype strings. + $meetings = $DB->get_records('zoom'); + + foreach ($meetings as $meeting) { + var_dump($meeting); + $value = $meeting->name; + $select = "zoomid = ". $meeting->id; + + $DB->set_field_select('zoom_meeting_recordings', 'name', $value, $select); + } + + // Zoom savepoint reached. + upgrade_mod_savepoint(true, 2024030101, 'zoom'); + } + return true; } diff --git a/recordings.php b/recordings.php index e1d20acb..98d1bacd 100644 --- a/recordings.php +++ b/recordings.php @@ -136,6 +136,13 @@ } } +/** + * Get the display name for a Zoom recording type. + * + * @package mod_zoom + * @param string $recordingtype Zoom recording type. + * @return string + */ function zoom_get_recording_type_string($recordingtype) { $recordingtypestringmap = [ 'active_speaker' => 'recordingtype_active_speaker',