Add Crop Action Type and Parameters for Video Segment Cropping #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Crop Action Type and Parameters for Video Segment Cropping
Summary
This PR extends the SponsorBlockServer to support a new
Cropaction type and crop parameters for video segments, enabling users to define crop regions for both timestamp-bound cropping (chapter + crop) and full-video cropping (windowbox + crop).Changes Made
Type System Updates
Crop = "crop"to theActionTypeenumwindowboxcategory to the category list and type definitionsIncomingSegment,Segment, andDBSegmentinterfaces with optional crop parameters:cropLeft?: number(0-255, left crop ratio * 256)cropRight?: number(0-255, right crop ratio * 256)cropTop?: number(0-255, top crop ratio * 256)cropBottom?: number(0-255, bottom crop ratio * 256)Category Support Configuration
windowboxcategory with support forfullandcropactionscropaction support to existingchaptercategoryDatabase Schema
_upgrade_sponsorTimes_45.sqlto add crop fields tosponsorTimestableServer-Side Logic
Testing
Implementation Details
The crop parameters use integer values 0-255 representing crop ratios multiplied by 256, allowing precise crop region definitions while maintaining efficient storage and transmission.
Link to Devin run: https://app.devin.ai/sessions/d603923e56b246339b2c69516e4818c1
Requested by: Erkin Alp Güney (erkinalp9035@gmail.com)