-
Notifications
You must be signed in to change notification settings - Fork 284
Update video_split_by_scene_mapper.py #744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,7 +29,7 @@ class VideoSplitBySceneMapper(Mapper): | |||||||||||||||||||||
| """Mapper to cut videos into scene clips.""" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Define shared detector keys and their properties | ||||||||||||||||||||||
| avaliable_detectors = { | ||||||||||||||||||||||
| available_detectors = { | ||||||||||||||||||||||
| "ContentDetector": ["weights", "luma_only", "kernel_size"], | ||||||||||||||||||||||
| "AdaptiveDetector": [ | ||||||||||||||||||||||
| "window_width", | ||||||||||||||||||||||
|
|
@@ -66,10 +66,10 @@ def __init__( | |||||||||||||||||||||
| super().__init__(*args, **kwargs) | ||||||||||||||||||||||
| self._init_parameters = self.remove_extra_parameters(locals()) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if detector not in self.avaliable_detectors: | ||||||||||||||||||||||
| if detector not in self.available_detectors: | ||||||||||||||||||||||
| raise ValueError( | ||||||||||||||||||||||
| f"Scene detector {detector} is not supported. " | ||||||||||||||||||||||
| f"Can only be one of {list(self.avaliable_detectors.keys())}" | ||||||||||||||||||||||
| f"Can only be one of {list(self.available_detectors.keys())}" | ||||||||||||||||||||||
|
Comment on lines
+69
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To maintain consistency with the proposed change of Style Guide References
Suggested change
Footnotes
|
||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| self.detector = detector | ||||||||||||||||||||||
|
|
@@ -78,9 +78,9 @@ def __init__( | |||||||||||||||||||||
| self.show_progress = show_progress | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # prepare detector args | ||||||||||||||||||||||
| avaliable_kwargs = self.avaliable_detectors[self.detector] | ||||||||||||||||||||||
| available_kwargs = self.available_detectors[self.detector] | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To maintain consistency with the proposed change of Style Guide References
Suggested change
Footnotes
|
||||||||||||||||||||||
| self.detector_class = getattr(scenedetect.detectors, self.detector) | ||||||||||||||||||||||
| self.detector_kwargs = {key: kwargs[key] for key in avaliable_kwargs if key in kwargs} | ||||||||||||||||||||||
| self.detector_kwargs = {key: kwargs[key] for key in available_kwargs if key in kwargs} | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def process_single(self, sample, context=False): | ||||||||||||||||||||||
| # there is no video in this sample | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to PEP 8, constants should be named using
UPPER_CASE_WITH_UNDERSCORES1. Renamingavailable_detectorstoAVAILABLE_DETECTORSwill make it clearer that this is a class-level constant and improve overall code readability.Style Guide References
Footnotes
PEP 8 specifies that constants should be written in all capital letters with underscores separating words. This applies to module-level and class-level constants. ↩