Skip to content

Commit

Permalink
Merge pull request ncstate-delta#578 from ncstate-delta/bug/different…
Browse files Browse the repository at this point in the history
…iate_recording_versions

Bug/differentiate recording versions
  • Loading branch information
jrchamp authored Apr 22, 2024
2 parents 5f7a1ce + fea6409 commit 0e35c56
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 18 deletions.
18 changes: 10 additions & 8 deletions classes/task/get_meeting_recordings.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ public function execute() {

mtrace('Finding meeting recordings for this account...');

$recordingtypestrings = [
'audio' => get_string('recordingtypeaudio', 'mod_zoom'),
'video' => get_string('recordingtypevideo', 'mod_zoom'),
];

$localmeetings = zoom_get_all_meeting_records();

$now = time();
Expand Down Expand Up @@ -111,6 +106,15 @@ public function execute() {
foreach ($zoomrecordings as $recordingid => $recording) {
if (isset($localrecordings[$recording->meetinguuid][$recordingid])) {
mtrace('Recording id: ' . $recordingid . ' exists...skipping');
$localrecording = $localrecordings[$recording->meetinguuid][$recordingid];

if ($localrecording->recordingtype !== $recording->recordingtype) {
$updatemeeting = (object) [
'id' => $localrecording->id,
'recordingtype' => $recording->recordingtype,
];
$DB->update_record('zoom_meeting_recordings', $updatemeeting);
}
continue;
}

Expand All @@ -131,15 +135,13 @@ public function execute() {
}

$zoom = $meetings[$recording->meetingid];

$recordingtype = $recording->recordingtype;
$recordingtypestring = $recordingtypestrings[$recordingtype];

$record = new stdClass();
$record->zoomid = $zoom->id;
$record->meetinguuid = $recording->meetinguuid;
$record->zoomrecordingid = $recordingid;
$record->name = trim($zoom->name) . ' (' . $recordingtypestring . ')';
$record->name = $zoom->name;
$record->externalurl = $recording->url;
$record->passcode = $meetingpasscodes[$recording->meetinguuid];
$record->recordingtype = $recordingtype;
Expand Down
20 changes: 14 additions & 6 deletions classes/webservice.php
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,9 @@ public function get_recording_url_list($meetingid) {
$allowedrecordingtypes = [
'MP4' => 'video',
'M4A' => 'audio',
'TRANSCRIPT' => 'transcript',
'CHAT' => 'chat',
'CC' => 'captions',
];

try {
Expand All @@ -1002,13 +1005,14 @@ 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 = $allowedrecordingtypes[$recording->file_type];
$recordinginfo->recordingtype = $recording->recording_type;
$recordinginfo->passcode = $response->password;
$recordinginfo->recordingstart = strtotime($recording->recording_start);

Expand Down Expand Up @@ -1041,6 +1045,9 @@ public function get_user_recordings($userid, $from, $to) {
$allowedrecordingtypes = [
'MP4' => 'video',
'M4A' => 'audio',
'TRANSCRIPT' => 'transcript',
'CHAT' => 'chat',
'CC' => 'captions',
];

try {
Expand All @@ -1050,14 +1057,15 @@ public function get_user_recordings($userid, $from, $to) {

foreach ($response as $meeting) {
foreach ($meeting->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->meetingid = $meeting->id;
$recordinginfo->meetinguuid = $meeting->uuid;
$recordinginfo->url = $recording->play_url;
$recordinginfo->url = $url;
$recordinginfo->filetype = $recording->file_type;
$recordinginfo->recordingtype = $allowedrecordingtypes[$recording->file_type];
$recordinginfo->recordingtype = $recording->recording_type;
$recordinginfo->recordingstart = strtotime($recording->recording_start);

$recordings[$recording->id] = $recordinginfo;
Expand Down
12 changes: 12 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -965,5 +965,17 @@ function xmldb_zoom_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2024030100, 'zoom');
}

if ($oldversion < 2024041900) {
// Update existing recording names to default for translatable recordingtype strings.
$meetings = $DB->get_records('zoom');

foreach ($meetings as $meeting) {
$DB->set_field_select('zoom_meeting_recordings', 'name', $meeting->name, 'zoomid = ?', [$meeting->id]);
}

// Zoom savepoint reached.
upgrade_mod_savepoint(true, 2024041900, 'zoom');
}

return true;
}
21 changes: 19 additions & 2 deletions lang/en/zoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,25 @@
$string['recordings'] = 'Recordings';
$string['recordingshow'] = 'Show Recording (Currently Hidden)';
$string['recordingshowtoggle'] = 'Toggle Show Recording';
$string['recordingtypeaudio'] = 'Audio only';
$string['recordingtypevideo'] = 'Video and Audio';
$string['recordingtype_active_speaker'] = 'Active Speaker';
$string['recordingtype_audio_interpretation'] = 'Audio Interpretation';
$string['recordingtype_audio_only'] = 'Audio Only';
$string['recordingtype_audio_transcript'] = 'Audio Transcript';
$string['recordingtype_chat'] = 'Chat File';
$string['recordingtype_closed_caption'] = 'Closed Caption';
$string['recordingtype_gallery'] = 'Gallery View';
$string['recordingtype_poll'] = 'Poll';
$string['recordingtype_production_studio'] = 'Production Studio';
$string['recordingtype_shared'] = 'Shared Screen';
$string['recordingtype_shared_gallery'] = 'Shared Screen with Gallery View';
$string['recordingtype_shared_speaker'] = 'Shared Screen with Speaker View';
$string['recordingtype_shared_speaker_cc'] = 'Shared Screen with Speaker View (CC)';
$string['recordingtype_sign'] = 'Sign Interpretation';
$string['recordingtype_speaker'] = 'Speaker View';
$string['recordingtype_summary'] = 'Summary';
$string['recordingtype_summary_next_steps'] = 'Summary Next Steps';
$string['recordingtype_summary_smart_chapters'] = 'Summary Smart Chapters';
$string['recordingtype_timeline'] = 'Timeline';
$string['recordingurl'] = 'Recording URL';
$string['recordingview'] = 'View Recordings';
$string['recordingvisibility'] = 'Are recordings for this meeting visible by default?';
Expand Down
41 changes: 40 additions & 1 deletion recordings.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@
$recordingshowhtml = html_writer::div($recordingshowbuttonhtml);
}

$recordingname = trim($recording->name) . ' (' . zoom_get_recording_type_string($recording->recordingtype). ')';
$params = ['id' => $cm->id, 'recordingid' => $recording->id];
$recordingurl = new moodle_url('/mod/zoom/loadrecording.php', $params);
$recordinglink = html_writer::link($recordingurl, $recording->name);
$recordinglink = html_writer::link($recordingurl, $recordingname);
$recordinglinkhtml = html_writer::span($recordinglink, 'recording-link', ['style' => 'margin-right:1rem']);
$recordinghtml .= html_writer::div($recordinglinkhtml, 'recording', ['style' => 'margin-bottom:.5rem']);
}
Expand All @@ -135,6 +136,44 @@
}
}

/**
* 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',
'audio_interpretation' => 'recordingtype_audio_interpretation',
'audio_only' => 'recordingtype_audio_only',
'audio_transcript' => 'recordingtype_audio_transcript',
'chat_file' => 'recordingtype_chat',
'closed_caption' => 'recordingtype_closed_caption',
'gallery_view' => 'recordingtype_gallery',
'poll' => 'recordingtype_poll',
'production_studio' => 'recordingtype_production_studio',
'shared_screen' => 'recordingtype_shared',
'shared_screen_with_gallery_view' => 'recordingtype_shared_gallery',
'shared_screen_with_speaker_view' => 'recordingtype_shared_speaker',
'shared_screen_with_speaker_view(CC)' => 'recordingtype_shared_speaker_cc',
'sign_interpretation' => 'recordingtype_sign',
'speaker_view' => 'recordingtype_speaker',
'summary' => 'recordingtype_summary',
'summary_next_steps' => 'recordingtype_summary_next_steps',
'summary_smart_chapters' => 'recordingtype_summary_smart_chapters',
'timeline' => 'recordingtype_timeline',
];

// Return some default string in case new recordingtype values are added in the future.
if (empty($recordingtypestringmap[$recordingtype])) {
return $recordingtype;
}

return get_string($recordingtypestringmap[$recordingtype], 'mod_zoom');
}

echo html_writer::table($table);

echo $OUTPUT->footer();
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'mod_zoom';
$plugin->version = 2024030100;
$plugin->version = 2024041900;
$plugin->release = 'v5.2.0';
$plugin->requires = 2019052000;
$plugin->maturity = MATURITY_STABLE;
Expand Down

0 comments on commit 0e35c56

Please sign in to comment.