Skip to content

Commit 953233c

Browse files
committed
[docs] Format md code blocks for new ruff 0.16
1 parent bba97f5 commit 953233c

4 files changed

Lines changed: 26 additions & 14 deletions

File tree

.github/ISSUE_TEMPLATE/scenedetect_package.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ Include code samples that demonstrate the issue:
1414

1515
```python
1616
from scenedetect import detect, ContentDetector, split_video_ffmpeg
17-
scene_list = detect('my_video.mp4', ContentDetector())
18-
split_video_ffmpeg('my_video.mp4', scene_list)
17+
18+
scene_list = detect("my_video.mp4", ContentDetector())
19+
split_video_ffmpeg("my_video.mp4", scene_list)
1920
```
2021

2122
**Environment:**

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ To get started, there is a high level function in the library that performs cont
6161

6262
```python
6363
from scenedetect import detect, ContentDetector
64-
scene_list = detect('my_video.mp4', ContentDetector())
64+
65+
scene_list = detect("my_video.mp4", ContentDetector())
6566
```
6667

6768
`scene_list` will now be a list containing the start/end times of all scenes found in the video. There also exists a two-pass version `AdaptiveDetector` which handles fast camera movement better, and `ThresholdDetector` for handling fade out/fade in events.
@@ -70,20 +71,28 @@ Try calling `print(scene_list)`, or iterating over each scene:
7071

7172
```python
7273
from scenedetect import detect, ContentDetector
73-
scene_list = detect('my_video.mp4', ContentDetector())
74+
75+
scene_list = detect("my_video.mp4", ContentDetector())
7476
for i, scene in enumerate(scene_list):
75-
print(' Scene %2d: Start %s / Frame %d, End %s / Frame %d' % (
76-
i+1,
77-
scene[0].get_timecode(), scene[0].frame_num,
78-
scene[1].get_timecode(), scene[1].frame_num,))
77+
print(
78+
" Scene %2d: Start %s / Frame %d, End %s / Frame %d"
79+
% (
80+
i + 1,
81+
scene[0].get_timecode(),
82+
scene[0].frame_num,
83+
scene[1].get_timecode(),
84+
scene[1].frame_num,
85+
)
86+
)
7987
```
8088

8189
We can also split the video into each scene if `ffmpeg` is installed (`mkvmerge` is also supported):
8290

8391
```python
8492
from scenedetect import detect, ContentDetector, split_video_ffmpeg
85-
scene_list = detect('my_video.mp4', ContentDetector())
86-
split_video_ffmpeg('my_video.mp4', scene_list)
93+
94+
scene_list = detect("my_video.mp4", ContentDetector())
95+
split_video_ffmpeg("my_video.mp4", scene_list)
8796
```
8897

8998
For more advanced usage, the API is highly configurable, and can easily integrate with any pipeline. This includes using different detection algorithms, splitting the input video, and much more. The following example shows how to implement a function similar to the above, but using [the `scenedetect` API](https://www.scenedetect.com/docs/latest/api.html):
@@ -93,12 +102,12 @@ from scenedetect import open_video, SceneManager, split_video_ffmpeg
93102
from scenedetect.detectors import ContentDetector
94103
from scenedetect.video_splitter import split_video_ffmpeg
95104

105+
96106
def split_video_into_scenes(video_path, threshold=27.0):
97107
# Open our video, create a scene manager, and add a detector.
98108
video = open_video(video_path)
99109
scene_manager = SceneManager()
100-
scene_manager.add_detector(
101-
ContentDetector(threshold=threshold))
110+
scene_manager.add_detector(ContentDetector(threshold=threshold))
102111
scene_manager.detect_scenes(video, show_progress=True)
103112
scene_list = scene_manager.get_scene_list()
104113
split_video_ffmpeg(video_path, scene_list, show_progress=True)

website/pages/api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import typing as ty
4545
import numpy as np
4646
from scenedetect import FrameTimecode, SceneDetector
4747

48+
4849
class CustomDetector(SceneDetector):
4950
"""CustomDetector class to implement a scene detection algorithm."""
5051

website/pages/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ Split video on each fast cut using [Python API (docs)](docs.md):
2121

2222
```python
2323
from scenedetect import detect, AdaptiveDetector, split_video_ffmpeg
24-
scene_list = detect('my_video.mp4', AdaptiveDetector())
25-
split_video_ffmpeg('my_video.mp4', scene_list)
24+
25+
scene_list = detect("my_video.mp4", AdaptiveDetector())
26+
split_video_ffmpeg("my_video.mp4", scene_list)
2627
```
2728

2829

0 commit comments

Comments
 (0)