Skip to content

Clips Existing Standalone

Merge Request Guidelines

  1. Please fill this form out to the best of your ability.
  2. Follow the principle of "One Merge Request, One Concern"
  3. Merge Requests must be complete in total.
  4. Contributed Code must be universal in scope, ie: Able to be used for all installs / install environments.

Description

A fair amount of changes have been made with the underlying goal to allow Clips to exist on OSP standalone, even after the parent videos are gone.

  • Fixing the Channel Settings clip cards' titles so they work properly as links.
  • Getting the top navbar's Search Bar to properly display Clips.
  • On the clip viewer page, a Clip that has a parent Video now shows a link to said parent Video next to its title.
  • Setting up new columns in Clips table: clipDate, owningUser, channelID, and topic. They are auto-populated by dbFixes and systemFixes.
  • Clips in a Clips list panel can now be sorted by their dates - i.e. their new "clipDate" values.
  • Setting up max Clip Retention to allow for some management of clips independent of videos, plus two new scheduler tasks.
  • Decoupling clips from videos so that clips can now stay on the site even after the parent video is gone.
    • Changes in various places were made to accomodate this new case and prevent existing functionality from breaking.
    • More details are listed over in Testing section.

Motivation and Context

When it comes to streaming, Short clips from streams, and compilations of memorable moments from streams, are one of the more valuable tools that streamers have for marketing themselves. Not particularly practical to ask someone to watch a full VOD, compared to a compilation that trims out the fat. A streaming site that automatically deletes Clips whenever a VOD is deleted goes against that.

Also, with the deletion of VODs resulting in associated clips being deleted too, the only way to preserve Clips on OSP is: Save a VOD; make clips of it; download said clips; delete the VOD; then re-upload the clips which had been auto-deleted. It would be more practical to just allow Clips to exist standalone even after the parent VOD is gone.

How Has This Been Tested?

This was tested on a test OSP instance meant for experimentation and testing.

  • Searching in the search bar generates clips in the search results pop-up.
  • New DB table columns
    • "Clips" table has new columns: "clipDate", "owningUser", "channelID", and "topic"
      • Foreign key "Clips_ibfk_1" for Clips.parentVideo is replaced by new named FK, with ondelete value of "SET NULL".
      • New named foreign keys are created for Clips.channelID and Clips.owningUser, with ondelete values of "CASCADE".
    • "Channel" table has new column: "maxClipRetention"
    • "settings" table for system settings has new column: "maxClipRetention"
    • The above columns are properly initialized with the appropriate values, in dbFixes and systemFixes.
      • "maxClipRetention" is initialized to 0.
      • "clipDate" is obtained from the date-time of the clip's .mp4 file.
      • "owningUser", "channelID", and "topic" are filled with the same values from the Clip's parent Video.
  • Clip/Video Operations
    • Creating a clip from a VOD still works, and adds data to the new columns as expected. clipDate is set to current time; and owningUser, channelID, and topic are copied from the parent Video.
    • Editing Clip metadata still works, and there's now an option to change a Clip's topic.
    • Deleting a clip still works, for owner and admin.
    • Deleting a parent video does NOT auto-delete its clips, and the clips' DB records have their "parentVideo" value set to NULL, as expected.
    • Moving a Video from one channel to another will also move all Clips of that Video to the other channel - changing DB record values and moving files.
  • Clip Cards in Clips Panel
    • Clip cards still show clip information and working links for user, channel, and topic.
    • Clip cards now show their new clip dates
    • Sorting Clips by Date is an option now.
    • "Private Channel" check works to determine whether or not to show channel's clips.
    • "/topic//" displays Clips, including Clips with no parent video.
  • Clip Viewer Page:
    • Clip viewer page can load and play Clips with no parent video.
    • Clip viewer page shows all appropriate data: Channel name + image + link, and Topic link.
    • Clip date is shown next to channel name, just like for Videos.
    • Clip Controls:
      • The subscribe/unsubscribe button to subscribe to or unsubscribe from a channel works.
      • The upvote toggle of a Clip still works, as does sending the notification to clip's owner.
      • Toggling whether a clip is published or not still works, as does sending the notification to subscribed users.
      • Controls of clip's owner (Download, Thumbnail, Edit Metadata, Delete) are visible for clip owner + admin.
      • Clip screenshot modal works, and successfully generates a new thumbnail for the clip.
      • Changing clip's metadata works, for clip owner and for admin.
        • New Topic element in edit metadata modal works successfully.
  • User Profile Page
    • Can now show clips with no parent video.
  • Channel Settings Page:
    • The clip links in the clip titles now work properly.
    • the clips' date fields show their clip date values.
    • The clips show their Topics.
    • New Topic element in edit metadata modal works successfully.
    • Operation to capture screenshot of clip to use as new thumbnail works successfully.
    • Moving a Video to another channel will also dynamically update the page to place the Clips in their new appropriate location.
    • Max Clip Retention:
      • New "Maximum Retention for Clips Before Deletion (days)" setting shows up for each Channel. Clicking on labels for max clip retention focuses on correct corresponding input field.
      • "Global Max Clip Retention" value shows as a subtitle by the input for the Channel's Max Clip Retention
      • Channel's DB record is updated when changing max clip retention
      • Client-side validation of channel max clip retention works
      • Server-side validation works to catch any erroneous input for channel max clip retention.
  • Admin Page:
    • New "Maximum Retention for Clips Before Deletion (days)" setting shows up in Settings. Clicking on label for max clip retention focuses on corresponding input field.
    • Saving new value for max clip retention will update the system settings DB record.
    • Client-side validation works for both Max Clip Retention and Max Video Retention
    • Server-side validation works to catch any erroneous input for both Max Clip Retention and Max Video Retention
    • New Scheduler Tasks are shown: "Check Clip Retention", "Check Video and Clip Retention".
  • Scheduler Tasks:
    • "Check Video Retention" still works, delete Videos without deleting Clips.
    • "Check Clip Retention" works, deleting Clips without deleting Videos.
    • New "Check Video and Clip Retention" task succeeds in deleting of Clips and Videos within one iteration through the "Channels" table.
  • "/apiv1" routes for Clips:
    • /clip/
      • GET (get all clips) | Works successfully
    • /clip/search
      • POST (search for Clips with an input term) | Works successfully
    • /clip/
      • GET (get info of one clip) | Works successfully
      • PUT (change name, description, or topic, of a clip) | Works successfully. The description of this route has been updated as well.
      • DELETE (delete a Clip) | Works successfully

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • Merge Request Follows the Merge Request Guidelines
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
Edited by Kenneth Larson

Merge request reports