diff --git a/classes/task/get_meeting_recordings.php b/classes/task/get_meeting_recordings.php index e8123e48..f50f0740 100644 --- a/classes/task/get_meeting_recordings.php +++ b/classes/task/get_meeting_recordings.php @@ -104,19 +104,26 @@ public function execute() { $zoomrecordings = $service->get_user_recordings($hostid, $from, $to); foreach ($zoomrecordings as $recordingid => $recording) { + 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...verifying current data.'); - if ($localrecordings[$recording->meetinguuid][$recordingid]->name != $meetings[$recording->meetingid]->name) { - $updatemeeting = $localrecordings[$recording->meetinguuid][$recordingid]; - $updatemeeting->name = $meetings[$recording->meetingid]->name; + $localrecording = $localrecordings[$recording->meetinguuid][$recordingid]; + + if ($localrecording->name !== $zoom->name) { + $updatemeeting = (object) [ + 'id' => $localrecording->id, + 'name' => $zoom->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; } @@ -130,7 +137,7 @@ public function execute() { } } - $zoom = $meetings[$recording->meetingid]; + $recordingtype = $recording->recordingtype; $record = new stdClass(); $record->zoomid = $zoom->id; @@ -139,7 +146,7 @@ public function execute() { $record->name = $zoom->name; $record->externalurl = $recording->url; $record->passcode = $meetingpasscodes[$recording->meetinguuid]; - $record->recordingtype = $recording->recordingtype; + $record->recordingtype = $recordingtype; $record->recordingstart = $recording->recordingstart; $record->showrecording = $zoom->recordings_visible_default; $record->timecreated = $now; 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/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',