Skip to content

KB-13903 | Replace Video file in existing resource#218

Open
SnehaAthul wants to merge 2 commits into
KB-iGOT:4.8.39-KB-13903from
SnehaAthul:4.8.39-KB-13903-replace-video
Open

KB-13903 | Replace Video file in existing resource#218
SnehaAthul wants to merge 2 commits into
KB-iGOT:4.8.39-KB-13903from
SnehaAthul:4.8.39-KB-13903-replace-video

Conversation

@SnehaAthul

Copy link
Copy Markdown

Adds two new APIs to ExtendedContentController:

  • POST /content/v1/durationSync/:identifier — recalculates a course's total duration from scratch by summing durations across its leaf nodes (duration for Learning Resources, expectedDuration for Course Assessments), then updates it via systemUpdate.
  • POST /content/v1/replaceVideo — replaces a resource's video (URL, storage keys, duration) and syncs the same fields into the resource node and the course's Cassandra hierarchy.

Changes

Duration Sync:

  • Reads the course node, extracts leafNodes, and reads each leaf node individually via the Content Read API.
  • Sums duration for Learning Resource nodes and expectedDuration for Course Assessment nodes.
  • Updates the course's duration field via systemUpdate.

replaceVideo

  • Replaces a resource's video and syncs details (previewUrl, artifactUrl, downloadUrl, cloudStorageKey, s3Key, duration) across both the resource node and the course hierarchy.
  • Derives cloudStorageKey from new videoUrl; duration via ffprobe.
  • Updates resource via systemUpdate, then recursively updates the matching leaf in the course's Cassandra hierarchy.

Dependencies
Requires ffprobe (part of FFmpeg) installed — used by replaceVideo to determine video duration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants