mitodl / ocw-studio

Open Source Courseware authoring tool
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

Copy videos from one course to another #2120

Closed pt2302 closed 4 months ago

pt2302 commented 4 months ago

What are the relevant tickets?

Closes https://github.com/mitodl/ocw-studio/issues/2111.

Description (What does it do?)

This PR adds a management command to copy videos and associated transcripts from one course to another. The command can be run with an optional video_uuids argument to copy only specific videos; otherwise all videos from the course are copied.

While this command will copy Google Drive files that already exist from one course's folder to another course's folder, this PR does not currently create Google Drive files if those are missing; that can be handled separately by running the management command added here: https://github.com/mitodl/ocw-studio/pull/2081.

This PR also includes some refactoring to move functions that are used in multiple management command to utility libraries.

How can this be tested?

Pick a course that has videos and copy them to another course, by running

docker compose exec web ./manage.py copy_videos --source_course <source_course> --destination_course <destination course> --video_uuids <optional; comma-separated list of video-uuids>

Publish the course and verify that the videos, transcripts, and captions all look as expected. Also verify that the paths for the files are now pointing to the destination course.